diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ee6d03..f492c6b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 25.3.0 + +* Added: `Client.setBearer()` method for OAuth access token authentication +* Added: `Query.vectorDot`, `Query.vectorCosine`, `Query.vectorEuclidean` vector similarity query methods +* Added: `appwrite` value to `OAuthProvider` enum +* Added: `Locale` model fields: `city`, `timeZone`, `postalCode`, `latitude`, `longitude`, ISP and connection details +* Updated: `Log` model docs now include `hidden` user type + ## 25.2.0 * Added: Realtime connections now authenticate with the configured JWT. diff --git a/README.md b/README.md index a4cf00a8..804fca53 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^25.2.0 + appwrite: ^25.3.0 ``` You can install packages from the command line: diff --git a/example/README.md b/example/README.md index d0cb0c2b..36537cbf 100644 --- a/example/README.md +++ b/example/README.md @@ -6,7 +6,7 @@ Init your Appwrite client: Client client = Client(); client - .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setEndpoint('https://localhost:9521/v1') // Your Appwrite Endpoint .setProject('5e8cf4f46b5e8') // Your project ID .setSelfSigned() // Remove in production ; diff --git a/lib/query.dart b/lib/query.dart index 3693dce6..2772116a 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -252,6 +252,18 @@ class Query { [values, distance, meters] ]).toString(); + /// Filter resources using vector dot product similarity. + static String vectorDot(String attribute, List vector) => + Query._('vectorDot', attribute, [vector]).toString(); + + /// Filter resources using vector cosine similarity. + static String vectorCosine(String attribute, List vector) => + Query._('vectorCosine', attribute, [vector]).toString(); + + /// Filter resources using vector Euclidean distance. + static String vectorEuclidean(String attribute, List vector) => + Query._('vectorEuclidean', attribute, [vector]).toString(); + /// Filter resources where [attribute] intersects with the given geometry. static String intersects(String attribute, List values) => Query._('intersects', attribute, [values]).toString(); diff --git a/lib/src/client.dart b/lib/src/client.dart index cc077e56..dbfe4bdf 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -66,6 +66,11 @@ abstract class Client { /// Your secret JSON Web Token. Client setJWT(String value); + /// Set Bearer. + /// + /// The OAuth access token to authenticate with. + Client setBearer(String value); + /// Set Locale. Client setLocale(String value); diff --git a/lib/src/client_base.dart b/lib/src/client_base.dart index da1a5225..9e6cf566 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -10,6 +10,11 @@ abstract class ClientBase implements Client { /// Your secret JSON Web Token @override ClientBase setJWT(value); + + /// The OAuth access token to authenticate with + @override + ClientBase setBearer(value); + @override ClientBase setLocale(value); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 32945efd..38cee6bb 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '25.2.0', + 'x-sdk-version': '25.3.0', 'X-Appwrite-Response-Format': '1.9.5', }; @@ -71,6 +71,14 @@ class ClientBrowser extends ClientBase with ClientMixin { return this; } + /// The OAuth access token to authenticate with + @override + ClientBrowser setBearer(value) { + config['bearer'] = value; + addHeader('Authorization', 'Bearer $value'); + return this; + } + @override ClientBrowser setLocale(value) { config['locale'] = value; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 78a368ae..a4cae30f 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '25.2.0', + 'x-sdk-version': '25.3.0', 'X-Appwrite-Response-Format': '1.9.5', }; @@ -97,6 +97,14 @@ class ClientIO extends ClientBase with ClientMixin { return this; } + /// The OAuth access token to authenticate with + @override + ClientIO setBearer(value) { + config['bearer'] = value; + addHeader('Authorization', 'Bearer $value'); + return this; + } + @override ClientIO setLocale(value) { config['locale'] = value; diff --git a/lib/src/enums/o_auth_provider.dart b/lib/src/enums/o_auth_provider.dart index b88e0a55..6c8dbc70 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -3,6 +3,7 @@ part of '../../enums.dart'; enum OAuthProvider { amazon(value: 'amazon'), apple(value: 'apple'), + appwrite(value: 'appwrite'), auth0(value: 'auth0'), authentik(value: 'authentik'), autodesk(value: 'autodesk'), diff --git a/lib/src/models/locale.dart b/lib/src/models/locale.dart index 54dd0c29..c29b9e25 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -23,6 +23,39 @@ class Locale implements Model { /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format final String currency; + /// City + final String? city; + + /// Name of timezone + final String? timeZone; + + /// Postal code + final String? postalCode; + + /// Latitude + final double? latitude; + + /// Longitude + final double? longitude; + + /// Autonomous System Number (ASN) of the IP + final String? autonomousSystemNumber; + + /// Organization that owns the ASN + final String? autonomousSystemOrganization; + + /// Internet service provider of the IP + final String? isp; + + /// Connection type of the IP (e.g. cable, cellular, corporate) + final String? connectionType; + + /// User type classification of the IP (e.g. residential, business, hosting) + final String? connectionUsageType; + + /// Registered organization of the IP + final String? connectionOrganization; + Locale({ required this.ip, required this.countryCode, @@ -31,6 +64,17 @@ class Locale implements Model { required this.continent, required this.eu, required this.currency, + this.city, + this.timeZone, + this.postalCode, + this.latitude, + this.longitude, + this.autonomousSystemNumber, + this.autonomousSystemOrganization, + this.isp, + this.connectionType, + this.connectionUsageType, + this.connectionOrganization, }); factory Locale.fromMap(Map map) { @@ -42,6 +86,18 @@ class Locale implements Model { continent: map['continent'].toString(), eu: map['eu'], currency: map['currency'].toString(), + city: map['city']?.toString(), + timeZone: map['timeZone']?.toString(), + postalCode: map['postalCode']?.toString(), + latitude: map['latitude']?.toDouble(), + longitude: map['longitude']?.toDouble(), + autonomousSystemNumber: map['autonomousSystemNumber']?.toString(), + autonomousSystemOrganization: + map['autonomousSystemOrganization']?.toString(), + isp: map['isp']?.toString(), + connectionType: map['connectionType']?.toString(), + connectionUsageType: map['connectionUsageType']?.toString(), + connectionOrganization: map['connectionOrganization']?.toString(), ); } @@ -55,6 +111,17 @@ class Locale implements Model { "continent": continent, "eu": eu, "currency": currency, + "city": city, + "timeZone": timeZone, + "postalCode": postalCode, + "latitude": latitude, + "longitude": longitude, + "autonomousSystemNumber": autonomousSystemNumber, + "autonomousSystemOrganization": autonomousSystemOrganization, + "isp": isp, + "connectionType": connectionType, + "connectionUsageType": connectionUsageType, + "connectionOrganization": connectionOrganization, }; } } diff --git a/lib/src/models/log.dart b/lib/src/models/log.dart index 572cce50..d754130d 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -17,7 +17,7 @@ class Log implements Model { /// API mode when event triggered. final String mode; - /// User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + /// User type who triggered the audit log. Possible values: user, admin, guest, hidden, keyProject, keyAccount, keyOrganization. final String userType; /// IP session in use when the session was created. diff --git a/pubspec.yaml b/pubspec.yaml index 1277dec1..7009bc3b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 25.2.0 +version: 25.3.0 description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter diff --git a/test/src/models/execution_list_test.dart b/test/src/models/execution_list_test.dart index a3305e55..8d209722 100644 --- a/test/src/models/execution_list_test.dart +++ b/test/src/models/execution_list_test.dart @@ -1,4 +1,5 @@ import 'package:appwrite/models.dart'; +import 'package:appwrite/enums.dart'; import 'package:flutter_test/flutter_test.dart'; void main() {