Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
;
Expand Down
12 changes: 12 additions & 0 deletions lib/query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ class Query {
[values, distance, meters]
]).toString();

/// Filter resources using vector dot product similarity.
static String vectorDot(String attribute, List<num> vector) =>
Query._('vectorDot', attribute, [vector]).toString();

/// Filter resources using vector cosine similarity.
static String vectorCosine(String attribute, List<num> vector) =>
Query._('vectorCosine', attribute, [vector]).toString();

/// Filter resources using vector Euclidean distance.
static String vectorEuclidean(String attribute, List<num> vector) =>
Query._('vectorEuclidean', attribute, [vector]).toString();

/// Filter resources where [attribute] intersects with the given geometry.
static String intersects(String attribute, List<dynamic> values) =>
Query._('intersects', attribute, [values]).toString();
Expand Down
5 changes: 5 additions & 0 deletions lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions lib/src/client_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment thread
greptile-apps[bot] marked this conversation as resolved.

Expand Down
10 changes: 9 additions & 1 deletion lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down Expand Up @@ -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;
}
Comment thread
greptile-apps[bot] marked this conversation as resolved.

@override
ClientBrowser setLocale(value) {
config['locale'] = value;
Expand Down
10 changes: 9 additions & 1 deletion lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down Expand Up @@ -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;
}
Comment thread
greptile-apps[bot] marked this conversation as resolved.

@override
ClientIO setLocale(value) {
config['locale'] = value;
Expand Down
1 change: 1 addition & 0 deletions lib/src/enums/o_auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
67 changes: 67 additions & 0 deletions lib/src/models/locale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<String, dynamic> map) {
Expand All @@ -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(),
);
}

Expand All @@ -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,
};
}
}
2 changes: 1 addition & 1 deletion lib/src/models/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions test/src/models/execution_list_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:appwrite/models.dart';
import 'package:appwrite/enums.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
Expand Down
Loading