react-native-appwrite 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -3
- package/dist/cjs/sdk.js +1854 -1121
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1854 -1122
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-password-session.md +4 -4
- package/docs/examples/account/create-email-token.md +5 -5
- package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
- package/docs/examples/account/create-mfa-authenticator.md +3 -3
- package/docs/examples/account/create-mfa-challenge.md +3 -3
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
- package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
- package/docs/examples/account/create-phone-token.md +4 -4
- package/docs/examples/account/create-push-target.md +5 -5
- package/docs/examples/account/create-recovery.md +4 -4
- package/docs/examples/account/create-session.md +4 -4
- package/docs/examples/account/create-verification.md +3 -3
- package/docs/examples/account/create.md +6 -6
- package/docs/examples/account/delete-identity.md +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +3 -3
- package/docs/examples/account/delete-push-target.md +3 -3
- package/docs/examples/account/delete-session.md +3 -3
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-session.md +3 -3
- package/docs/examples/account/list-identities.md +3 -3
- package/docs/examples/account/list-logs.md +3 -3
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/update-email.md +4 -4
- package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
- package/docs/examples/account/update-mfa-authenticator.md +4 -4
- package/docs/examples/account/update-mfa-challenge.md +4 -4
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
- package/docs/examples/account/update-name.md +3 -3
- package/docs/examples/account/update-password.md +4 -4
- package/docs/examples/account/update-phone-session.md +4 -4
- package/docs/examples/account/update-phone-verification.md +4 -4
- package/docs/examples/account/update-phone.md +4 -4
- package/docs/examples/account/update-prefs.md +7 -3
- package/docs/examples/account/update-push-target.md +4 -4
- package/docs/examples/account/update-recovery.md +5 -5
- package/docs/examples/account/update-session.md +3 -3
- package/docs/examples/account/update-verification.md +4 -4
- package/docs/examples/avatars/get-browser.md +6 -6
- package/docs/examples/avatars/get-credit-card.md +6 -6
- package/docs/examples/avatars/get-favicon.md +3 -3
- package/docs/examples/avatars/get-flag.md +6 -6
- package/docs/examples/avatars/get-image.md +5 -5
- package/docs/examples/avatars/get-initials.md +6 -6
- package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
- package/docs/examples/databases/create-document.md +13 -7
- package/docs/examples/databases/decrement-document-attribute.md +8 -8
- package/docs/examples/databases/delete-document.md +5 -5
- package/docs/examples/databases/get-document.md +6 -6
- package/docs/examples/databases/increment-document-attribute.md +8 -8
- package/docs/examples/databases/list-documents.md +5 -5
- package/docs/examples/databases/update-document.md +7 -7
- package/docs/examples/databases/upsert-document.md +7 -7
- package/docs/examples/functions/create-execution.md +9 -9
- package/docs/examples/functions/get-execution.md +4 -4
- package/docs/examples/functions/list-executions.md +4 -4
- package/docs/examples/graphql/mutation.md +3 -3
- package/docs/examples/graphql/query.md +3 -3
- package/docs/examples/messaging/create-subscriber.md +5 -5
- package/docs/examples/messaging/delete-subscriber.md +4 -4
- package/docs/examples/storage/create-file.md +6 -6
- package/docs/examples/storage/delete-file.md +4 -4
- package/docs/examples/storage/get-file-download.md +5 -5
- package/docs/examples/storage/get-file-preview.md +16 -16
- package/docs/examples/storage/get-file-view.md +5 -5
- package/docs/examples/storage/get-file.md +4 -4
- package/docs/examples/storage/list-files.md +5 -5
- package/docs/examples/storage/update-file.md +6 -6
- package/docs/examples/tablesdb/create-row.md +23 -0
- package/docs/examples/tablesdb/decrement-row-column.md +18 -0
- package/docs/examples/tablesdb/delete-row.md +15 -0
- package/docs/examples/tablesdb/get-row.md +16 -0
- package/docs/examples/tablesdb/increment-row-column.md +18 -0
- package/docs/examples/tablesdb/list-rows.md +15 -0
- package/docs/examples/tablesdb/update-row.md +17 -0
- package/docs/examples/tablesdb/upsert-row.md +17 -0
- package/docs/examples/teams/create-membership.md +9 -9
- package/docs/examples/teams/create.md +5 -5
- package/docs/examples/teams/delete-membership.md +4 -4
- package/docs/examples/teams/delete.md +3 -3
- package/docs/examples/teams/get-membership.md +4 -4
- package/docs/examples/teams/get-prefs.md +3 -3
- package/docs/examples/teams/get.md +3 -3
- package/docs/examples/teams/list-memberships.md +5 -5
- package/docs/examples/teams/list.md +4 -4
- package/docs/examples/teams/update-membership-status.md +6 -6
- package/docs/examples/teams/update-membership.md +5 -5
- package/docs/examples/teams/update-name.md +4 -4
- package/docs/examples/teams/update-prefs.md +4 -4
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/enums/credit-card.ts +1 -1
- package/src/enums/execution-method.ts +1 -0
- package/src/index.ts +1 -0
- package/src/models.ts +72 -27
- package/src/query.ts +247 -4
- package/src/services/account.ts +1469 -315
- package/src/services/avatars.ts +289 -80
- package/src/services/databases.ts +345 -63
- package/src/services/functions.ts +115 -20
- package/src/services/graphql.ts +52 -4
- package/src/services/locale.ts +8 -19
- package/src/services/messaging.ts +66 -7
- package/src/services/storage.ts +345 -76
- package/src/services/tables-db.ts +621 -0
- package/src/services/teams.ts +454 -93
- package/types/enums/credit-card.d.ts +1 -1
- package/types/enums/execution-method.d.ts +2 -1
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +69 -25
- package/types/query.d.ts +201 -4
- package/types/services/account.d.ts +734 -280
- package/types/services/avatars.d.ts +168 -73
- package/types/services/databases.d.ts +199 -58
- package/types/services/functions.d.ts +62 -17
- package/types/services/graphql.d.ts +24 -2
- package/types/services/locale.d.ts +8 -19
- package/types/services/messaging.d.ts +33 -5
- package/types/services/storage.d.ts +201 -68
- package/types/services/tables-db.d.ts +245 -0
- package/types/services/teams.d.ts +242 -80
- /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
- /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/src/services/avatars.ts
CHANGED
|
@@ -17,25 +17,54 @@ export class Avatars extends Service {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* You can use this endpoint to show different browser icons to your users.
|
|
21
|
-
* The code argument receives the browser code as it appears in your user [GET
|
|
22
|
-
* /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
|
|
23
|
-
* endpoint. Use width, height and quality arguments to change the output
|
|
24
|
-
* settings.
|
|
20
|
+
* 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://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
|
|
25
21
|
*
|
|
26
|
-
* When one dimension is specified and the other is 0, the image is scaled
|
|
27
|
-
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
28
|
-
* image at source quality. If dimensions are not specified, the default size
|
|
29
|
-
* of image returned is 100x100px.
|
|
22
|
+
* 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.
|
|
30
23
|
*
|
|
31
|
-
* @param {Browser} code
|
|
32
|
-
* @param {number} width
|
|
33
|
-
* @param {number} height
|
|
34
|
-
* @param {number} quality
|
|
24
|
+
* @param {Browser} params.code - Browser Code.
|
|
25
|
+
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
26
|
+
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
27
|
+
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
35
28
|
* @throws {AppwriteException}
|
|
36
29
|
* @returns {ArrayBuffer}
|
|
37
30
|
*/
|
|
38
|
-
getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer
|
|
31
|
+
getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>;
|
|
32
|
+
/**
|
|
33
|
+
* 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://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
|
|
34
|
+
*
|
|
35
|
+
* 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.
|
|
36
|
+
*
|
|
37
|
+
* @param {Browser} code - Browser Code.
|
|
38
|
+
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
39
|
+
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
40
|
+
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
41
|
+
* @throws {AppwriteException}
|
|
42
|
+
* @returns {Promise<ArrayBuffer>}
|
|
43
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
44
|
+
*/
|
|
45
|
+
getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
|
|
46
|
+
getBrowser(
|
|
47
|
+
paramsOrFirst: { code: Browser, width?: number, height?: number, quality?: number } | Browser,
|
|
48
|
+
...rest: [(number)?, (number)?, (number)?]
|
|
49
|
+
): Promise<ArrayBuffer> {
|
|
50
|
+
let params: { code: Browser, width?: number, height?: number, quality?: number };
|
|
51
|
+
|
|
52
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
53
|
+
params = (paramsOrFirst || {}) as { code: Browser, width?: number, height?: number, quality?: number };
|
|
54
|
+
} else {
|
|
55
|
+
params = {
|
|
56
|
+
code: paramsOrFirst as Browser,
|
|
57
|
+
width: rest[0] as number,
|
|
58
|
+
height: rest[1] as number,
|
|
59
|
+
quality: rest[2] as number
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const code = params.code;
|
|
64
|
+
const width = params.width;
|
|
65
|
+
const height = params.height;
|
|
66
|
+
const quality = params.quality;
|
|
67
|
+
|
|
39
68
|
if (typeof code === 'undefined') {
|
|
40
69
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
41
70
|
}
|
|
@@ -67,24 +96,56 @@ export class Avatars extends Service {
|
|
|
67
96
|
}
|
|
68
97
|
|
|
69
98
|
/**
|
|
70
|
-
* The credit card endpoint will return you the icon of the credit card
|
|
71
|
-
* provider you need. Use width, height and quality arguments to change the
|
|
72
|
-
* output settings.
|
|
99
|
+
* 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.
|
|
73
100
|
*
|
|
74
|
-
* When one dimension is specified and the other is 0, the image is scaled
|
|
75
|
-
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
76
|
-
* image at source quality. If dimensions are not specified, the default size
|
|
77
|
-
* of image returned is 100x100px.
|
|
101
|
+
* 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.
|
|
78
102
|
*
|
|
79
103
|
*
|
|
80
|
-
* @param {CreditCard} code
|
|
81
|
-
* @param {number} width
|
|
82
|
-
* @param {number} height
|
|
83
|
-
* @param {number} quality
|
|
104
|
+
* @param {CreditCard} params.code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
|
|
105
|
+
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
106
|
+
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
107
|
+
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
84
108
|
* @throws {AppwriteException}
|
|
85
109
|
* @returns {ArrayBuffer}
|
|
86
110
|
*/
|
|
87
|
-
getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer
|
|
111
|
+
getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>;
|
|
112
|
+
/**
|
|
113
|
+
* 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.
|
|
114
|
+
*
|
|
115
|
+
* 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.
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
* @param {CreditCard} code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
|
|
119
|
+
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
120
|
+
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
121
|
+
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
122
|
+
* @throws {AppwriteException}
|
|
123
|
+
* @returns {Promise<ArrayBuffer>}
|
|
124
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
125
|
+
*/
|
|
126
|
+
getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
|
|
127
|
+
getCreditCard(
|
|
128
|
+
paramsOrFirst: { code: CreditCard, width?: number, height?: number, quality?: number } | CreditCard,
|
|
129
|
+
...rest: [(number)?, (number)?, (number)?]
|
|
130
|
+
): Promise<ArrayBuffer> {
|
|
131
|
+
let params: { code: CreditCard, width?: number, height?: number, quality?: number };
|
|
132
|
+
|
|
133
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
134
|
+
params = (paramsOrFirst || {}) as { code: CreditCard, width?: number, height?: number, quality?: number };
|
|
135
|
+
} else {
|
|
136
|
+
params = {
|
|
137
|
+
code: paramsOrFirst as CreditCard,
|
|
138
|
+
width: rest[0] as number,
|
|
139
|
+
height: rest[1] as number,
|
|
140
|
+
quality: rest[2] as number
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const code = params.code;
|
|
145
|
+
const width = params.width;
|
|
146
|
+
const height = params.height;
|
|
147
|
+
const quality = params.quality;
|
|
148
|
+
|
|
88
149
|
if (typeof code === 'undefined') {
|
|
89
150
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
90
151
|
}
|
|
@@ -116,16 +177,41 @@ export class Avatars extends Service {
|
|
|
116
177
|
}
|
|
117
178
|
|
|
118
179
|
/**
|
|
119
|
-
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
|
120
|
-
* website URL.
|
|
180
|
+
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
|
|
121
181
|
*
|
|
122
182
|
* This endpoint does not follow HTTP redirects.
|
|
123
183
|
*
|
|
124
|
-
* @param {string} url
|
|
184
|
+
* @param {string} params.url - Website URL which you want to fetch the favicon from.
|
|
125
185
|
* @throws {AppwriteException}
|
|
126
186
|
* @returns {ArrayBuffer}
|
|
127
187
|
*/
|
|
128
|
-
getFavicon(url: string): Promise<ArrayBuffer
|
|
188
|
+
getFavicon(params: { url: string }): Promise<ArrayBuffer>;
|
|
189
|
+
/**
|
|
190
|
+
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
|
|
191
|
+
*
|
|
192
|
+
* This endpoint does not follow HTTP redirects.
|
|
193
|
+
*
|
|
194
|
+
* @param {string} url - Website URL which you want to fetch the favicon from.
|
|
195
|
+
* @throws {AppwriteException}
|
|
196
|
+
* @returns {Promise<ArrayBuffer>}
|
|
197
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
198
|
+
*/
|
|
199
|
+
getFavicon(url: string): Promise<ArrayBuffer>;
|
|
200
|
+
getFavicon(
|
|
201
|
+
paramsOrFirst: { url: string } | string
|
|
202
|
+
): Promise<ArrayBuffer> {
|
|
203
|
+
let params: { url: string };
|
|
204
|
+
|
|
205
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
206
|
+
params = (paramsOrFirst || {}) as { url: string };
|
|
207
|
+
} else {
|
|
208
|
+
params = {
|
|
209
|
+
url: paramsOrFirst as string
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const url = params.url;
|
|
214
|
+
|
|
129
215
|
if (typeof url === 'undefined') {
|
|
130
216
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
131
217
|
}
|
|
@@ -149,25 +235,56 @@ export class Avatars extends Service {
|
|
|
149
235
|
}
|
|
150
236
|
|
|
151
237
|
/**
|
|
152
|
-
* You can use this endpoint to show different country flags icons to your
|
|
153
|
-
* users. The code argument receives the 2 letter country code. Use width,
|
|
154
|
-
* height and quality arguments to change the output settings. Country codes
|
|
155
|
-
* follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
|
|
238
|
+
* 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.
|
|
156
239
|
*
|
|
157
|
-
* When one dimension is specified and the other is 0, the image is scaled
|
|
158
|
-
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
159
|
-
* image at source quality. If dimensions are not specified, the default size
|
|
160
|
-
* of image returned is 100x100px.
|
|
240
|
+
* 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.
|
|
161
241
|
*
|
|
162
242
|
*
|
|
163
|
-
* @param {Flag} code
|
|
164
|
-
* @param {number} width
|
|
165
|
-
* @param {number} height
|
|
166
|
-
* @param {number} quality
|
|
243
|
+
* @param {Flag} params.code - Country Code. ISO Alpha-2 country code format.
|
|
244
|
+
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
245
|
+
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
246
|
+
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
167
247
|
* @throws {AppwriteException}
|
|
168
248
|
* @returns {ArrayBuffer}
|
|
169
249
|
*/
|
|
170
|
-
getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer
|
|
250
|
+
getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>;
|
|
251
|
+
/**
|
|
252
|
+
* 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.
|
|
253
|
+
*
|
|
254
|
+
* 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.
|
|
255
|
+
*
|
|
256
|
+
*
|
|
257
|
+
* @param {Flag} code - Country Code. ISO Alpha-2 country code format.
|
|
258
|
+
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
259
|
+
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
260
|
+
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
261
|
+
* @throws {AppwriteException}
|
|
262
|
+
* @returns {Promise<ArrayBuffer>}
|
|
263
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
264
|
+
*/
|
|
265
|
+
getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
|
|
266
|
+
getFlag(
|
|
267
|
+
paramsOrFirst: { code: Flag, width?: number, height?: number, quality?: number } | Flag,
|
|
268
|
+
...rest: [(number)?, (number)?, (number)?]
|
|
269
|
+
): Promise<ArrayBuffer> {
|
|
270
|
+
let params: { code: Flag, width?: number, height?: number, quality?: number };
|
|
271
|
+
|
|
272
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
273
|
+
params = (paramsOrFirst || {}) as { code: Flag, width?: number, height?: number, quality?: number };
|
|
274
|
+
} else {
|
|
275
|
+
params = {
|
|
276
|
+
code: paramsOrFirst as Flag,
|
|
277
|
+
width: rest[0] as number,
|
|
278
|
+
height: rest[1] as number,
|
|
279
|
+
quality: rest[2] as number
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const code = params.code;
|
|
284
|
+
const width = params.width;
|
|
285
|
+
const height = params.height;
|
|
286
|
+
const quality = params.quality;
|
|
287
|
+
|
|
171
288
|
if (typeof code === 'undefined') {
|
|
172
289
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
173
290
|
}
|
|
@@ -199,25 +316,54 @@ export class Avatars extends Service {
|
|
|
199
316
|
}
|
|
200
317
|
|
|
201
318
|
/**
|
|
202
|
-
* Use this endpoint to fetch a remote image URL and crop it to any image size
|
|
203
|
-
* you want. This endpoint is very useful if you need to crop and display
|
|
204
|
-
* remote images in your app or in case you want to make sure a 3rd party
|
|
205
|
-
* image is properly served using a TLS protocol.
|
|
319
|
+
* 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.
|
|
206
320
|
*
|
|
207
|
-
* When one dimension is specified and the other is 0, the image is scaled
|
|
208
|
-
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
209
|
-
* image at source quality. If dimensions are not specified, the default size
|
|
210
|
-
* of image returned is 400x400px.
|
|
321
|
+
* 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.
|
|
211
322
|
*
|
|
212
323
|
* This endpoint does not follow HTTP redirects.
|
|
213
324
|
*
|
|
214
|
-
* @param {string} url
|
|
215
|
-
* @param {number} width
|
|
216
|
-
* @param {number} height
|
|
325
|
+
* @param {string} params.url - Image URL which you want to crop.
|
|
326
|
+
* @param {number} params.width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
|
|
327
|
+
* @param {number} params.height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
|
|
217
328
|
* @throws {AppwriteException}
|
|
218
329
|
* @returns {ArrayBuffer}
|
|
219
330
|
*/
|
|
220
|
-
getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer
|
|
331
|
+
getImage(params: { url: string, width?: number, height?: number }): Promise<ArrayBuffer>;
|
|
332
|
+
/**
|
|
333
|
+
* 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.
|
|
334
|
+
*
|
|
335
|
+
* 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.
|
|
336
|
+
*
|
|
337
|
+
* This endpoint does not follow HTTP redirects.
|
|
338
|
+
*
|
|
339
|
+
* @param {string} url - Image URL which you want to crop.
|
|
340
|
+
* @param {number} width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
|
|
341
|
+
* @param {number} height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
|
|
342
|
+
* @throws {AppwriteException}
|
|
343
|
+
* @returns {Promise<ArrayBuffer>}
|
|
344
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
345
|
+
*/
|
|
346
|
+
getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer>;
|
|
347
|
+
getImage(
|
|
348
|
+
paramsOrFirst: { url: string, width?: number, height?: number } | string,
|
|
349
|
+
...rest: [(number)?, (number)?]
|
|
350
|
+
): Promise<ArrayBuffer> {
|
|
351
|
+
let params: { url: string, width?: number, height?: number };
|
|
352
|
+
|
|
353
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
354
|
+
params = (paramsOrFirst || {}) as { url: string, width?: number, height?: number };
|
|
355
|
+
} else {
|
|
356
|
+
params = {
|
|
357
|
+
url: paramsOrFirst as string,
|
|
358
|
+
width: rest[0] as number,
|
|
359
|
+
height: rest[1] as number
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const url = params.url;
|
|
364
|
+
const width = params.width;
|
|
365
|
+
const height = params.height;
|
|
366
|
+
|
|
221
367
|
if (typeof url === 'undefined') {
|
|
222
368
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
223
369
|
}
|
|
@@ -249,31 +395,60 @@ export class Avatars extends Service {
|
|
|
249
395
|
}
|
|
250
396
|
|
|
251
397
|
/**
|
|
252
|
-
* Use this endpoint to show your user initials avatar icon on your website or
|
|
253
|
-
* app. By default, this route will try to print your logged-in user name or
|
|
254
|
-
* email initials. You can also overwrite the user name if you pass the 'name'
|
|
255
|
-
* parameter. If no name is given and no user is logged, an empty avatar will
|
|
256
|
-
* be returned.
|
|
398
|
+
* 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 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
|
|
257
399
|
*
|
|
258
|
-
* You can use the color and background params to change the avatar colors. By
|
|
259
|
-
* default, a random theme will be selected. The random theme will persist for
|
|
260
|
-
* the user's initials when reloading the same theme will always return for
|
|
261
|
-
* the same initials.
|
|
400
|
+
* 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's initials when reloading the same theme will always return for the same initials.
|
|
262
401
|
*
|
|
263
|
-
* When one dimension is specified and the other is 0, the image is scaled
|
|
264
|
-
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
265
|
-
* image at source quality. If dimensions are not specified, the default size
|
|
266
|
-
* of image returned is 100x100px.
|
|
402
|
+
* 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.
|
|
267
403
|
*
|
|
268
404
|
*
|
|
269
|
-
* @param {string} name
|
|
270
|
-
* @param {number} width
|
|
271
|
-
* @param {number} height
|
|
272
|
-
* @param {string} background
|
|
405
|
+
* @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.
|
|
406
|
+
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
407
|
+
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
408
|
+
* @param {string} params.background - Changes background color. By default a random color will be picked and stay will persistent to the given name.
|
|
273
409
|
* @throws {AppwriteException}
|
|
274
410
|
* @returns {ArrayBuffer}
|
|
275
411
|
*/
|
|
276
|
-
getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer
|
|
412
|
+
getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise<ArrayBuffer>;
|
|
413
|
+
/**
|
|
414
|
+
* 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 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
|
|
415
|
+
*
|
|
416
|
+
* 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's initials when reloading the same theme will always return for the same initials.
|
|
417
|
+
*
|
|
418
|
+
* 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.
|
|
419
|
+
*
|
|
420
|
+
*
|
|
421
|
+
* @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.
|
|
422
|
+
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
423
|
+
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
424
|
+
* @param {string} background - Changes background color. By default a random color will be picked and stay will persistent to the given name.
|
|
425
|
+
* @throws {AppwriteException}
|
|
426
|
+
* @returns {Promise<ArrayBuffer>}
|
|
427
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
428
|
+
*/
|
|
429
|
+
getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer>;
|
|
430
|
+
getInitials(
|
|
431
|
+
paramsOrFirst?: { name?: string, width?: number, height?: number, background?: string } | string,
|
|
432
|
+
...rest: [(number)?, (number)?, (string)?]
|
|
433
|
+
): Promise<ArrayBuffer> {
|
|
434
|
+
let params: { name?: string, width?: number, height?: number, background?: string };
|
|
435
|
+
|
|
436
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
437
|
+
params = (paramsOrFirst || {}) as { name?: string, width?: number, height?: number, background?: string };
|
|
438
|
+
} else {
|
|
439
|
+
params = {
|
|
440
|
+
name: paramsOrFirst as string,
|
|
441
|
+
width: rest[0] as number,
|
|
442
|
+
height: rest[1] as number,
|
|
443
|
+
background: rest[2] as string
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const name = params.name;
|
|
448
|
+
const width = params.width;
|
|
449
|
+
const height = params.height;
|
|
450
|
+
const background = params.background;
|
|
451
|
+
|
|
277
452
|
const apiPath = '/avatars/initials';
|
|
278
453
|
const payload: Payload = {};
|
|
279
454
|
|
|
@@ -305,18 +480,52 @@ export class Avatars extends Service {
|
|
|
305
480
|
}
|
|
306
481
|
|
|
307
482
|
/**
|
|
308
|
-
* Converts a given plain text to a QR code image. You can use the query
|
|
309
|
-
* parameters to change the size and style of the resulting image.
|
|
483
|
+
* 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.
|
|
310
484
|
*
|
|
311
485
|
*
|
|
312
|
-
* @param {string} text
|
|
313
|
-
* @param {number} size
|
|
314
|
-
* @param {number} margin
|
|
315
|
-
* @param {boolean} download
|
|
486
|
+
* @param {string} params.text - Plain text to be converted to QR code image.
|
|
487
|
+
* @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.
|
|
488
|
+
* @param {number} params.margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
|
|
489
|
+
* @param {boolean} params.download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
|
|
316
490
|
* @throws {AppwriteException}
|
|
317
491
|
* @returns {ArrayBuffer}
|
|
318
492
|
*/
|
|
319
|
-
getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer
|
|
493
|
+
getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise<ArrayBuffer>;
|
|
494
|
+
/**
|
|
495
|
+
* 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.
|
|
496
|
+
*
|
|
497
|
+
*
|
|
498
|
+
* @param {string} text - Plain text to be converted to QR code image.
|
|
499
|
+
* @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.
|
|
500
|
+
* @param {number} margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
|
|
501
|
+
* @param {boolean} download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
|
|
502
|
+
* @throws {AppwriteException}
|
|
503
|
+
* @returns {Promise<ArrayBuffer>}
|
|
504
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
505
|
+
*/
|
|
506
|
+
getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer>;
|
|
507
|
+
getQR(
|
|
508
|
+
paramsOrFirst: { text: string, size?: number, margin?: number, download?: boolean } | string,
|
|
509
|
+
...rest: [(number)?, (number)?, (boolean)?]
|
|
510
|
+
): Promise<ArrayBuffer> {
|
|
511
|
+
let params: { text: string, size?: number, margin?: number, download?: boolean };
|
|
512
|
+
|
|
513
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
514
|
+
params = (paramsOrFirst || {}) as { text: string, size?: number, margin?: number, download?: boolean };
|
|
515
|
+
} else {
|
|
516
|
+
params = {
|
|
517
|
+
text: paramsOrFirst as string,
|
|
518
|
+
size: rest[0] as number,
|
|
519
|
+
margin: rest[1] as number,
|
|
520
|
+
download: rest[2] as boolean
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const text = params.text;
|
|
525
|
+
const size = params.size;
|
|
526
|
+
const margin = params.margin;
|
|
527
|
+
const download = params.download;
|
|
528
|
+
|
|
320
529
|
if (typeof text === 'undefined') {
|
|
321
530
|
throw new AppwriteException('Missing required parameter: "text"');
|
|
322
531
|
}
|