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.
Files changed (129) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1854 -1121
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1854 -1122
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +7 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +13 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +23 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/enums/credit-card.ts +1 -1
  99. package/src/enums/execution-method.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/src/models.ts +72 -27
  102. package/src/query.ts +247 -4
  103. package/src/services/account.ts +1469 -315
  104. package/src/services/avatars.ts +289 -80
  105. package/src/services/databases.ts +345 -63
  106. package/src/services/functions.ts +115 -20
  107. package/src/services/graphql.ts +52 -4
  108. package/src/services/locale.ts +8 -19
  109. package/src/services/messaging.ts +66 -7
  110. package/src/services/storage.ts +345 -76
  111. package/src/services/tables-db.ts +621 -0
  112. package/src/services/teams.ts +454 -93
  113. package/types/enums/credit-card.d.ts +1 -1
  114. package/types/enums/execution-method.d.ts +2 -1
  115. package/types/index.d.ts +1 -0
  116. package/types/models.d.ts +69 -25
  117. package/types/query.d.ts +201 -4
  118. package/types/services/account.d.ts +734 -280
  119. package/types/services/avatars.d.ts +168 -73
  120. package/types/services/databases.d.ts +199 -58
  121. package/types/services/functions.d.ts +62 -17
  122. package/types/services/graphql.d.ts +24 -2
  123. package/types/services/locale.d.ts +8 -19
  124. package/types/services/messaging.d.ts +33 -5
  125. package/types/services/storage.d.ts +201 -68
  126. package/types/services/tables-db.d.ts +245 -0
  127. package/types/services/teams.d.ts +242 -80
  128. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  129. /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
- static contains = (attribute: string, value: string | string[]): string =>
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
  }