react-native-appwrite 0.2.2 → 0.3.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.
Files changed (157) hide show
  1. package/.github/workflows/publish.yml +13 -4
  2. package/CHANGELOG.md +1 -1
  3. package/LICENSE +1 -1
  4. package/README.md +22 -9
  5. package/dist/cjs/sdk.js +1193 -269
  6. package/dist/cjs/sdk.js.map +1 -1
  7. package/dist/esm/sdk.js +1193 -270
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +6 -13
  10. package/docs/examples/account/create-email-password-session.md +14 -0
  11. package/docs/examples/account/create-email-token.md +15 -0
  12. package/docs/examples/account/create-j-w-t.md +6 -13
  13. package/docs/examples/account/create-magic-u-r-l-token.md +16 -0
  14. package/docs/examples/account/create-mfa-authenticator.md +13 -0
  15. package/docs/examples/account/create-mfa-challenge.md +13 -0
  16. package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
  17. package/docs/examples/account/create-o-auth2session.md +10 -9
  18. package/docs/examples/account/create-o-auth2token.md +15 -0
  19. package/docs/examples/account/create-phone-token.md +14 -0
  20. package/docs/examples/account/create-phone-verification.md +6 -13
  21. package/docs/examples/account/create-push-target.md +15 -0
  22. package/docs/examples/account/create-recovery.md +9 -13
  23. package/docs/examples/account/create-session.md +14 -0
  24. package/docs/examples/account/create-verification.md +8 -13
  25. package/docs/examples/account/create.md +11 -13
  26. package/docs/examples/account/delete-identity.md +8 -13
  27. package/docs/examples/account/delete-mfa-authenticator.md +14 -0
  28. package/docs/examples/account/delete-push-target.md +13 -0
  29. package/docs/examples/account/delete-session.md +8 -13
  30. package/docs/examples/account/delete-sessions.md +6 -13
  31. package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
  32. package/docs/examples/account/get-prefs.md +6 -13
  33. package/docs/examples/account/get-session.md +8 -13
  34. package/docs/examples/account/get.md +6 -13
  35. package/docs/examples/account/list-identities.md +8 -13
  36. package/docs/examples/account/list-logs.md +8 -13
  37. package/docs/examples/account/list-mfa-factors.md +11 -0
  38. package/docs/examples/account/list-sessions.md +6 -13
  39. package/docs/examples/account/update-email.md +9 -13
  40. package/docs/examples/account/update-m-f-a.md +13 -0
  41. package/docs/examples/account/update-magic-u-r-l-session.md +9 -13
  42. package/docs/examples/account/update-mfa-authenticator.md +14 -0
  43. package/docs/examples/account/update-mfa-challenge.md +14 -0
  44. package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
  45. package/docs/examples/account/update-name.md +8 -13
  46. package/docs/examples/account/update-password.md +9 -13
  47. package/docs/examples/account/update-phone-session.md +9 -13
  48. package/docs/examples/account/update-phone-verification.md +9 -13
  49. package/docs/examples/account/update-phone.md +9 -13
  50. package/docs/examples/account/update-prefs.md +8 -13
  51. package/docs/examples/account/update-push-target.md +14 -0
  52. package/docs/examples/account/update-recovery.md +10 -13
  53. package/docs/examples/account/update-session.md +8 -13
  54. package/docs/examples/account/update-status.md +6 -13
  55. package/docs/examples/account/update-verification.md +9 -13
  56. package/docs/examples/avatars/get-browser.md +11 -9
  57. package/docs/examples/avatars/get-credit-card.md +11 -9
  58. package/docs/examples/avatars/get-favicon.md +8 -9
  59. package/docs/examples/avatars/get-flag.md +11 -9
  60. package/docs/examples/avatars/get-image.md +10 -9
  61. package/docs/examples/avatars/get-initials.md +11 -9
  62. package/docs/examples/avatars/get-q-r.md +11 -9
  63. package/docs/examples/databases/create-document.md +12 -13
  64. package/docs/examples/databases/delete-document.md +10 -13
  65. package/docs/examples/databases/get-document.md +11 -13
  66. package/docs/examples/databases/list-documents.md +10 -13
  67. package/docs/examples/databases/update-document.md +12 -13
  68. package/docs/examples/functions/create-execution.md +13 -13
  69. package/docs/examples/functions/get-execution.md +9 -13
  70. package/docs/examples/functions/list-executions.md +10 -13
  71. package/docs/examples/graphql/mutation.md +8 -13
  72. package/docs/examples/graphql/query.md +8 -13
  73. package/docs/examples/locale/get.md +6 -13
  74. package/docs/examples/locale/list-codes.md +6 -13
  75. package/docs/examples/locale/list-continents.md +6 -13
  76. package/docs/examples/locale/list-countries-e-u.md +6 -13
  77. package/docs/examples/locale/list-countries-phones.md +6 -13
  78. package/docs/examples/locale/list-countries.md +6 -13
  79. package/docs/examples/locale/list-currencies.md +6 -13
  80. package/docs/examples/locale/list-languages.md +6 -13
  81. package/docs/examples/messaging/create-subscriber.md +15 -0
  82. package/docs/examples/messaging/delete-subscriber.md +14 -0
  83. package/docs/examples/storage/create-file.md +11 -13
  84. package/docs/examples/storage/delete-file.md +9 -13
  85. package/docs/examples/storage/get-file-download.md +9 -9
  86. package/docs/examples/storage/get-file-preview.md +20 -9
  87. package/docs/examples/storage/get-file-view.md +9 -9
  88. package/docs/examples/storage/get-file.md +9 -13
  89. package/docs/examples/storage/list-files.md +10 -13
  90. package/docs/examples/storage/update-file.md +11 -13
  91. package/docs/examples/teams/create-membership.md +14 -13
  92. package/docs/examples/teams/create.md +10 -13
  93. package/docs/examples/teams/delete-membership.md +9 -13
  94. package/docs/examples/teams/delete.md +8 -13
  95. package/docs/examples/teams/get-membership.md +9 -13
  96. package/docs/examples/teams/get-prefs.md +8 -13
  97. package/docs/examples/teams/get.md +8 -13
  98. package/docs/examples/teams/list-memberships.md +10 -13
  99. package/docs/examples/teams/list.md +9 -13
  100. package/docs/examples/teams/update-membership-status.md +11 -13
  101. package/docs/examples/teams/update-membership.md +10 -13
  102. package/docs/examples/teams/update-name.md +9 -13
  103. package/docs/examples/teams/update-prefs.md +9 -13
  104. package/package.json +1 -1
  105. package/src/client.ts +37 -11
  106. package/src/enums/authentication-factor.ts +6 -0
  107. package/src/enums/authenticator-type.ts +3 -0
  108. package/src/enums/browser.ts +16 -0
  109. package/src/enums/credit-card.ts +18 -0
  110. package/src/enums/execution-method.ts +8 -0
  111. package/src/enums/flag.ts +197 -0
  112. package/src/enums/image-format.ts +7 -0
  113. package/src/enums/image-gravity.ts +11 -0
  114. package/src/enums/o-auth-provider.ts +41 -0
  115. package/src/id.ts +23 -4
  116. package/src/index.ts +13 -2
  117. package/src/models.ts +174 -0
  118. package/src/query.ts +61 -34
  119. package/src/service.ts +4 -7
  120. package/src/services/account.ts +643 -119
  121. package/src/services/avatars.ts +12 -6
  122. package/src/services/databases.ts +7 -4
  123. package/src/services/functions.ts +6 -2
  124. package/src/services/graphql.ts +3 -0
  125. package/src/services/locale.ts +3 -0
  126. package/src/services/messaging.ts +84 -0
  127. package/src/services/storage.ts +12 -6
  128. package/src/services/teams.ts +3 -0
  129. package/types/client.d.ts +133 -0
  130. package/types/enums/authentication-factor.d.ts +6 -0
  131. package/types/enums/authenticator-type.d.ts +3 -0
  132. package/types/enums/browser.d.ts +16 -0
  133. package/types/enums/credit-card.d.ts +18 -0
  134. package/types/enums/execution-method.d.ts +8 -0
  135. package/types/enums/flag.d.ts +197 -0
  136. package/types/enums/image-format.d.ts +7 -0
  137. package/types/enums/image-gravity.d.ts +11 -0
  138. package/types/enums/o-auth-provider.d.ts +41 -0
  139. package/types/id.d.ts +5 -0
  140. package/types/index.d.ts +25 -0
  141. package/types/models.d.ts +1195 -0
  142. package/types/permission.d.ts +7 -0
  143. package/types/query.d.ts +34 -0
  144. package/types/role.d.ts +70 -0
  145. package/types/service.d.ts +8 -0
  146. package/types/services/account.d.ts +676 -0
  147. package/types/services/avatars.d.ts +149 -0
  148. package/types/services/databases.d.ts +77 -0
  149. package/types/services/functions.d.ts +49 -0
  150. package/types/services/graphql.d.ts +25 -0
  151. package/types/services/locale.d.ts +91 -0
  152. package/types/services/messaging.d.ts +29 -0
  153. package/types/services/storage.d.ts +147 -0
  154. package/types/services/teams.d.ts +197 -0
  155. package/docs/examples/account/create-email-session.md +0 -18
  156. package/docs/examples/account/create-magic-u-r-l-session.md +0 -18
  157. package/docs/examples/account/create-phone-session.md +0 -18
@@ -2,6 +2,12 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
8
+ import { Browser } from '../enums/browser';
9
+ import { CreditCard } from '../enums/credit-card';
10
+ import { Flag } from '../enums/flag';
5
11
 
6
12
  export class Avatars extends Service {
7
13
 
@@ -24,14 +30,14 @@ export class Avatars extends Service {
24
30
  * image at source quality. If dimensions are not specified, the default size
25
31
  * of image returned is 100x100px.
26
32
  *
27
- * @param {string} code
33
+ * @param {Browser} code
28
34
  * @param {number} width
29
35
  * @param {number} height
30
36
  * @param {number} quality
31
37
  * @throws {AppwriteException}
32
38
  * @returns {URL}
33
39
  */
34
- getBrowser(code: string, width?: number, height?: number, quality?: number): URL {
40
+ getBrowser(code: Browser, width?: number, height?: number, quality?: number): URL {
35
41
  if (typeof code === 'undefined') {
36
42
  throw new AppwriteException('Missing required parameter: "code"');
37
43
  }
@@ -74,14 +80,14 @@ export class Avatars extends Service {
74
80
  * of image returned is 100x100px.
75
81
  *
76
82
  *
77
- * @param {string} code
83
+ * @param {CreditCard} code
78
84
  * @param {number} width
79
85
  * @param {number} height
80
86
  * @param {number} quality
81
87
  * @throws {AppwriteException}
82
88
  * @returns {URL}
83
89
  */
84
- getCreditCard(code: string, width?: number, height?: number, quality?: number): URL {
90
+ getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): URL {
85
91
  if (typeof code === 'undefined') {
86
92
  throw new AppwriteException('Missing required parameter: "code"');
87
93
  }
@@ -158,14 +164,14 @@ export class Avatars extends Service {
158
164
  * of image returned is 100x100px.
159
165
  *
160
166
  *
161
- * @param {string} code
167
+ * @param {Flag} code
162
168
  * @param {number} width
163
169
  * @param {number} height
164
170
  * @param {number} quality
165
171
  * @throws {AppwriteException}
166
172
  * @returns {URL}
167
173
  */
168
- getFlag(code: string, width?: number, height?: number, quality?: number): URL {
174
+ getFlag(code: Flag, width?: number, height?: number, quality?: number): URL {
169
175
  if (typeof code === 'undefined') {
170
176
  throw new AppwriteException('Missing required parameter: "code"');
171
177
  }
@@ -2,6 +2,9 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
5
8
 
6
9
  export class Databases extends Service {
7
10
 
@@ -55,12 +58,12 @@ export class Databases extends Service {
55
58
  * @param {string} databaseId
56
59
  * @param {string} collectionId
57
60
  * @param {string} documentId
58
- * @param {Omit<Document, keyof Models.Document>} data
61
+ * @param {object} data
59
62
  * @param {string[]} permissions
60
63
  * @throws {AppwriteException}
61
64
  * @returns {Promise}
62
65
  */
63
- async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
66
+ async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document> {
64
67
  if (typeof databaseId === 'undefined') {
65
68
  throw new AppwriteException('Missing required parameter: "databaseId"');
66
69
  }
@@ -146,12 +149,12 @@ export class Databases extends Service {
146
149
  * @param {string} databaseId
147
150
  * @param {string} collectionId
148
151
  * @param {string} documentId
149
- * @param {Partial<Omit<Document, keyof Models.Document>>} data
152
+ * @param {object} data
150
153
  * @param {string[]} permissions
151
154
  * @throws {AppwriteException}
152
155
  * @returns {Promise}
153
156
  */
154
- async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
157
+ async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: object, permissions?: string[]): Promise<Document> {
155
158
  if (typeof databaseId === 'undefined') {
156
159
  throw new AppwriteException('Missing required parameter: "databaseId"');
157
160
  }
@@ -2,6 +2,10 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
8
+ import { ExecutionMethod } from '../enums/execution-method';
5
9
 
6
10
  export class Functions extends Service {
7
11
 
@@ -56,12 +60,12 @@ export class Functions extends Service {
56
60
  * @param {string} body
57
61
  * @param {boolean} async
58
62
  * @param {string} xpath
59
- * @param {string} method
63
+ * @param {ExecutionMethod} method
60
64
  * @param {object} headers
61
65
  * @throws {AppwriteException}
62
66
  * @returns {Promise}
63
67
  */
64
- async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: string, headers?: object): Promise<Models.Execution> {
68
+ async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): Promise<Models.Execution> {
65
69
  if (typeof functionId === 'undefined') {
66
70
  throw new AppwriteException('Missing required parameter: "functionId"');
67
71
  }
@@ -2,6 +2,9 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
5
8
 
6
9
  export class Graphql extends Service {
7
10
 
@@ -2,6 +2,9 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
5
8
 
6
9
  export class Locale extends Service {
7
10
 
@@ -0,0 +1,84 @@
1
+ import { Service } from '../service';
2
+ import { AppwriteException, Client } from '../client';
3
+ import type { Models } from '../models';
4
+ import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
8
+
9
+ export class Messaging extends Service {
10
+
11
+ constructor(client: Client)
12
+ {
13
+ super(client);
14
+ }
15
+
16
+ /**
17
+ * Create subscriber
18
+ *
19
+ * Create a new subscriber.
20
+ *
21
+ * @param {string} topicId
22
+ * @param {string} subscriberId
23
+ * @param {string} targetId
24
+ * @throws {AppwriteException}
25
+ * @returns {Promise}
26
+ */
27
+ async createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber> {
28
+ if (typeof topicId === 'undefined') {
29
+ throw new AppwriteException('Missing required parameter: "topicId"');
30
+ }
31
+
32
+ if (typeof subscriberId === 'undefined') {
33
+ throw new AppwriteException('Missing required parameter: "subscriberId"');
34
+ }
35
+
36
+ if (typeof targetId === 'undefined') {
37
+ throw new AppwriteException('Missing required parameter: "targetId"');
38
+ }
39
+
40
+ const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId);
41
+ const payload: Payload = {};
42
+
43
+ if (typeof subscriberId !== 'undefined') {
44
+ payload['subscriberId'] = subscriberId;
45
+ }
46
+
47
+ if (typeof targetId !== 'undefined') {
48
+ payload['targetId'] = targetId;
49
+ }
50
+
51
+ const uri = new URL(this.client.config.endpoint + apiPath);
52
+ return await this.client.call('post', uri, {
53
+ 'content-type': 'application/json',
54
+ }, payload);
55
+ }
56
+
57
+ /**
58
+ * Delete subscriber
59
+ *
60
+ * Delete a subscriber by its unique ID.
61
+ *
62
+ * @param {string} topicId
63
+ * @param {string} subscriberId
64
+ * @throws {AppwriteException}
65
+ * @returns {Promise}
66
+ */
67
+ async deleteSubscriber(topicId: string, subscriberId: string): Promise<{}> {
68
+ if (typeof topicId === 'undefined') {
69
+ throw new AppwriteException('Missing required parameter: "topicId"');
70
+ }
71
+
72
+ if (typeof subscriberId === 'undefined') {
73
+ throw new AppwriteException('Missing required parameter: "subscriberId"');
74
+ }
75
+
76
+ const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId);
77
+ const payload: Payload = {};
78
+
79
+ const uri = new URL(this.client.config.endpoint + apiPath);
80
+ return await this.client.call('delete', uri, {
81
+ 'content-type': 'application/json',
82
+ }, payload);
83
+ }
84
+ };
@@ -5,6 +5,9 @@ import type { UploadProgress, Payload } from '../client';
5
5
  import * as FileSystem from 'expo-file-system';
6
6
  import { Platform } from 'react-native';
7
7
 
8
+ import { ImageGravity } from '../enums/image-gravity';
9
+ import { ImageFormat } from '../enums/image-format';
10
+
8
11
  export class Storage extends Service {
9
12
 
10
13
  constructor(client: Client)
@@ -127,6 +130,7 @@ export class Storage extends Service {
127
130
  }
128
131
  }
129
132
 
133
+ let timestamp = new Date().getTime();
130
134
  while (offset < size) {
131
135
  let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
132
136
 
@@ -141,11 +145,13 @@ export class Storage extends Service {
141
145
  length: Service.CHUNK_SIZE
142
146
  });
143
147
  var path = `data:${file.type};base64,${chunk}`;
144
- if (Platform.OS.toLowerCase() == 'android') {
145
- path = FileSystem.cacheDirectory + '/tmp_chunk';
148
+ if (Platform.OS.toLowerCase() === 'android') {
149
+ path = FileSystem.cacheDirectory + '/tmp_chunk_' + timestamp;
146
150
  await FileSystem.writeAsStringAsync(path, chunk, {encoding: FileSystem.EncodingType.Base64});
147
151
  }
148
- payload['file'] = {uri: path, name: file.name, type: file.type};
152
+
153
+ payload['file'] = { uri: path, name: file.name, type: file.type };
154
+
149
155
  response = await this.client.call('post', uri, apiHeaders, payload);
150
156
 
151
157
  if (onProgress) {
@@ -306,7 +312,7 @@ export class Storage extends Service {
306
312
  * @param {string} fileId
307
313
  * @param {number} width
308
314
  * @param {number} height
309
- * @param {string} gravity
315
+ * @param {ImageGravity} gravity
310
316
  * @param {number} quality
311
317
  * @param {number} borderWidth
312
318
  * @param {string} borderColor
@@ -314,11 +320,11 @@ export class Storage extends Service {
314
320
  * @param {number} opacity
315
321
  * @param {number} rotation
316
322
  * @param {string} background
317
- * @param {string} output
323
+ * @param {ImageFormat} output
318
324
  * @throws {AppwriteException}
319
325
  * @returns {URL}
320
326
  */
321
- getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: string, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: string): URL {
327
+ getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): URL {
322
328
  if (typeof bucketId === 'undefined') {
323
329
  throw new AppwriteException('Missing required parameter: "bucketId"');
324
330
  }
@@ -2,6 +2,9 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
+ import * as FileSystem from 'expo-file-system';
6
+ import { Platform } from 'react-native';
7
+
5
8
 
6
9
  export class Teams extends Service {
7
10
 
@@ -0,0 +1,133 @@
1
+ import { Models } from './models';
2
+ declare type Payload = {
3
+ [key: string]: any;
4
+ };
5
+ declare type Headers = {
6
+ [key: string]: string;
7
+ };
8
+ export declare type RealtimeResponseEvent<T extends unknown> = {
9
+ events: string[];
10
+ channels: string[];
11
+ timestamp: number;
12
+ payload: T;
13
+ };
14
+ export declare type UploadProgress = {
15
+ $id: string;
16
+ progress: number;
17
+ sizeUploaded: number;
18
+ chunksTotal: number;
19
+ chunksUploaded: number;
20
+ };
21
+ declare class AppwriteException extends Error {
22
+ code: number;
23
+ response: string;
24
+ type: string;
25
+ constructor(message: string, code?: number, type?: string, response?: string);
26
+ }
27
+ declare class Client {
28
+ config: {
29
+ endpoint: string;
30
+ endpointRealtime: string;
31
+ project: string;
32
+ jwt: string;
33
+ locale: string;
34
+ session: string;
35
+ platform: string;
36
+ };
37
+ headers: Headers;
38
+ /**
39
+ * Set Endpoint
40
+ *
41
+ * Your project endpoint
42
+ *
43
+ * @param {string} endpoint
44
+ *
45
+ * @returns {this}
46
+ */
47
+ setEndpoint(endpoint: string): this;
48
+ /**
49
+ * Set Realtime Endpoint
50
+ *
51
+ * @param {string} endpointRealtime
52
+ *
53
+ * @returns {this}
54
+ */
55
+ setEndpointRealtime(endpointRealtime: string): this;
56
+ /**
57
+ * Set platform
58
+ *
59
+ * Set platform. Will be used as origin for all requests.
60
+ *
61
+ * @param {string} platform
62
+ * @returns {this}
63
+ */
64
+ setPlatform(platform: string): this;
65
+ /**
66
+ * Set Project
67
+ *
68
+ * Your project ID
69
+ *
70
+ * @param value string
71
+ *
72
+ * @return {this}
73
+ */
74
+ setProject(value: string): this;
75
+ /**
76
+ * Set JWT
77
+ *
78
+ * Your secret JSON Web Token
79
+ *
80
+ * @param value string
81
+ *
82
+ * @return {this}
83
+ */
84
+ setJWT(value: string): this;
85
+ /**
86
+ * Set Locale
87
+ *
88
+ * @param value string
89
+ *
90
+ * @return {this}
91
+ */
92
+ setLocale(value: string): this;
93
+ /**
94
+ * Set Session
95
+ *
96
+ * The user session to authenticate with
97
+ *
98
+ * @param value string
99
+ *
100
+ * @return {this}
101
+ */
102
+ setSession(value: string): this;
103
+ private realtime;
104
+ /**
105
+ * Subscribes to Appwrite events and passes you the payload in realtime.
106
+ *
107
+ * @param {string|string[]} channels
108
+ * Channel to subscribe - pass a single channel as a string or multiple with an array of strings.
109
+ *
110
+ * Possible channels are:
111
+ * - account
112
+ * - collections
113
+ * - collections.[ID]
114
+ * - collections.[ID].documents
115
+ * - documents
116
+ * - documents.[ID]
117
+ * - files
118
+ * - files.[ID]
119
+ * - executions
120
+ * - executions.[ID]
121
+ * - functions.[ID]
122
+ * - teams
123
+ * - teams.[ID]
124
+ * - memberships
125
+ * - memberships.[ID]
126
+ * @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update.
127
+ * @returns {() => void} Unsubscribes from events.
128
+ */
129
+ subscribe<T extends unknown>(channels: string | string[], callback: (payload: RealtimeResponseEvent<T>) => void): () => void;
130
+ call(method: string, url: URL, headers?: Headers, params?: Payload): Promise<any>;
131
+ }
132
+ export { Client, AppwriteException };
133
+ export type { Models, Payload };
@@ -0,0 +1,6 @@
1
+ export declare enum AuthenticationFactor {
2
+ Email = "email",
3
+ Phone = "phone",
4
+ Totp = "totp",
5
+ Recoverycode = "recoverycode"
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare enum AuthenticatorType {
2
+ Totp = "totp"
3
+ }
@@ -0,0 +1,16 @@
1
+ export declare enum Browser {
2
+ AvantBrowser = "aa",
3
+ AndroidWebViewBeta = "an",
4
+ GoogleChrome = "ch",
5
+ GoogleChromeIOS = "ci",
6
+ GoogleChromeMobile = "cm",
7
+ Chromium = "cr",
8
+ MozillaFirefox = "ff",
9
+ Safari = "sf",
10
+ MobileSafari = "mf",
11
+ MicrosoftEdge = "ps",
12
+ MicrosoftEdgeIOS = "oi",
13
+ OperaMini = "om",
14
+ Opera = "op",
15
+ OperaNext = "on"
16
+ }
@@ -0,0 +1,18 @@
1
+ export declare enum CreditCard {
2
+ AmericanExpress = "amex",
3
+ Argencard = "argencard",
4
+ Cabal = "cabal",
5
+ Consosud = "censosud",
6
+ DinersClub = "diners",
7
+ Discover = "discover",
8
+ Elo = "elo",
9
+ Hipercard = "hipercard",
10
+ JCB = "jcb",
11
+ Mastercard = "mastercard",
12
+ Naranja = "naranja",
13
+ TarjetaShopping = "targeta-shopping",
14
+ UnionChinaPay = "union-china-pay",
15
+ Visa = "visa",
16
+ MIR = "mir",
17
+ Maestro = "maestro"
18
+ }
@@ -0,0 +1,8 @@
1
+ export declare enum ExecutionMethod {
2
+ GET = "GET",
3
+ POST = "POST",
4
+ PUT = "PUT",
5
+ PATCH = "PATCH",
6
+ DELETE = "DELETE",
7
+ OPTIONS = "OPTIONS"
8
+ }