@appconda/sdk 1.0.192 → 1.0.194

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 (3) hide show
  1. package/index.d.ts +497 -346
  2. package/index.js +73 -5
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -8,110 +8,42 @@
8
8
  * [previous releases](https://github.com/appconda/sdk-for-web/releases).
9
9
  */
10
10
 
11
- /**
12
- * Payload type representing a key-value pair with string keys and any values.
13
- */
11
+ import 'isomorphic-form-data';
14
12
  type Payload = {
15
13
  [key: string]: any;
16
14
  };
17
- /**
18
- * Headers type representing a key-value pair with string keys and string values.
19
- */
20
- type Headers = {
15
+ export type Headers = {
21
16
  [key: string]: string;
22
17
  };
23
- /**
24
- * Realtime event response structure with generic payload type.
25
- */
26
- type RealtimeResponseEvent<T extends unknown> = {
27
- /**
28
- * List of event names associated with the response.
29
- */
18
+ export type RealtimeResponseEvent<T extends unknown> = {
30
19
  events: string[];
31
- /**
32
- * List of channel names associated with the response.
33
- */
34
20
  channels: string[];
35
- /**
36
- * Timestamp indicating the time of the event.
37
- */
38
21
  timestamp: number;
39
- /**
40
- * Payload containing event-specific data.
41
- */
42
22
  payload: T;
43
23
  };
44
- /**
45
- * Type representing upload progress information.
46
- */
47
- type UploadProgress = {
48
- /**
49
- * Identifier for the upload progress.
50
- */
24
+ export type UploadProgress = {
51
25
  $id: string;
52
- /**
53
- * Current progress of the upload (in percentage).
54
- */
55
26
  progress: number;
56
- /**
57
- * Total size uploaded (in bytes) during the upload process.
58
- */
59
27
  sizeUploaded: number;
60
- /**
61
- * Total number of chunks that need to be uploaded.
62
- */
63
28
  chunksTotal: number;
64
- /**
65
- * Number of chunks that have been successfully uploaded.
66
- */
67
29
  chunksUploaded: number;
68
30
  };
69
- /**
70
- * Exception thrown by the package
71
- */
72
- class AppcondaException extends Error {
73
- /**
74
- * The error code associated with the exception.
75
- */
31
+ export class AppcondaException extends Error {
76
32
  code: number;
77
- /**
78
- * The response string associated with the exception.
79
- */
80
33
  response: string;
81
- /**
82
- * Error type.
83
- * See [Error Types](https://appconda.io/docs/response-codes#errorTypes) for more information.
84
- */
85
34
  type: string;
86
- /**
87
- * Initializes a Appconda Exception.
88
- *
89
- * @param {string} message - The error message.
90
- * @param {number} code - The error code. Default is 0.
91
- * @param {string} type - The error type. Default is an empty string.
92
- * @param {string} response - The response string. Default is an empty string.
93
- */
94
35
  constructor(message: string, code?: number, type?: string, response?: string);
95
36
  }
96
- /**
97
- * Client that handles requests to Appconda
98
- */
99
37
  class Client {
100
- static CHUNK_SIZE: number;
101
- /**
102
- * Holds configuration such as project.
103
- */
104
38
  config: {
105
39
  endpoint: string;
106
40
  endpointRealtime: string;
107
41
  project: string;
42
+ key: string;
108
43
  jwt: string;
109
44
  locale: string;
110
- session: string;
45
+ mode: string;
111
46
  };
112
- /**
113
- * Custom headers for API requests.
114
- */
115
47
  headers: Headers;
116
48
  /**
117
49
  * Set Endpoint
@@ -141,6 +73,16 @@ class Client {
141
73
  * @return {this}
142
74
  */
143
75
  setProject(value: string): this;
76
+ /**
77
+ * Set Key
78
+ *
79
+ * Your secret API key
80
+ *
81
+ * @param value string
82
+ *
83
+ * @return {this}
84
+ */
85
+ setKey(value: string): this;
144
86
  /**
145
87
  * Set JWT
146
88
  *
@@ -160,17 +102,15 @@ class Client {
160
102
  */
161
103
  setLocale(value: string): this;
162
104
  /**
163
- * Set Session
164
- *
165
- * The user session to authenticate with
105
+ * Set Mode
166
106
  *
167
107
  * @param value string
168
108
  *
169
109
  * @return {this}
170
110
  */
171
- setSession(value: string): this;
111
+ setMode(value: string): this;
172
112
  /**
173
- * Subscribes to Appconda events and passes you the payload in realtime.
113
+ * Subscribes to Realmocean events and passes you the payload in realtime.
174
114
  *
175
115
  * @param {string|string[]} channels
176
116
  * Channel to subscribe - pass a single channel as a string or multiple with an array of strings.
@@ -195,20 +135,12 @@ class Client {
195
135
  * @returns {() => void} Unsubscribes from events.
196
136
  */
197
137
  subscribe<T extends unknown>(channels: string | string[], callback: (payload: RealtimeResponseEvent<T>) => void): () => void;
198
- prepareRequest(method: string, url: URL, headers?: Headers, params?: Payload): {
199
- uri: string;
200
- options: RequestInit;
201
- };
202
- chunkedUpload(method: string, url: URL, headers: Headers, originalPayload: Payload, onProgress: (progress: UploadProgress) => void): Promise<any>;
203
- call(method: string, url: URL, headers?: Headers, params?: Payload, responseType?: string): Promise<any>;
204
- static flatten(data: Payload, prefix?: string): Payload;
138
+ call(method: string, url: URL, headers?: Headers, params?: Payload): Promise<any>;
205
139
  }
206
- export { Client, AppcondaException };
207
- export type { Models, Payload, UploadProgress };
208
- export type { RealtimeResponseEvent };
140
+ export { Client };
141
+ export type { Models, Payload };
209
142
 
210
- export class Account {
211
- client: Client;
143
+ export class Account extends Service {
212
144
  constructor(client: Client);
213
145
  /**
214
146
  * Get account
@@ -216,34 +148,45 @@ export class Account {
216
148
  * Get the currently logged in user.
217
149
  *
218
150
  * @throws {AppcondaException}
219
- * @returns {Promise<Models.User<Preferences>>}
220
- */
151
+ * @returns {Promise}
152
+ */
221
153
  get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
222
154
  /**
223
155
  * Create account
224
156
  *
225
- * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appconda.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
157
+ * Use this endpoint to allow a new user to register a new account in your
158
+ * project. After the user registration completes successfully, you can use
159
+ * the
160
+ * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
161
+ * route to start verifying the user email address. To allow the new user to
162
+ * login to their new account, you need to create a new [account
163
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
226
164
  *
227
165
  * @param {string} userId
228
166
  * @param {string} email
229
167
  * @param {string} password
230
168
  * @param {string} name
231
169
  * @throws {AppcondaException}
232
- * @returns {Promise<Models.User<Preferences>>}
233
- */
170
+ * @returns {Promise}
171
+ */
234
172
  create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
235
173
  /**
236
174
  * Update email
237
175
  *
238
- * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
239
- This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
240
-
176
+ * Update currently logged in user account email address. After changing user
177
+ * address, the user confirmation status will get reset. A new confirmation
178
+ * email is not sent automatically however you can use the send confirmation
179
+ * email endpoint again to send the confirmation email. For security measures,
180
+ * user password is required to complete this request.
181
+ * This endpoint can also be used to convert an anonymous account to a normal
182
+ * one, by passing an email address and a new password.
183
+ *
241
184
  *
242
185
  * @param {string} email
243
186
  * @param {string} password
244
187
  * @throws {AppcondaException}
245
- * @returns {Promise<Models.User<Preferences>>}
246
- */
188
+ * @returns {Promise}
189
+ */
247
190
  updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>>;
248
191
  /**
249
192
  * List Identities
@@ -252,8 +195,8 @@ This endpoint can also be used to convert an anonymous account to a normal one,
252
195
  *
253
196
  * @param {string[]} queries
254
197
  * @throws {AppcondaException}
255
- * @returns {Promise<Models.IdentityList>}
256
- */
198
+ * @returns {Promise}
199
+ */
257
200
  listIdentities(queries?: string[]): Promise<Models.IdentityList>;
258
201
  /**
259
202
  * Delete identity
@@ -262,27 +205,32 @@ This endpoint can also be used to convert an anonymous account to a normal one,
262
205
  *
263
206
  * @param {string} identityId
264
207
  * @throws {AppcondaException}
265
- * @returns {Promise<{}>}
266
- */
208
+ * @returns {Promise}
209
+ */
267
210
  deleteIdentity(identityId: string): Promise<{}>;
268
211
  /**
269
212
  * Create JWT
270
213
  *
271
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appconda server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
214
+ * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
215
+ * to authenticate on behalf of the current user when working with the
216
+ * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
217
+ * from its creation and will be invalid if the user will logout in that time
218
+ * frame.
272
219
  *
273
220
  * @throws {AppcondaException}
274
- * @returns {Promise<Models.Jwt>}
275
- */
221
+ * @returns {Promise}
222
+ */
276
223
  createJWT(): Promise<Models.Jwt>;
277
224
  /**
278
225
  * List logs
279
226
  *
280
- * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
227
+ * Get the list of latest security activity logs for the currently logged in
228
+ * user. Each log returns user IP address, location and date and time of log.
281
229
  *
282
230
  * @param {string[]} queries
283
231
  * @throws {AppcondaException}
284
- * @returns {Promise<Models.LogList>}
285
- */
232
+ * @returns {Promise}
233
+ */
286
234
  listLogs(queries?: string[]): Promise<Models.LogList>;
287
235
  /**
288
236
  * Update MFA
@@ -291,29 +239,34 @@ This endpoint can also be used to convert an anonymous account to a normal one,
291
239
  *
292
240
  * @param {boolean} mfa
293
241
  * @throws {AppcondaException}
294
- * @returns {Promise<Models.User<Preferences>>}
295
- */
242
+ * @returns {Promise}
243
+ */
296
244
  updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>>;
297
245
  /**
298
- * Create Authenticator
246
+ * Add Authenticator
299
247
  *
300
- * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
248
+ * Add an authenticator app to be used as an MFA factor. Verify the
249
+ * authenticator using the [verify
250
+ * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
251
+ * method.
301
252
  *
302
253
  * @param {AuthenticatorType} type
303
254
  * @throws {AppcondaException}
304
- * @returns {Promise<Models.MfaType>}
305
- */
255
+ * @returns {Promise}
256
+ */
306
257
  createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
307
258
  /**
308
259
  * Verify Authenticator
309
260
  *
310
- * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
261
+ * Verify an authenticator app after adding it using the [add
262
+ * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
263
+ * method.
311
264
  *
312
265
  * @param {AuthenticatorType} type
313
266
  * @param {string} otp
314
267
  * @throws {AppcondaException}
315
- * @returns {Promise<Models.User<Preferences>>}
316
- */
268
+ * @returns {Promise}
269
+ */
317
270
  updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
318
271
  /**
319
272
  * Delete Authenticator
@@ -321,30 +274,37 @@ This endpoint can also be used to convert an anonymous account to a normal one,
321
274
  * Delete an authenticator for a user by ID.
322
275
  *
323
276
  * @param {AuthenticatorType} type
277
+ * @param {string} otp
324
278
  * @throws {AppcondaException}
325
- * @returns {Promise<{}>}
326
- */
327
- deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
279
+ * @returns {Promise}
280
+ */
281
+ deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
328
282
  /**
329
- * Create MFA Challenge
283
+ * Create 2FA Challenge
330
284
  *
331
- * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
285
+ * Begin the process of MFA verification after sign-in. Finish the flow with
286
+ * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
287
+ * method.
332
288
  *
333
289
  * @param {AuthenticationFactor} factor
334
290
  * @throws {AppcondaException}
335
- * @returns {Promise<Models.MfaChallenge>}
336
- */
291
+ * @returns {Promise}
292
+ */
337
293
  createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
338
294
  /**
339
295
  * Create MFA Challenge (confirmation)
340
296
  *
341
- * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
297
+ * Complete the MFA challenge by providing the one-time password. Finish the
298
+ * process of MFA verification by providing the one-time password. To begin
299
+ * the flow, use
300
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
301
+ * method.
342
302
  *
343
303
  * @param {string} challengeId
344
304
  * @param {string} otp
345
305
  * @throws {AppcondaException}
346
- * @returns {Promise<{}>}
347
- */
306
+ * @returns {Promise}
307
+ */
348
308
  updateMfaChallenge(challengeId: string, otp: string): Promise<{}>;
349
309
  /**
350
310
  * List Factors
@@ -352,35 +312,45 @@ This endpoint can also be used to convert an anonymous account to a normal one,
352
312
  * List the factors available on the account to be used as a MFA challange.
353
313
  *
354
314
  * @throws {AppcondaException}
355
- * @returns {Promise<Models.MfaFactors>}
356
- */
315
+ * @returns {Promise}
316
+ */
357
317
  listMfaFactors(): Promise<Models.MfaFactors>;
358
318
  /**
359
319
  * Get MFA Recovery Codes
360
320
  *
361
- * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
321
+ * Get recovery codes that can be used as backup for MFA flow. Before getting
322
+ * codes, they must be generated using
323
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
324
+ * method. An OTP challenge is required to read recovery codes.
362
325
  *
363
326
  * @throws {AppcondaException}
364
- * @returns {Promise<Models.MfaRecoveryCodes>}
365
- */
327
+ * @returns {Promise}
328
+ */
366
329
  getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
367
330
  /**
368
331
  * Create MFA Recovery Codes
369
332
  *
370
- * Generate recovery codes as backup for MFA flow. It&#039;s recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
333
+ * Generate recovery codes as backup for MFA flow. It's recommended to
334
+ * generate and show then immediately after user successfully adds their
335
+ * authehticator. Recovery codes can be used as a MFA verification type in
336
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
337
+ * method.
371
338
  *
372
339
  * @throws {AppcondaException}
373
- * @returns {Promise<Models.MfaRecoveryCodes>}
374
- */
340
+ * @returns {Promise}
341
+ */
375
342
  createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
376
343
  /**
377
344
  * Regenerate MFA Recovery Codes
378
345
  *
379
- * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
346
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before
347
+ * regenerating codes, they must be first generated using
348
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
349
+ * method. An OTP challenge is required to regenreate recovery codes.
380
350
  *
381
351
  * @throws {AppcondaException}
382
- * @returns {Promise<Models.MfaRecoveryCodes>}
383
- */
352
+ * @returns {Promise}
353
+ */
384
354
  updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
385
355
  /**
386
356
  * Update name
@@ -389,30 +359,36 @@ This endpoint can also be used to convert an anonymous account to a normal one,
389
359
  *
390
360
  * @param {string} name
391
361
  * @throws {AppcondaException}
392
- * @returns {Promise<Models.User<Preferences>>}
393
- */
362
+ * @returns {Promise}
363
+ */
394
364
  updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>>;
395
365
  /**
396
366
  * Update password
397
367
  *
398
- * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
368
+ * Update currently logged in user password. For validation, user is required
369
+ * to pass in the new password, and the old password. For users created with
370
+ * OAuth, Team Invites and Magic URL, oldPassword is optional.
399
371
  *
400
372
  * @param {string} password
401
373
  * @param {string} oldPassword
402
374
  * @throws {AppcondaException}
403
- * @returns {Promise<Models.User<Preferences>>}
404
- */
375
+ * @returns {Promise}
376
+ */
405
377
  updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
406
378
  /**
407
379
  * Update phone
408
380
  *
409
- * Update the currently logged in user&#039;s phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appconda.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
381
+ * Update the currently logged in user's phone number. After updating the
382
+ * phone number, the phone verification status will be reset. A confirmation
383
+ * SMS is not sent automatically, however you can use the [POST
384
+ * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
385
+ * endpoint to send a confirmation SMS.
410
386
  *
411
387
  * @param {string} phone
412
388
  * @param {string} password
413
389
  * @throws {AppcondaException}
414
- * @returns {Promise<Models.User<Preferences>>}
415
- */
390
+ * @returns {Promise}
391
+ */
416
392
  updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
417
393
  /**
418
394
  * Get account preferences
@@ -420,173 +396,225 @@ This endpoint can also be used to convert an anonymous account to a normal one,
420
396
  * Get the preferences as a key-value object for the currently logged in user.
421
397
  *
422
398
  * @throws {AppcondaException}
423
- * @returns {Promise<Preferences>}
424
- */
399
+ * @returns {Promise}
400
+ */
425
401
  getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences>;
426
402
  /**
427
403
  * Update preferences
428
404
  *
429
- * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
405
+ * Update currently logged in user account preferences. The object you pass is
406
+ * stored as is, and replaces any previous value. The maximum allowed prefs
407
+ * size is 64kB and throws error if exceeded.
430
408
  *
431
409
  * @param {Partial<Preferences>} prefs
432
410
  * @throws {AppcondaException}
433
- * @returns {Promise<Models.User<Preferences>>}
434
- */
411
+ * @returns {Promise}
412
+ */
435
413
  updatePrefs<Preferences extends Models.Preferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
436
414
  /**
437
415
  * Create password recovery
438
416
  *
439
- * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appconda.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user&#039;s email address is valid for 1 hour.
417
+ * Sends the user an email with a temporary secret key for password reset.
418
+ * When the user clicks the confirmation link he is redirected back to your
419
+ * app password reset URL with the secret key and email address values
420
+ * attached to the URL query string. Use the query string params to submit a
421
+ * request to the [PUT
422
+ * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
423
+ * endpoint to complete the process. The verification link sent to the user's
424
+ * email address is valid for 1 hour.
440
425
  *
441
426
  * @param {string} email
442
427
  * @param {string} url
443
428
  * @throws {AppcondaException}
444
- * @returns {Promise<Models.Token>}
445
- */
429
+ * @returns {Promise}
430
+ */
446
431
  createRecovery(email: string, url: string): Promise<Models.Token>;
447
432
  /**
448
433
  * Create password recovery (confirmation)
449
434
  *
450
- * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appconda.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
451
-
452
- Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
435
+ * Use this endpoint to complete the user account password reset. Both the
436
+ * **userId** and **secret** arguments will be passed as query parameters to
437
+ * the redirect URL you have provided when sending your request to the [POST
438
+ * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
439
+ * endpoint.
440
+ *
441
+ * Please note that in order to avoid a [Redirect
442
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
443
+ * the only valid redirect URLs are the ones from domains you have set when
444
+ * adding your platforms in the console interface.
453
445
  *
454
446
  * @param {string} userId
455
447
  * @param {string} secret
456
448
  * @param {string} password
457
449
  * @throws {AppcondaException}
458
- * @returns {Promise<Models.Token>}
459
- */
450
+ * @returns {Promise}
451
+ */
460
452
  updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
461
453
  /**
462
454
  * List sessions
463
455
  *
464
- * Get the list of active sessions across different devices for the currently logged in user.
456
+ * Get the list of active sessions across different devices for the currently
457
+ * logged in user.
465
458
  *
466
459
  * @throws {AppcondaException}
467
- * @returns {Promise<Models.SessionList>}
468
- */
460
+ * @returns {Promise}
461
+ */
469
462
  listSessions(): Promise<Models.SessionList>;
470
463
  /**
471
464
  * Delete sessions
472
465
  *
473
- * Delete all sessions from the user account and remove any sessions cookies from the end client.
466
+ * Delete all sessions from the user account and remove any sessions cookies
467
+ * from the end client.
474
468
  *
475
469
  * @throws {AppcondaException}
476
- * @returns {Promise<{}>}
477
- */
470
+ * @returns {Promise}
471
+ */
478
472
  deleteSessions(): Promise<{}>;
479
473
  /**
480
474
  * Create anonymous session
481
475
  *
482
- * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appconda.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appconda.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
476
+ * Use this endpoint to allow a new user to register an anonymous account in
477
+ * your project. This route will also create a new session for the user. To
478
+ * allow the new user to convert an anonymous account to a normal account, you
479
+ * need to update its [email and
480
+ * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
481
+ * or create an [OAuth2
482
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
483
483
  *
484
484
  * @throws {AppcondaException}
485
- * @returns {Promise<Models.Session>}
486
- */
485
+ * @returns {Promise}
486
+ */
487
487
  createAnonymousSession(): Promise<Models.Session>;
488
488
  /**
489
489
  * Create email password session
490
490
  *
491
- * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
492
-
493
- A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
491
+ * Allow the user to login into their account by providing a valid email and
492
+ * password combination. This route will create a new session for the user.
493
+ *
494
+ * A user is limited to 10 active sessions at a time by default. [Learn more
495
+ * about session
496
+ * limits](https://appwrite.io/docs/authentication-security#limits).
494
497
  *
495
498
  * @param {string} email
496
499
  * @param {string} password
497
500
  * @throws {AppcondaException}
498
- * @returns {Promise<Models.Session>}
499
- */
501
+ * @returns {Promise}
502
+ */
500
503
  createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
501
504
  /**
502
505
  * Update magic URL session
503
506
  *
504
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
507
+ * Use this endpoint to create a session from token. Provide the **userId**
508
+ * and **secret** parameters from the successful response of authentication
509
+ * flows initiated by token creation. For example, magic URL and phone login.
505
510
  *
506
511
  * @param {string} userId
507
512
  * @param {string} secret
508
513
  * @throws {AppcondaException}
509
- * @returns {Promise<Models.Session>}
510
- */
514
+ * @returns {Promise}
515
+ */
511
516
  updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
512
517
  /**
513
518
  * Create OAuth2 session
514
519
  *
515
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appconda console first. Use the success and failure arguments to provide a redirect URL&#039;s back to your app when login is completed.
516
-
517
- If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
518
-
519
- A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
520
-
520
+ * Allow the user to login to their account using the OAuth2 provider of their
521
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
522
+ * first. Use the success and failure arguments to provide a redirect URL's
523
+ * back to your app when login is completed.
524
+ *
525
+ * If there is already an active session, the new session will be attached to
526
+ * the logged-in account. If there are no active sessions, the server will
527
+ * attempt to look for a user with the same email address as the email
528
+ * received from the OAuth2 provider and attach the new session to the
529
+ * existing user. If no matching user is found - the server will create a new
530
+ * user.
531
+ *
532
+ * A user is limited to 10 active sessions at a time by default. [Learn more
533
+ * about session
534
+ * limits](https://appwrite.io/docs/authentication-security#limits).
535
+ *
521
536
  *
522
537
  * @param {OAuthProvider} provider
523
538
  * @param {string} success
524
539
  * @param {string} failure
525
540
  * @param {string[]} scopes
526
541
  * @throws {AppcondaException}
527
- * @returns {Promise<void | string>}
528
- */
529
- createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<void | string>;
542
+ * @returns {void|string}
543
+ */
544
+ createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
530
545
  /**
531
546
  * Update phone session
532
547
  *
533
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
548
+ * Use this endpoint to create a session from token. Provide the **userId**
549
+ * and **secret** parameters from the successful response of authentication
550
+ * flows initiated by token creation. For example, magic URL and phone login.
534
551
  *
535
552
  * @param {string} userId
536
553
  * @param {string} secret
537
554
  * @throws {AppcondaException}
538
- * @returns {Promise<Models.Session>}
539
- */
555
+ * @returns {Promise}
556
+ */
540
557
  updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
541
558
  /**
542
559
  * Create session
543
560
  *
544
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
561
+ * Use this endpoint to create a session from token. Provide the **userId**
562
+ * and **secret** parameters from the successful response of authentication
563
+ * flows initiated by token creation. For example, magic URL and phone login.
545
564
  *
546
565
  * @param {string} userId
547
566
  * @param {string} secret
548
567
  * @throws {AppcondaException}
549
- * @returns {Promise<Models.Session>}
550
- */
568
+ * @returns {Promise}
569
+ */
551
570
  createSession(userId: string, secret: string): Promise<Models.Session>;
552
571
  /**
553
572
  * Get session
554
573
  *
555
- * Use this endpoint to get a logged in user&#039;s session using a Session ID. Inputting &#039;current&#039; will return the current session being used.
574
+ * Use this endpoint to get a logged in user's session using a Session ID.
575
+ * Inputting 'current' will return the current session being used.
556
576
  *
557
577
  * @param {string} sessionId
558
578
  * @throws {AppcondaException}
559
- * @returns {Promise<Models.Session>}
560
- */
579
+ * @returns {Promise}
580
+ */
561
581
  getSession(sessionId: string): Promise<Models.Session>;
562
582
  /**
563
583
  * Update session
564
584
  *
565
- * Use this endpoint to extend a session&#039;s length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
585
+ * Use this endpoint to extend a session's length. Extending a session is
586
+ * useful when session expiry is short. If the session was created using an
587
+ * OAuth provider, this endpoint refreshes the access token from the provider.
566
588
  *
567
589
  * @param {string} sessionId
568
590
  * @throws {AppcondaException}
569
- * @returns {Promise<Models.Session>}
570
- */
591
+ * @returns {Promise}
592
+ */
571
593
  updateSession(sessionId: string): Promise<Models.Session>;
572
594
  /**
573
595
  * Delete session
574
596
  *
575
- * Logout the user. Use &#039;current&#039; as the session ID to logout on this device, use a session ID to logout on another device. If you&#039;re looking to logout the user on all devices, use [Delete Sessions](https://appconda.io/docs/references/cloud/client-web/account#deleteSessions) instead.
597
+ * Logout the user. Use 'current' as the session ID to logout on this device,
598
+ * use a session ID to logout on another device. If you're looking to logout
599
+ * the user on all devices, use [Delete
600
+ * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
601
+ * instead.
576
602
  *
577
603
  * @param {string} sessionId
578
604
  * @throws {AppcondaException}
579
- * @returns {Promise<{}>}
580
- */
605
+ * @returns {Promise}
606
+ */
581
607
  deleteSession(sessionId: string): Promise<{}>;
582
608
  /**
583
609
  * Update status
584
610
  *
585
- * Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
611
+ * Block the currently logged in user account. Behind the scene, the user
612
+ * record is not deleted but permanently blocked from any access. To
613
+ * completely delete a user, use the Users API instead.
586
614
  *
587
615
  * @throws {AppcondaException}
588
- * @returns {Promise<Models.User<Preferences>>}
589
- */
616
+ * @returns {Promise}
617
+ */
590
618
  updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
591
619
  /**
592
620
  * Create push target
@@ -596,8 +624,8 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
596
624
  * @param {string} identifier
597
625
  * @param {string} providerId
598
626
  * @throws {AppcondaException}
599
- * @returns {Promise<Models.Target>}
600
- */
627
+ * @returns {Promise}
628
+ */
601
629
  createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>;
602
630
  /**
603
631
  * Update push target
@@ -606,8 +634,8 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
606
634
  * @param {string} targetId
607
635
  * @param {string} identifier
608
636
  * @throws {AppcondaException}
609
- * @returns {Promise<Models.Target>}
610
- */
637
+ * @returns {Promise}
638
+ */
611
639
  updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>;
612
640
  /**
613
641
  * Delete push target
@@ -615,225 +643,317 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
615
643
  *
616
644
  * @param {string} targetId
617
645
  * @throws {AppcondaException}
618
- * @returns {Promise<{}>}
619
- */
646
+ * @returns {Promise}
647
+ */
620
648
  deletePushTarget(targetId: string): Promise<{}>;
621
649
  /**
622
650
  * Create email token (OTP)
623
651
  *
624
- * Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user&#039;s email is valid for 15 minutes.
625
-
626
- A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
652
+ * Sends the user an email with a secret key for creating a session. If the
653
+ * provided user ID has not be registered, a new user will be created. Use the
654
+ * returned user ID and secret and submit a request to the [POST
655
+ * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
656
+ * endpoint to complete the login process. The secret sent to the user's email
657
+ * is valid for 15 minutes.
658
+ *
659
+ * A user is limited to 10 active sessions at a time by default. [Learn more
660
+ * about session
661
+ * limits](https://appwrite.io/docs/authentication-security#limits).
627
662
  *
628
663
  * @param {string} userId
629
664
  * @param {string} email
630
665
  * @param {boolean} phrase
631
666
  * @throws {AppcondaException}
632
- * @returns {Promise<Models.Token>}
633
- */
667
+ * @returns {Promise}
668
+ */
634
669
  createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
635
670
  /**
636
671
  * Create magic URL token
637
672
  *
638
- * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user&#039;s email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appconda instance by default.
639
-
640
- A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
641
-
673
+ * Sends the user an email with a secret key for creating a session. If the
674
+ * provided user ID has not been registered, a new user will be created. When
675
+ * the user clicks the link in the email, the user is redirected back to the
676
+ * URL you provided with the secret key and userId values attached to the URL
677
+ * query string. Use the query string parameters to submit a request to the
678
+ * [POST
679
+ * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
680
+ * endpoint to complete the login process. The link sent to the user's email
681
+ * address is valid for 1 hour. If you are on a mobile device you can leave
682
+ * the URL parameter empty, so that the login completion will be handled by
683
+ * your Appwrite instance by default.
684
+ *
685
+ * A user is limited to 10 active sessions at a time by default. [Learn more
686
+ * about session
687
+ * limits](https://appwrite.io/docs/authentication-security#limits).
688
+ *
642
689
  *
643
690
  * @param {string} userId
644
691
  * @param {string} email
645
692
  * @param {string} url
646
693
  * @param {boolean} phrase
647
694
  * @throws {AppcondaException}
648
- * @returns {Promise<Models.Token>}
649
- */
695
+ * @returns {Promise}
696
+ */
650
697
  createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
651
698
  /**
652
699
  * Create OAuth2 token
653
700
  *
654
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appconda console first. Use the success and failure arguments to provide a redirect URL&#039;s back to your app when login is completed.
655
-
656
- If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint.
657
-
658
- A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
701
+ * Allow the user to login to their account using the OAuth2 provider of their
702
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
703
+ * first. Use the success and failure arguments to provide a redirect URL's
704
+ * back to your app when login is completed.
705
+ *
706
+ * If authentication succeeds, `userId` and `secret` of a token will be
707
+ * appended to the success URL as query parameters. These can be used to
708
+ * create a new session using the [Create
709
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
710
+ * endpoint.
711
+ *
712
+ * A user is limited to 10 active sessions at a time by default. [Learn more
713
+ * about session
714
+ * limits](https://appwrite.io/docs/authentication-security#limits).
659
715
  *
660
716
  * @param {OAuthProvider} provider
661
717
  * @param {string} success
662
718
  * @param {string} failure
663
719
  * @param {string[]} scopes
664
720
  * @throws {AppcondaException}
665
- * @returns {Promise<void | string>}
666
- */
667
- createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<void | string>;
721
+ * @returns {void|string}
722
+ */
723
+ createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
668
724
  /**
669
725
  * Create phone token
670
726
  *
671
- * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user&#039;s phone is valid for 15 minutes.
672
-
673
- A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
727
+ * Sends the user an SMS with a secret key for creating a session. If the
728
+ * provided user ID has not be registered, a new user will be created. Use the
729
+ * returned user ID and secret and submit a request to the [POST
730
+ * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
731
+ * endpoint to complete the login process. The secret sent to the user's phone
732
+ * is valid for 15 minutes.
733
+ *
734
+ * A user is limited to 10 active sessions at a time by default. [Learn more
735
+ * about session
736
+ * limits](https://appwrite.io/docs/authentication-security#limits).
674
737
  *
675
738
  * @param {string} userId
676
739
  * @param {string} phone
677
740
  * @throws {AppcondaException}
678
- * @returns {Promise<Models.Token>}
679
- */
741
+ * @returns {Promise}
742
+ */
680
743
  createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
681
744
  /**
682
745
  * Create email verification
683
746
  *
684
- * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appconda.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user&#039;s email address is valid for 7 days.
685
-
686
- Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
687
-
747
+ * Use this endpoint to send a verification message to your user email address
748
+ * to confirm they are the valid owners of that address. Both the **userId**
749
+ * and **secret** arguments will be passed as query parameters to the URL you
750
+ * have provided to be attached to the verification email. The provided URL
751
+ * should redirect the user back to your app and allow you to complete the
752
+ * verification process by verifying both the **userId** and **secret**
753
+ * parameters. Learn more about how to [complete the verification
754
+ * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
755
+ * The verification link sent to the user's email address is valid for 7 days.
756
+ *
757
+ * Please note that in order to avoid a [Redirect
758
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
759
+ * the only valid redirect URLs are the ones from domains you have set when
760
+ * adding your platforms in the console interface.
761
+ *
688
762
  *
689
763
  * @param {string} url
690
764
  * @throws {AppcondaException}
691
- * @returns {Promise<Models.Token>}
692
- */
765
+ * @returns {Promise}
766
+ */
693
767
  createVerification(url: string): Promise<Models.Token>;
694
768
  /**
695
769
  * Create email verification (confirmation)
696
770
  *
697
- * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
771
+ * Use this endpoint to complete the user email verification process. Use both
772
+ * the **userId** and **secret** parameters that were attached to your app URL
773
+ * to verify the user email ownership. If confirmed this route will return a
774
+ * 200 status code.
698
775
  *
699
776
  * @param {string} userId
700
777
  * @param {string} secret
701
778
  * @throws {AppcondaException}
702
- * @returns {Promise<Models.Token>}
703
- */
779
+ * @returns {Promise}
780
+ */
704
781
  updateVerification(userId: string, secret: string): Promise<Models.Token>;
705
782
  /**
706
783
  * Create phone verification
707
784
  *
708
- * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user&#039;s phone number using the [accountUpdatePhone](https://appconda.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appconda.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user&#039;s phone number is valid for 15 minutes.
785
+ * Use this endpoint to send a verification SMS to the currently logged in
786
+ * user. This endpoint is meant for use after updating a user's phone number
787
+ * using the
788
+ * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
789
+ * endpoint. Learn more about how to [complete the verification
790
+ * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
791
+ * The verification code sent to the user's phone number is valid for 15
792
+ * minutes.
709
793
  *
710
794
  * @throws {AppcondaException}
711
- * @returns {Promise<Models.Token>}
712
- */
795
+ * @returns {Promise}
796
+ */
713
797
  createPhoneVerification(): Promise<Models.Token>;
714
798
  /**
715
- * Update phone verification (confirmation)
799
+ * Create phone verification (confirmation)
716
800
  *
717
- * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user&#039;s phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
801
+ * Use this endpoint to complete the user phone verification process. Use the
802
+ * **userId** and **secret** that were sent to your user's phone number to
803
+ * verify the user email ownership. If confirmed this route will return a 200
804
+ * status code.
718
805
  *
719
806
  * @param {string} userId
720
807
  * @param {string} secret
721
808
  * @throws {AppcondaException}
722
- * @returns {Promise<Models.Token>}
723
- */
809
+ * @returns {Promise}
810
+ */
724
811
  updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
725
812
  }
726
813
 
727
- export class Avatars {
728
- client: Client;
814
+ export class Avatars extends Service {
729
815
  constructor(client: Client);
730
816
  /**
731
817
  * Get browser icon
732
818
  *
733
- * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appconda.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
734
-
735
- When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.
819
+ * You can use this endpoint to show different browser icons to your users.
820
+ * The code argument receives the browser code as it appears in your user [GET
821
+ * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
822
+ * endpoint. Use width, height and quality arguments to change the output
823
+ * settings.
824
+ *
825
+ * When one dimension is specified and the other is 0, the image is scaled
826
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
827
+ * image at source quality. If dimensions are not specified, the default size
828
+ * of image returned is 100x100px.
736
829
  *
737
830
  * @param {Browser} code
738
831
  * @param {number} width
739
832
  * @param {number} height
740
833
  * @param {number} quality
741
- * @throws {AppcondaException}
742
- * @returns {string}
743
- */
744
- getBrowser(code: Browser, width?: number, height?: number, quality?: number): string;
834
+ * @throws {AppwriteException}
835
+ * @returns {URL}
836
+ */
837
+ getBrowser(code: Browser, width?: number, height?: number, quality?: number): URL;
745
838
  /**
746
839
  * Get credit card icon
747
840
  *
748
- * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
749
-
750
- When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.
751
-
841
+ * The credit card endpoint will return you the icon of the credit card
842
+ * provider you need. Use width, height and quality arguments to change the
843
+ * output settings.
844
+ *
845
+ * When one dimension is specified and the other is 0, the image is scaled
846
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
847
+ * image at source quality. If dimensions are not specified, the default size
848
+ * of image returned is 100x100px.
849
+ *
752
850
  *
753
851
  * @param {CreditCard} code
754
852
  * @param {number} width
755
853
  * @param {number} height
756
854
  * @param {number} quality
757
- * @throws {AppcondaException}
758
- * @returns {string}
759
- */
760
- getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): string;
855
+ * @throws {AppwriteException}
856
+ * @returns {URL}
857
+ */
858
+ getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): URL;
761
859
  /**
762
860
  * Get favicon
763
861
  *
764
- * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
765
-
766
- This endpoint does not follow HTTP redirects.
862
+ * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
863
+ * website URL.
864
+ *
767
865
  *
768
866
  * @param {string} url
769
- * @throws {AppcondaException}
770
- * @returns {string}
771
- */
772
- getFavicon(url: string): string;
867
+ * @throws {AppwriteException}
868
+ * @returns {URL}
869
+ */
870
+ getFavicon(url: string): URL;
773
871
  /**
774
872
  * Get country flag
775
873
  *
776
- * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
777
-
778
- When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.
779
-
874
+ * You can use this endpoint to show different country flags icons to your
875
+ * users. The code argument receives the 2 letter country code. Use width,
876
+ * height and quality arguments to change the output settings. Country codes
877
+ * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
878
+ *
879
+ * When one dimension is specified and the other is 0, the image is scaled
880
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
881
+ * image at source quality. If dimensions are not specified, the default size
882
+ * of image returned is 100x100px.
883
+ *
780
884
  *
781
885
  * @param {Flag} code
782
886
  * @param {number} width
783
887
  * @param {number} height
784
888
  * @param {number} quality
785
- * @throws {AppcondaException}
786
- * @returns {string}
787
- */
788
- getFlag(code: Flag, width?: number, height?: number, quality?: number): string;
889
+ * @throws {AppwriteException}
890
+ * @returns {URL}
891
+ */
892
+ getFlag(code: Flag, width?: number, height?: number, quality?: number): URL;
789
893
  /**
790
894
  * Get image from URL
791
895
  *
792
- * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
793
-
794
- When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px.
795
-
796
- This endpoint does not follow HTTP redirects.
896
+ * Use this endpoint to fetch a remote image URL and crop it to any image size
897
+ * you want. This endpoint is very useful if you need to crop and display
898
+ * remote images in your app or in case you want to make sure a 3rd party
899
+ * image is properly served using a TLS protocol.
900
+ *
901
+ * When one dimension is specified and the other is 0, the image is scaled
902
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
903
+ * image at source quality. If dimensions are not specified, the default size
904
+ * of image returned is 400x400px.
905
+ *
797
906
  *
798
907
  * @param {string} url
799
908
  * @param {number} width
800
909
  * @param {number} height
801
- * @throws {AppcondaException}
802
- * @returns {string}
803
- */
804
- getImage(url: string, width?: number, height?: number): string;
910
+ * @throws {AppwriteException}
911
+ * @returns {URL}
912
+ */
913
+ getImage(url: string, width?: number, height?: number): URL;
805
914
  /**
806
915
  * Get user initials
807
916
  *
808
- * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
809
-
810
- You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
811
-
812
- When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.
813
-
917
+ * Use this endpoint to show your user initials avatar icon on your website or
918
+ * app. By default, this route will try to print your logged-in user name or
919
+ * email initials. You can also overwrite the user name if you pass the 'name'
920
+ * parameter. If no name is given and no user is logged, an empty avatar will
921
+ * be returned.
922
+ *
923
+ * You can use the color and background params to change the avatar colors. By
924
+ * default, a random theme will be selected. The random theme will persist for
925
+ * the user's initials when reloading the same theme will always return for
926
+ * the same initials.
927
+ *
928
+ * When one dimension is specified and the other is 0, the image is scaled
929
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
930
+ * image at source quality. If dimensions are not specified, the default size
931
+ * of image returned is 100x100px.
932
+ *
814
933
  *
815
934
  * @param {string} name
816
935
  * @param {number} width
817
936
  * @param {number} height
818
937
  * @param {string} background
819
- * @throws {AppcondaException}
820
- * @returns {string}
821
- */
822
- getInitials(name?: string, width?: number, height?: number, background?: string): string;
938
+ * @throws {AppwriteException}
939
+ * @returns {URL}
940
+ */
941
+ getInitials(name?: string, width?: number, height?: number, background?: string): URL;
823
942
  /**
824
943
  * Get QR code
825
944
  *
826
- * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
827
-
945
+ * Converts a given plain text to a QR code image. You can use the query
946
+ * parameters to change the size and style of the resulting image.
947
+ *
828
948
  *
829
949
  * @param {string} text
830
950
  * @param {number} size
831
951
  * @param {number} margin
832
952
  * @param {boolean} download
833
- * @throws {AppcondaException}
834
- * @returns {string}
835
- */
836
- getQR(text: string, size?: number, margin?: number, download?: boolean): string;
953
+ * @throws {AppwriteException}
954
+ * @returns {URL}
955
+ */
956
+ getQR(text: string, size?: number, margin?: number, download?: boolean): URL;
837
957
  }
838
958
 
839
959
  export class Databases {
@@ -1082,91 +1202,110 @@ export class Messaging {
1082
1202
  deleteSubscriber(topicId: string, subscriberId: string): Promise<{}>;
1083
1203
  }
1084
1204
 
1085
- export class Storage {
1086
- client: Client;
1205
+ export class Storage extends Service {
1087
1206
  constructor(client: Client);
1088
1207
  /**
1089
1208
  * List files
1090
1209
  *
1091
- * Get a list of all the user files. You can use the query params to filter your results.
1210
+ * Get a list of all the user files. You can use the query params to filter
1211
+ * your results.
1092
1212
  *
1093
1213
  * @param {string} bucketId
1094
1214
  * @param {string[]} queries
1095
1215
  * @param {string} search
1096
1216
  * @throws {AppcondaException}
1097
- * @returns {Promise<Models.FileList>}
1098
- */
1217
+ * @returns {Promise}
1218
+ */
1099
1219
  listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>;
1100
1220
  /**
1101
1221
  * Create file
1102
1222
  *
1103
- * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appconda.io/docs/server/storage#storageCreateBucket) API or directly from your Appconda console.
1104
-
1105
- Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
1106
-
1107
- When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file&#039;s **id** in `x-realmocean-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
1108
-
1109
- If you&#039;re creating a new file using one of the Appconda SDKs, all the chunking logic will be managed by the SDK internally.
1110
-
1223
+ * Create a new file. Before using this route, you should create a new bucket
1224
+ * resource using either a [server
1225
+ * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
1226
+ * API or directly from your Appwrite console.
1227
+ *
1228
+ * Larger files should be uploaded using multiple requests with the
1229
+ * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
1230
+ * header to send a partial request with a maximum supported chunk of `5MB`.
1231
+ * The `content-range` header values should always be in bytes.
1232
+ *
1233
+ * When the first request is sent, the server will return the **File** object,
1234
+ * and the subsequent part request must include the file's **id** in
1235
+ * `x-appwrite-id` header to allow the server to know that the partial upload
1236
+ * is for the existing file and not for a new one.
1237
+ *
1238
+ * If you're creating a new file using one of the Appwrite SDKs, all the
1239
+ * chunking logic will be managed by the SDK internally.
1240
+ *
1111
1241
  *
1112
1242
  * @param {string} bucketId
1113
1243
  * @param {string} fileId
1114
1244
  * @param {File} file
1115
1245
  * @param {string[]} permissions
1116
1246
  * @throws {AppcondaException}
1117
- * @returns {Promise<Models.File>}
1118
- */
1247
+ * @returns {Promise}
1248
+ */
1119
1249
  createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
1120
1250
  /**
1121
1251
  * Get file
1122
1252
  *
1123
- * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
1253
+ * Get a file by its unique ID. This endpoint response returns a JSON object
1254
+ * with the file metadata.
1124
1255
  *
1125
1256
  * @param {string} bucketId
1126
1257
  * @param {string} fileId
1127
1258
  * @throws {AppcondaException}
1128
- * @returns {Promise<Models.File>}
1129
- */
1259
+ * @returns {Promise}
1260
+ */
1130
1261
  getFile(bucketId: string, fileId: string): Promise<Models.File>;
1131
1262
  /**
1132
1263
  * Update file
1133
1264
  *
1134
- * Update a file by its unique ID. Only users with write permissions have access to update this resource.
1265
+ * Update a file by its unique ID. Only users with write permissions have
1266
+ * access to update this resource.
1135
1267
  *
1136
1268
  * @param {string} bucketId
1137
1269
  * @param {string} fileId
1138
1270
  * @param {string} name
1139
1271
  * @param {string[]} permissions
1140
1272
  * @throws {AppcondaException}
1141
- * @returns {Promise<Models.File>}
1142
- */
1273
+ * @returns {Promise}
1274
+ */
1143
1275
  updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
1144
1276
  /**
1145
1277
  * Delete File
1146
1278
  *
1147
- * Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
1279
+ * Delete a file by its unique ID. Only users with write permissions have
1280
+ * access to delete this resource.
1148
1281
  *
1149
1282
  * @param {string} bucketId
1150
1283
  * @param {string} fileId
1151
1284
  * @throws {AppcondaException}
1152
- * @returns {Promise<{}>}
1153
- */
1285
+ * @returns {Promise}
1286
+ */
1154
1287
  deleteFile(bucketId: string, fileId: string): Promise<{}>;
1155
1288
  /**
1156
1289
  * Get file for download
1157
1290
  *
1158
- * Get a file content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
1291
+ * Get a file content by its unique ID. The endpoint response return with a
1292
+ * 'Content-Disposition: attachment' header that tells the browser to start
1293
+ * downloading the file to user downloads directory.
1159
1294
  *
1160
1295
  * @param {string} bucketId
1161
1296
  * @param {string} fileId
1162
1297
  * @throws {AppcondaException}
1163
- * @returns {string}
1164
- */
1165
- getFileDownload(bucketId: string, fileId: string): string;
1298
+ * @returns {URL}
1299
+ */
1300
+ getFileDownload(bucketId: string, fileId: string): URL;
1166
1301
  /**
1167
1302
  * Get file preview
1168
1303
  *
1169
- * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
1304
+ * Get a file preview image. Currently, this method supports preview for image
1305
+ * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
1306
+ * and spreadsheets, will return the file icon image. You can also pass query
1307
+ * string arguments for cutting and resizing your preview image. Preview is
1308
+ * supported only for image files smaller than 10MB.
1170
1309
  *
1171
1310
  * @param {string} bucketId
1172
1311
  * @param {string} fileId
@@ -1182,20 +1321,22 @@ If you&#039;re creating a new file using one of the Appconda SDKs, all the chunk
1182
1321
  * @param {string} background
1183
1322
  * @param {ImageFormat} output
1184
1323
  * @throws {AppcondaException}
1185
- * @returns {string}
1186
- */
1187
- 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): string;
1324
+ * @returns {URL}
1325
+ */
1326
+ 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;
1188
1327
  /**
1189
1328
  * Get file for view
1190
1329
  *
1191
- * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no &#039;Content-Disposition: attachment&#039; header.
1330
+ * Get a file content by its unique ID. This endpoint is similar to the
1331
+ * download method but returns with no 'Content-Disposition: attachment'
1332
+ * header.
1192
1333
  *
1193
1334
  * @param {string} bucketId
1194
1335
  * @param {string} fileId
1195
1336
  * @throws {AppcondaException}
1196
- * @returns {string}
1197
- */
1198
- getFileView(bucketId: string, fileId: string): string;
1337
+ * @returns {URL}
1338
+ */
1339
+ getFileView(bucketId: string, fileId: string): URL;
1199
1340
  }
1200
1341
 
1201
1342
  export class Teams {
@@ -3214,3 +3355,13 @@ export namespace Models {
3214
3355
  };
3215
3356
  }
3216
3357
 
3358
+ export class Service {
3359
+ /**
3360
+ * The size for chunked uploads in bytes.
3361
+ */
3362
+ static CHUNK_SIZE: number;
3363
+ client: Client;
3364
+ constructor(client: Client);
3365
+ static flatten(data: Payload, prefix?: string): Payload;
3366
+ }
3367
+