react-native-appwrite 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/sdk.js +56 -1
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +56 -1
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/databases/upsert-document.md +17 -0
- package/package.json +1 -1
- package/src/client.ts +17 -1
- package/src/services/databases.ts +48 -0
- package/types/client.d.ts +11 -0
- package/types/services/databases.d.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
|
|
6
|
+
* Update default `quality` for `getFilePreview` from 0 to -1
|
|
7
|
+
* Remove `Gif` from ImageFormat enum
|
|
8
|
+
* Remove `search` param from `listExecutions` method
|
|
9
|
+
|
|
3
10
|
## 0.7.4
|
|
4
11
|
|
|
5
12
|
* Upgrade dependencies to resolve PlatformConstants error with Expo 53
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -93,13 +93,14 @@ class Client {
|
|
|
93
93
|
jwt: '',
|
|
94
94
|
locale: '',
|
|
95
95
|
session: '',
|
|
96
|
+
devkey: '',
|
|
96
97
|
platform: '',
|
|
97
98
|
};
|
|
98
99
|
this.headers = {
|
|
99
100
|
'x-sdk-name': 'React Native',
|
|
100
101
|
'x-sdk-platform': 'client',
|
|
101
102
|
'x-sdk-language': 'reactnative',
|
|
102
|
-
'x-sdk-version': '0.9.
|
|
103
|
+
'x-sdk-version': '0.9.1',
|
|
103
104
|
'X-Appwrite-Response-Format': '1.7.0',
|
|
104
105
|
};
|
|
105
106
|
this.realtime = {
|
|
@@ -336,6 +337,20 @@ class Client {
|
|
|
336
337
|
this.config.session = value;
|
|
337
338
|
return this;
|
|
338
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Set DevKey
|
|
342
|
+
*
|
|
343
|
+
* Your secret dev API key
|
|
344
|
+
*
|
|
345
|
+
* @param value string
|
|
346
|
+
*
|
|
347
|
+
* @return {this}
|
|
348
|
+
*/
|
|
349
|
+
setDevKey(value) {
|
|
350
|
+
this.headers['X-Appwrite-Dev-Key'] = value;
|
|
351
|
+
this.config.devkey = value;
|
|
352
|
+
return this;
|
|
353
|
+
}
|
|
339
354
|
/**
|
|
340
355
|
* Subscribes to Appwrite events and passes you the payload in realtime.
|
|
341
356
|
*
|
|
@@ -2069,6 +2084,46 @@ class Databases extends Service {
|
|
|
2069
2084
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2070
2085
|
return this.client.call('get', uri, {}, payload);
|
|
2071
2086
|
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Create or update a Document. Before using this route, you should create a
|
|
2089
|
+
* new collection resource using either a [server
|
|
2090
|
+
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
|
|
2091
|
+
* API or directly from your database console.
|
|
2092
|
+
*
|
|
2093
|
+
* @param {string} databaseId
|
|
2094
|
+
* @param {string} collectionId
|
|
2095
|
+
* @param {string} documentId
|
|
2096
|
+
* @param {object} data
|
|
2097
|
+
* @param {string[]} permissions
|
|
2098
|
+
* @throws {AppwriteException}
|
|
2099
|
+
* @returns {Promise}
|
|
2100
|
+
*/
|
|
2101
|
+
upsertDocument(databaseId, collectionId, documentId, data, permissions) {
|
|
2102
|
+
if (typeof databaseId === 'undefined') {
|
|
2103
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2104
|
+
}
|
|
2105
|
+
if (typeof collectionId === 'undefined') {
|
|
2106
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2107
|
+
}
|
|
2108
|
+
if (typeof documentId === 'undefined') {
|
|
2109
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2110
|
+
}
|
|
2111
|
+
if (typeof data === 'undefined') {
|
|
2112
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
2113
|
+
}
|
|
2114
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2115
|
+
const payload = {};
|
|
2116
|
+
if (typeof data !== 'undefined') {
|
|
2117
|
+
payload['data'] = data;
|
|
2118
|
+
}
|
|
2119
|
+
if (typeof permissions !== 'undefined') {
|
|
2120
|
+
payload['permissions'] = permissions;
|
|
2121
|
+
}
|
|
2122
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2123
|
+
return this.client.call('put', uri, {
|
|
2124
|
+
'content-type': 'application/json',
|
|
2125
|
+
}, payload);
|
|
2126
|
+
}
|
|
2072
2127
|
/**
|
|
2073
2128
|
* Update a document by its unique ID. Using the patch method you can pass
|
|
2074
2129
|
* only specific fields that will get updated.
|