react-native-appwrite 0.11.0 → 0.13.0
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/README.md +84 -3
- package/dist/cjs/sdk.js +1854 -1121
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1854 -1122
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-password-session.md +4 -4
- package/docs/examples/account/create-email-token.md +5 -5
- package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
- package/docs/examples/account/create-mfa-authenticator.md +3 -3
- package/docs/examples/account/create-mfa-challenge.md +3 -3
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
- package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
- package/docs/examples/account/create-phone-token.md +4 -4
- package/docs/examples/account/create-push-target.md +5 -5
- package/docs/examples/account/create-recovery.md +4 -4
- package/docs/examples/account/create-session.md +4 -4
- package/docs/examples/account/create-verification.md +3 -3
- package/docs/examples/account/create.md +6 -6
- package/docs/examples/account/delete-identity.md +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +3 -3
- package/docs/examples/account/delete-push-target.md +3 -3
- package/docs/examples/account/delete-session.md +3 -3
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-session.md +3 -3
- package/docs/examples/account/list-identities.md +3 -3
- package/docs/examples/account/list-logs.md +3 -3
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/update-email.md +4 -4
- package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
- package/docs/examples/account/update-mfa-authenticator.md +4 -4
- package/docs/examples/account/update-mfa-challenge.md +4 -4
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
- package/docs/examples/account/update-name.md +3 -3
- package/docs/examples/account/update-password.md +4 -4
- package/docs/examples/account/update-phone-session.md +4 -4
- package/docs/examples/account/update-phone-verification.md +4 -4
- package/docs/examples/account/update-phone.md +4 -4
- package/docs/examples/account/update-prefs.md +7 -3
- package/docs/examples/account/update-push-target.md +4 -4
- package/docs/examples/account/update-recovery.md +5 -5
- package/docs/examples/account/update-session.md +3 -3
- package/docs/examples/account/update-verification.md +4 -4
- package/docs/examples/avatars/get-browser.md +6 -6
- package/docs/examples/avatars/get-credit-card.md +6 -6
- package/docs/examples/avatars/get-favicon.md +3 -3
- package/docs/examples/avatars/get-flag.md +6 -6
- package/docs/examples/avatars/get-image.md +5 -5
- package/docs/examples/avatars/get-initials.md +6 -6
- package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
- package/docs/examples/databases/create-document.md +13 -7
- package/docs/examples/databases/decrement-document-attribute.md +8 -8
- package/docs/examples/databases/delete-document.md +5 -5
- package/docs/examples/databases/get-document.md +6 -6
- package/docs/examples/databases/increment-document-attribute.md +8 -8
- package/docs/examples/databases/list-documents.md +5 -5
- package/docs/examples/databases/update-document.md +7 -7
- package/docs/examples/databases/upsert-document.md +7 -7
- package/docs/examples/functions/create-execution.md +9 -9
- package/docs/examples/functions/get-execution.md +4 -4
- package/docs/examples/functions/list-executions.md +4 -4
- package/docs/examples/graphql/mutation.md +3 -3
- package/docs/examples/graphql/query.md +3 -3
- package/docs/examples/messaging/create-subscriber.md +5 -5
- package/docs/examples/messaging/delete-subscriber.md +4 -4
- package/docs/examples/storage/create-file.md +6 -6
- package/docs/examples/storage/delete-file.md +4 -4
- package/docs/examples/storage/get-file-download.md +5 -5
- package/docs/examples/storage/get-file-preview.md +16 -16
- package/docs/examples/storage/get-file-view.md +5 -5
- package/docs/examples/storage/get-file.md +4 -4
- package/docs/examples/storage/list-files.md +5 -5
- package/docs/examples/storage/update-file.md +6 -6
- package/docs/examples/tablesdb/create-row.md +23 -0
- package/docs/examples/tablesdb/decrement-row-column.md +18 -0
- package/docs/examples/tablesdb/delete-row.md +15 -0
- package/docs/examples/tablesdb/get-row.md +16 -0
- package/docs/examples/tablesdb/increment-row-column.md +18 -0
- package/docs/examples/tablesdb/list-rows.md +15 -0
- package/docs/examples/tablesdb/update-row.md +17 -0
- package/docs/examples/tablesdb/upsert-row.md +17 -0
- package/docs/examples/teams/create-membership.md +9 -9
- package/docs/examples/teams/create.md +5 -5
- package/docs/examples/teams/delete-membership.md +4 -4
- package/docs/examples/teams/delete.md +3 -3
- package/docs/examples/teams/get-membership.md +4 -4
- package/docs/examples/teams/get-prefs.md +3 -3
- package/docs/examples/teams/get.md +3 -3
- package/docs/examples/teams/list-memberships.md +5 -5
- package/docs/examples/teams/list.md +4 -4
- package/docs/examples/teams/update-membership-status.md +6 -6
- package/docs/examples/teams/update-membership.md +5 -5
- package/docs/examples/teams/update-name.md +4 -4
- package/docs/examples/teams/update-prefs.md +4 -4
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/enums/credit-card.ts +1 -1
- package/src/enums/execution-method.ts +1 -0
- package/src/index.ts +1 -0
- package/src/models.ts +72 -27
- package/src/query.ts +247 -4
- package/src/services/account.ts +1469 -315
- package/src/services/avatars.ts +289 -80
- package/src/services/databases.ts +345 -63
- package/src/services/functions.ts +115 -20
- package/src/services/graphql.ts +52 -4
- package/src/services/locale.ts +8 -19
- package/src/services/messaging.ts +66 -7
- package/src/services/storage.ts +345 -76
- package/src/services/tables-db.ts +621 -0
- package/src/services/teams.ts +454 -93
- package/types/enums/credit-card.d.ts +1 -1
- package/types/enums/execution-method.d.ts +2 -1
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +69 -25
- package/types/query.d.ts +201 -4
- package/types/services/account.d.ts +734 -280
- package/types/services/avatars.d.ts +168 -73
- package/types/services/databases.d.ts +199 -58
- package/types/services/functions.d.ts +62 -17
- package/types/services/graphql.d.ts +24 -2
- package/types/services/locale.d.ts +8 -19
- package/types/services/messaging.d.ts +33 -5
- package/types/services/storage.d.ts +201 -68
- package/types/services/tables-db.d.ts +245 -0
- package/types/services/teams.d.ts +242 -80
- /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
- /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/src/query.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type QueryTypesSingle = string | number | boolean;
|
|
2
|
-
export type QueryTypesList = string[] | number[] | boolean[] | Query[];
|
|
2
|
+
export type QueryTypesList = string[] | number[] | boolean[] | Query[] | any[];
|
|
3
3
|
export type QueryTypes = QueryTypesSingle | QueryTypesList;
|
|
4
4
|
type AttributesTypes = string | string[];
|
|
5
5
|
|
|
@@ -33,10 +33,10 @@ export class Query {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
static equal = (attribute: string, value: QueryTypes): string =>
|
|
36
|
+
static equal = (attribute: string, value: QueryTypes | any[]): string =>
|
|
37
37
|
new Query("equal", attribute, value).toString();
|
|
38
38
|
|
|
39
|
-
static notEqual = (attribute: string, value: QueryTypes): string =>
|
|
39
|
+
static notEqual = (attribute: string, value: QueryTypes | any[]): string =>
|
|
40
40
|
new Query("notEqual", attribute, value).toString();
|
|
41
41
|
|
|
42
42
|
static lessThan = (attribute: string, value: QueryTypes): string =>
|
|
@@ -90,12 +90,255 @@ export class Query {
|
|
|
90
90
|
static offset = (offset: number): string =>
|
|
91
91
|
new Query("offset", undefined, offset).toString();
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Filter resources where attribute contains the specified value.
|
|
95
|
+
*
|
|
96
|
+
* @param {string} attribute
|
|
97
|
+
* @param {string | string[]} value
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
static contains = (attribute: string, value: string | any[]): string =>
|
|
94
101
|
new Query("contains", attribute, value).toString();
|
|
95
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Filter resources where attribute does not contain the specified value.
|
|
105
|
+
*
|
|
106
|
+
* @param {string} attribute
|
|
107
|
+
* @param {string | string[]} value
|
|
108
|
+
* @returns {string}
|
|
109
|
+
*/
|
|
110
|
+
static notContains = (attribute: string, value: string | any[]): string =>
|
|
111
|
+
new Query("notContains", attribute, value).toString();
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Filter resources by searching attribute for value (inverse of search).
|
|
115
|
+
* A fulltext index on attribute is required for this query to work.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} attribute
|
|
118
|
+
* @param {string} value
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
121
|
+
static notSearch = (attribute: string, value: string): string =>
|
|
122
|
+
new Query("notSearch", attribute, value).toString();
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Filter resources where attribute is not between start and end (exclusive).
|
|
126
|
+
*
|
|
127
|
+
* @param {string} attribute
|
|
128
|
+
* @param {string | number} start
|
|
129
|
+
* @param {string | number} end
|
|
130
|
+
* @returns {string}
|
|
131
|
+
*/
|
|
132
|
+
static notBetween = (attribute: string, start: string | number, end: string | number): string =>
|
|
133
|
+
new Query("notBetween", attribute, [start, end] as QueryTypesList).toString();
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Filter resources where attribute does not start with value.
|
|
137
|
+
*
|
|
138
|
+
* @param {string} attribute
|
|
139
|
+
* @param {string} value
|
|
140
|
+
* @returns {string}
|
|
141
|
+
*/
|
|
142
|
+
static notStartsWith = (attribute: string, value: string): string =>
|
|
143
|
+
new Query("notStartsWith", attribute, value).toString();
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Filter resources where attribute does not end with value.
|
|
147
|
+
*
|
|
148
|
+
* @param {string} attribute
|
|
149
|
+
* @param {string} value
|
|
150
|
+
* @returns {string}
|
|
151
|
+
*/
|
|
152
|
+
static notEndsWith = (attribute: string, value: string): string =>
|
|
153
|
+
new Query("notEndsWith", attribute, value).toString();
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Filter resources where document was created before date.
|
|
157
|
+
*
|
|
158
|
+
* @param {string} value
|
|
159
|
+
* @returns {string}
|
|
160
|
+
*/
|
|
161
|
+
static createdBefore = (value: string): string =>
|
|
162
|
+
new Query("createdBefore", undefined, value).toString();
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Filter resources where document was created after date.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} value
|
|
168
|
+
* @returns {string}
|
|
169
|
+
*/
|
|
170
|
+
static createdAfter = (value: string): string =>
|
|
171
|
+
new Query("createdAfter", undefined, value).toString();
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Filter resources where document was created between dates.
|
|
175
|
+
*
|
|
176
|
+
* @param {string} start
|
|
177
|
+
* @param {string} end
|
|
178
|
+
* @returns {string}
|
|
179
|
+
*/
|
|
180
|
+
static createdBetween = (start: string, end: string): string =>
|
|
181
|
+
new Query("createdBetween", undefined, [start, end] as QueryTypesList).toString();
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Filter resources where document was updated before date.
|
|
185
|
+
*
|
|
186
|
+
* @param {string} value
|
|
187
|
+
* @returns {string}
|
|
188
|
+
*/
|
|
189
|
+
static updatedBefore = (value: string): string =>
|
|
190
|
+
new Query("updatedBefore", undefined, value).toString();
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Filter resources where document was updated after date.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} value
|
|
196
|
+
* @returns {string}
|
|
197
|
+
*/
|
|
198
|
+
static updatedAfter = (value: string): string =>
|
|
199
|
+
new Query("updatedAfter", undefined, value).toString();
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Filter resources where document was updated between dates.
|
|
203
|
+
*
|
|
204
|
+
* @param {string} start
|
|
205
|
+
* @param {string} end
|
|
206
|
+
* @returns {string}
|
|
207
|
+
*/
|
|
208
|
+
static updatedBetween = (start: string, end: string): string =>
|
|
209
|
+
new Query("updatedBetween", undefined, [start, end] as QueryTypesList).toString();
|
|
210
|
+
|
|
96
211
|
static or = (queries: string[]) =>
|
|
97
212
|
new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
98
213
|
|
|
99
214
|
static and = (queries: string[]) =>
|
|
100
215
|
new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Filter resources where attribute is at a specific distance from the given coordinates.
|
|
219
|
+
*
|
|
220
|
+
* @param {string} attribute
|
|
221
|
+
* @param {any[]} values
|
|
222
|
+
* @param {number} distance
|
|
223
|
+
* @param {boolean} meters
|
|
224
|
+
* @returns {string}
|
|
225
|
+
*/
|
|
226
|
+
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
|
|
227
|
+
new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString();
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Filter resources where attribute is not at a specific distance from the given coordinates.
|
|
231
|
+
*
|
|
232
|
+
* @param {string} attribute
|
|
233
|
+
* @param {any[]} values
|
|
234
|
+
* @param {number} distance
|
|
235
|
+
* @param {boolean} meters
|
|
236
|
+
* @returns {string}
|
|
237
|
+
*/
|
|
238
|
+
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
|
|
239
|
+
new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString();
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
|
|
243
|
+
*
|
|
244
|
+
* @param {string} attribute
|
|
245
|
+
* @param {any[]} values
|
|
246
|
+
* @param {number} distance
|
|
247
|
+
* @param {boolean} meters
|
|
248
|
+
* @returns {string}
|
|
249
|
+
*/
|
|
250
|
+
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
|
|
251
|
+
new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString();
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
|
|
255
|
+
*
|
|
256
|
+
* @param {string} attribute
|
|
257
|
+
* @param {any[]} values
|
|
258
|
+
* @param {number} distance
|
|
259
|
+
* @param {boolean} meters
|
|
260
|
+
* @returns {string}
|
|
261
|
+
*/
|
|
262
|
+
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
|
|
263
|
+
new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString();
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Filter resources where attribute intersects with the given geometry.
|
|
267
|
+
*
|
|
268
|
+
* @param {string} attribute
|
|
269
|
+
* @param {any[]} values
|
|
270
|
+
* @returns {string}
|
|
271
|
+
*/
|
|
272
|
+
static intersects = (attribute: string, values: any[]): string =>
|
|
273
|
+
new Query("intersects", attribute, [values]).toString();
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Filter resources where attribute does not intersect with the given geometry.
|
|
277
|
+
*
|
|
278
|
+
* @param {string} attribute
|
|
279
|
+
* @param {any[]} values
|
|
280
|
+
* @returns {string}
|
|
281
|
+
*/
|
|
282
|
+
static notIntersects = (attribute: string, values: any[]): string =>
|
|
283
|
+
new Query("notIntersects", attribute, [values]).toString();
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Filter resources where attribute crosses the given geometry.
|
|
287
|
+
*
|
|
288
|
+
* @param {string} attribute
|
|
289
|
+
* @param {any[]} values
|
|
290
|
+
* @returns {string}
|
|
291
|
+
*/
|
|
292
|
+
static crosses = (attribute: string, values: any[]): string =>
|
|
293
|
+
new Query("crosses", attribute, [values]).toString();
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Filter resources where attribute does not cross the given geometry.
|
|
297
|
+
*
|
|
298
|
+
* @param {string} attribute
|
|
299
|
+
* @param {any[]} values
|
|
300
|
+
* @returns {string}
|
|
301
|
+
*/
|
|
302
|
+
static notCrosses = (attribute: string, values: any[]): string =>
|
|
303
|
+
new Query("notCrosses", attribute, [values]).toString();
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Filter resources where attribute overlaps with the given geometry.
|
|
307
|
+
*
|
|
308
|
+
* @param {string} attribute
|
|
309
|
+
* @param {any[]} values
|
|
310
|
+
* @returns {string}
|
|
311
|
+
*/
|
|
312
|
+
static overlaps = (attribute: string, values: any[]): string =>
|
|
313
|
+
new Query("overlaps", attribute, [values]).toString();
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Filter resources where attribute does not overlap with the given geometry.
|
|
317
|
+
*
|
|
318
|
+
* @param {string} attribute
|
|
319
|
+
* @param {any[]} values
|
|
320
|
+
* @returns {string}
|
|
321
|
+
*/
|
|
322
|
+
static notOverlaps = (attribute: string, values: any[]): string =>
|
|
323
|
+
new Query("notOverlaps", attribute, [values]).toString();
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Filter resources where attribute touches the given geometry.
|
|
327
|
+
*
|
|
328
|
+
* @param {string} attribute
|
|
329
|
+
* @param {any[]} values
|
|
330
|
+
* @returns {string}
|
|
331
|
+
*/
|
|
332
|
+
static touches = (attribute: string, values: any[]): string =>
|
|
333
|
+
new Query("touches", attribute, [values]).toString();
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Filter resources where attribute does not touch the given geometry.
|
|
337
|
+
*
|
|
338
|
+
* @param {string} attribute
|
|
339
|
+
* @param {any[]} values
|
|
340
|
+
* @returns {string}
|
|
341
|
+
*/
|
|
342
|
+
static notTouches = (attribute: string, values: any[]): string =>
|
|
343
|
+
new Query("notTouches", attribute, [values]).toString();
|
|
101
344
|
}
|