Skip to content

Commit 271931a

Browse files
authored
Merge pull request #80 from appwrite/dev-chirag
chore: regenerate sdk
2 parents 99da6f6 + ab809d1 commit 271931a

17 files changed

+149
-45
lines changed

CHANGELOG.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Change Log
22

3+
## 16.1.0
4+
5+
* Add `gif` support to `ImageFormat` enum
6+
* Add support for `dart38` and `flutter332` runtimes
7+
* Add `upsertDocument()` method to Databases service
8+
* Fix `convertTo()` method in `Document` and `Preferences` models to correctly accept `Map<String, dynamic>`
9+
* Fix `upsertDocuments()` method to have `documents` attribute as required parameter
10+
311
## 16.0.0
412

5-
* Add `&lt;REGION&gt;` to doc examples due to the new multi region endpoints
13+
* Add `<REGION>` to doc examples due to the new multi region endpoints
614
* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc.
715
* Add doc examples, class and methods for new `Sites` service
816
* Add doc examples, class and methods for new `Tokens` service
@@ -15,13 +23,13 @@
1523
## 14.0.0
1624

1725
* Breaking changes:
18-
* Changed the typing of `AppwriteException`&#039;s response parameter from a `dynamic` object to an optional string (`?String`).
26+
* Changed the typing of `AppwriteException`'s response parameter from a `dynamic` object to an optional string (`?String`).
1927

2028
## 13.0.0
2129

2230
* Fixed realtime pong response.
2331
* Fixed issues with `chunkedUpload` method.
24-
* Fixed type mismatch bug where `List&lt;dynamic&gt;` was incorrectly causing runtime type errors.
32+
* Fixed type mismatch bug where `List<dynamic>` was incorrectly causing runtime type errors.
2533
* Updated return type of `updateMfaChallenge()` from raw data to properly typed `models.Session` object.
2634

2735
## 12.0.0
@@ -151,7 +159,7 @@ You can find the new syntax for breaking changes in the [Appwrite API references
151159
* The `number` argument in phone endpoints have been renamed to `phone`
152160
* List endpoints no longer support `limit`, `offset`, `cursor`, `cursorDirection`, `orderAttributes`, `orderTypes` as they have been moved to the `queries` array
153161
* `read` and `write` permission have been deprecated and they are now included in the `permissions` array
154-
* Parameter `permission` for collections and buckets are now renamed to `documentSecurity` &amp; `fileSecurity` respectively
162+
* Parameter `permission` for collections and buckets are now renamed to `documentSecurity` & `fileSecurity` respectively
155163
* Renamed methods of the Query helper
156164
1. `lesser` renamed to `lessThan`
157165
2. `lesserEqual` renamed to `lessThanEqual`
@@ -167,8 +175,8 @@ You can find the new syntax for breaking changes in the [Appwrite API references
167175

168176
## 6.0.0
169177
* Support for Appwrite 0.15
170-
* **BREAKING** `Database` -&gt; `Databases`
171-
* **BREAKING** `account.createSession()` -&gt; `account.createEmailSession()`
178+
* **BREAKING** `Database` -> `Databases`
179+
* **BREAKING** `account.createSession()` -> `account.createEmailSession()`
172180
* **BREAKING** `dateCreated` attribute removed from `Team`, `Execution`, `File` models
173181
* **BREAKING** `dateCreated` and `dateUpdated` attribute removed from `Func`, `Deployment`, `Bucket` models
174182
* **BREAKING** Realtime channels
@@ -182,7 +190,7 @@ You can find the new syntax for breaking changes in the [Appwrite API references
182190

183191
## 5.0.0
184192
* Support for Appwrite 0.14
185-
* **BREAKING** `account.delete()` -&gt; `account.updateStatus()`
193+
* **BREAKING** `account.delete()` -> `account.updateStatus()`
186194
* **BREAKING** Execution model `stdout` renamed to `response`
187195
* **BREAKING** Membership model `name` renamed to `userName` and `email` renamed to `userEmail`
188196
* Added `teamName` to Membership model
@@ -200,7 +208,7 @@ You can find the new syntax for breaking changes in the [Appwrite API references
200208
* **BREAKING** **Tags** have been renamed to **Deployments**
201209
* **BREAKING** `createFile` function expects Bucket ID as the first parameter
202210
* **BREAKING** `createDeployment` and `createFile` functions expect an instance **InputFile** rather than the instance of **MultipartFile**
203-
* **BREAKING** `list&lt;Entity&gt;` endpoints now contain a `total` attribute instead of `sum`
211+
* **BREAKING** `list<Entity>` endpoints now contain a `total` attribute instead of `sum`
204212
* `onProgress()` callback function for endpoints supporting file uploads
205213
* Support for synchronous function executions
206214
* Bug fixes and Improvements
@@ -237,7 +245,7 @@ You can find the new syntax for breaking changes in the [Appwrite API references
237245

238246
## 0.7.0
239247
- Support for Appwrite 0.9
240-
- Breaking - removed order type enum, now you should pass string &#039;ASC&#039; or &#039;DESC&#039;
248+
- Breaking - removed order type enum, now you should pass string 'ASC' or 'DESC'
241249
- Breaking - changed param name from `env` to `runtime` in the **Functions** API
242250
- Image Crop Gravity support in image preview service
243251
- New endpoint in Account getSession to get session by ID
@@ -258,7 +266,7 @@ You can find the new syntax for breaking changes in the [Appwrite API references
258266
- Upgraded all underlying dependencies to null safe version
259267
- BREAKING Renamed users.deleteUser to users.delete
260268
- BREAKING Renamed parameter inviteId to membershipId on teams.updateMembershipStatus, teams.deleteMembership
261-
- JWT Support client.setJWT(&#039;JWT_GENERATED_IN_CLIENT&#039;)
269+
- JWT Support client.setJWT('JWT_GENERATED_IN_CLIENT')
262270
- [Update membership roles](https://appwrite.io/docs/references/cloud/server-dart/teams?sdk=dart#updateMembershipRoles)
263271
- New awesome image preview features, supports borderRadius, borderColor, borderWidth
264272

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:
2323

2424
```yml
2525
dependencies:
26-
dart_appwrite: ^16.0.0
26+
dart_appwrite: ^16.1.0
2727
```
2828
2929
You can install packages from the command line:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
Client client = Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>') // Your project ID
6+
.setSession(''); // The user session to authenticate with
7+
8+
Databases databases = Databases(client);
9+
10+
Document result = await databases.upsertDocument(
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>',
13+
documentId: '<DOCUMENT_ID>',
14+
data: {},
15+
permissions: ["read("any")"], // (optional)
16+
);

docs/examples/databases/upsert-documents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ Databases databases = Databases(client);
1010
DocumentList result = await databases.upsertDocuments(
1111
databaseId: '<DATABASE_ID>',
1212
collectionId: '<COLLECTION_ID>',
13-
documents: [], // (optional)
13+
documents: [],
1414
);

lib/query.dart

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,17 @@ class Query {
8282
static String contains(String attribute, dynamic value) =>
8383
Query._('contains', attribute, value).toString();
8484

85-
static String or(List<String> queries) =>
86-
Query._(
87-
'or',
88-
null,
89-
queries.map((query) => jsonDecode(query)).toList(),
90-
).toString();
91-
92-
static String and(List<String> queries) =>
93-
Query._(
94-
'and',
95-
null,
96-
queries.map((query) => jsonDecode(query)).toList(),
97-
).toString();
85+
static String or(List<String> queries) => Query._(
86+
'or',
87+
null,
88+
queries.map((query) => jsonDecode(query)).toList(),
89+
).toString();
90+
91+
static String and(List<String> queries) => Query._(
92+
'and',
93+
null,
94+
queries.map((query) => jsonDecode(query)).toList(),
95+
).toString();
9896

9997
/// Specify which attributes should be returned by the API call.
10098
static String select(List<String> attributes) =>

lib/services/databases.dart

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,10 @@ class Databases extends Service {
11281128
return models.Document.fromMap(res.data);
11291129
}
11301130

1131+
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
1132+
/// yet officially supported. It may be subject to breaking changes or removal
1133+
/// in future versions.
1134+
///
11311135
/// Create new Documents. Before using this route, you should create a new
11321136
/// collection resource using either a [server
11331137
/// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
@@ -1156,15 +1160,18 @@ class Databases extends Service {
11561160
return models.DocumentList.fromMap(res.data);
11571161
}
11581162

1163+
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
1164+
/// yet officially supported. It may be subject to breaking changes or removal
1165+
/// in future versions.
1166+
///
11591167
/// Create or update Documents. Before using this route, you should create a
11601168
/// new collection resource using either a [server
11611169
/// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
11621170
/// API or directly from your database console.
1163-
///
11641171
Future<models.DocumentList> upsertDocuments({
11651172
required String databaseId,
11661173
required String collectionId,
1167-
List<Map>? documents,
1174+
required List<Map> documents,
11681175
}) async {
11691176
final String apiPath =
11701177
'/databases/{databaseId}/collections/{collectionId}/documents'
@@ -1185,6 +1192,10 @@ class Databases extends Service {
11851192
return models.DocumentList.fromMap(res.data);
11861193
}
11871194

1195+
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
1196+
/// yet officially supported. It may be subject to breaking changes or removal
1197+
/// in future versions.
1198+
///
11881199
/// Update all documents that match your queries, if no queries are submitted
11891200
/// then all documents are updated. You can pass only specific fields to be
11901201
/// updated.
@@ -1213,6 +1224,10 @@ class Databases extends Service {
12131224
return models.DocumentList.fromMap(res.data);
12141225
}
12151226

1227+
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
1228+
/// yet officially supported. It may be subject to breaking changes or removal
1229+
/// in future versions.
1230+
///
12161231
/// Bulk delete documents using queries, if no queries are passed then all
12171232
/// documents are deleted.
12181233
Future<models.DocumentList> deleteDocuments({
@@ -1267,6 +1282,44 @@ class Databases extends Service {
12671282
return models.Document.fromMap(res.data);
12681283
}
12691284

1285+
/// **WARNING: Experimental Feature** - This endpoint is experimental and not
1286+
/// yet officially supported. It may be subject to breaking changes or removal
1287+
/// in future versions.
1288+
///
1289+
/// Create or update a Document. Before using this route, you should create a
1290+
/// new collection resource using either a [server
1291+
/// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1292+
/// API or directly from your database console.
1293+
Future<models.Document> upsertDocument({
1294+
required String databaseId,
1295+
required String collectionId,
1296+
required String documentId,
1297+
required Map data,
1298+
List<String>? permissions,
1299+
}) async {
1300+
final String apiPath =
1301+
'/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
1302+
.replaceAll('{databaseId}', databaseId)
1303+
.replaceAll('{collectionId}', collectionId)
1304+
.replaceAll('{documentId}', documentId);
1305+
1306+
final Map<String, dynamic> apiParams = {
1307+
'data': data,
1308+
'permissions': permissions,
1309+
};
1310+
1311+
final Map<String, String> apiHeaders = {'content-type': 'application/json'};
1312+
1313+
final res = await client.call(
1314+
HttpMethod.put,
1315+
path: apiPath,
1316+
params: apiParams,
1317+
headers: apiHeaders,
1318+
);
1319+
1320+
return models.Document.fromMap(res.data);
1321+
}
1322+
12701323
/// Update a document by its unique ID. Using the patch method you can pass
12711324
/// only specific fields that will get updated.
12721325
Future<models.Document> updateDocument({

lib/services/tokens.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Tokens extends Service {
2929
}
3030

3131
/// Create a new token. A token is linked to a file. Token can be passed as a
32-
/// header or request get parameter.
32+
/// request URL search parameter.
3333
Future<models.ResourceToken> createFileToken({
3434
required String bucketId,
3535
required String fileId,

lib/src/client_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
3030
'x-sdk-name': 'Dart',
3131
'x-sdk-platform': 'server',
3232
'x-sdk-language': 'dart',
33-
'x-sdk-version': '16.0.0',
33+
'x-sdk-version': '16.1.0',
3434
'X-Appwrite-Response-Format': '1.7.0',
3535
};
3636

lib/src/client_io.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@ class ClientIO extends ClientBase with ClientMixin {
2626
String endPoint = 'https://cloud.appwrite.io/v1',
2727
bool selfSigned = false,
2828
}) : _endPoint = endPoint {
29-
_nativeClient =
30-
HttpClient()
31-
..badCertificateCallback =
32-
((X509Certificate cert, String host, int port) => selfSigned);
29+
_nativeClient = HttpClient()
30+
..badCertificateCallback =
31+
((X509Certificate cert, String host, int port) => selfSigned);
3332
_httpClient = IOClient(_nativeClient);
3433
_endPoint = endPoint;
3534
_headers = {
3635
'content-type': 'application/json',
3736
'x-sdk-name': 'Dart',
3837
'x-sdk-platform': 'server',
3938
'x-sdk-language': 'dart',
40-
'x-sdk-version': '16.0.0',
39+
'x-sdk-version': '16.1.0',
4140
'user-agent':
42-
'AppwriteDartSDK/16.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
41+
'AppwriteDartSDK/16.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
4342
'X-Appwrite-Response-Format': '1.7.0',
4443
};
4544

lib/src/client_mixin.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ mixin ClientMixin {
124124
'',
125125
streamedResponse.statusCode,
126126
headers: streamedResponse.headers.map(
127-
(k, v) =>
128-
k.toLowerCase() == 'content-type'
129-
? MapEntry(k, 'text/plain')
130-
: MapEntry(k, v),
127+
(k, v) => k.toLowerCase() == 'content-type'
128+
? MapEntry(k, 'text/plain')
129+
: MapEntry(k, v),
131130
),
132131
request: streamedResponse.request,
133132
isRedirect: streamedResponse.isRedirect,

0 commit comments

Comments
 (0)