node-appwrite 15.0.0 → 15.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +7 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +7 -4
- package/dist/client.mjs.map +1 -1
- package/dist/models.d.mts +2 -2
- package/dist/models.d.ts +2 -2
- package/dist/services/account.d.mts +0 -86
- package/dist/services/account.d.ts +0 -86
- package/dist/services/account.js +86 -172
- package/dist/services/account.js.map +1 -1
- package/dist/services/account.mjs +86 -172
- package/dist/services/account.mjs.map +1 -1
- package/dist/services/avatars.d.mts +0 -14
- package/dist/services/avatars.d.ts +0 -14
- package/dist/services/avatars.js +14 -28
- package/dist/services/avatars.js.map +1 -1
- package/dist/services/avatars.mjs +14 -28
- package/dist/services/avatars.mjs.map +1 -1
- package/dist/services/databases.d.mts +0 -84
- package/dist/services/databases.d.ts +0 -84
- package/dist/services/databases.js +84 -168
- package/dist/services/databases.js.map +1 -1
- package/dist/services/databases.mjs +84 -168
- package/dist/services/databases.mjs.map +1 -1
- package/dist/services/functions.d.mts +0 -48
- package/dist/services/functions.d.ts +0 -48
- package/dist/services/functions.js +48 -96
- package/dist/services/functions.js.map +1 -1
- package/dist/services/functions.mjs +48 -96
- package/dist/services/functions.mjs.map +1 -1
- package/dist/services/graphql.d.mts +0 -4
- package/dist/services/graphql.d.ts +0 -4
- package/dist/services/graphql.js +4 -8
- package/dist/services/graphql.js.map +1 -1
- package/dist/services/graphql.mjs +4 -8
- package/dist/services/graphql.mjs.map +1 -1
- package/dist/services/health.d.mts +0 -46
- package/dist/services/health.d.ts +0 -46
- package/dist/services/health.js +46 -92
- package/dist/services/health.js.map +1 -1
- package/dist/services/health.mjs +46 -92
- package/dist/services/health.mjs.map +1 -1
- package/dist/services/locale.d.mts +0 -16
- package/dist/services/locale.d.ts +0 -16
- package/dist/services/locale.js +16 -32
- package/dist/services/locale.js.map +1 -1
- package/dist/services/locale.mjs +16 -32
- package/dist/services/locale.mjs.map +1 -1
- package/dist/services/messaging.d.mts +3 -95
- package/dist/services/messaging.d.ts +3 -95
- package/dist/services/messaging.js +95 -187
- package/dist/services/messaging.js.map +1 -1
- package/dist/services/messaging.mjs +95 -187
- package/dist/services/messaging.mjs.map +1 -1
- package/dist/services/storage.d.mts +0 -26
- package/dist/services/storage.d.ts +0 -26
- package/dist/services/storage.js +26 -52
- package/dist/services/storage.js.map +1 -1
- package/dist/services/storage.mjs +26 -52
- package/dist/services/storage.mjs.map +1 -1
- package/dist/services/teams.d.mts +0 -26
- package/dist/services/teams.d.ts +0 -26
- package/dist/services/teams.js +26 -52
- package/dist/services/teams.js.map +1 -1
- package/dist/services/teams.mjs +26 -52
- package/dist/services/teams.mjs.map +1 -1
- package/dist/services/users.d.mts +0 -84
- package/dist/services/users.d.ts +0 -84
- package/dist/services/users.js +84 -168
- package/dist/services/users.js.map +1 -1
- package/dist/services/users.mjs +84 -168
- package/dist/services/users.mjs.map +1 -1
- package/package.json +1 -1
package/dist/services/avatars.js
CHANGED
|
@@ -7,8 +7,6 @@ class Avatars {
|
|
|
7
7
|
this.client = client;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Get browser icon
|
|
11
|
-
*
|
|
12
10
|
* 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.
|
|
13
11
|
|
|
14
12
|
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.
|
|
@@ -20,7 +18,7 @@ class Avatars {
|
|
|
20
18
|
* @throws {AppwriteException}
|
|
21
19
|
* @returns {Promise<ArrayBuffer>}
|
|
22
20
|
*/
|
|
23
|
-
|
|
21
|
+
getBrowser(code, width, height, quality) {
|
|
24
22
|
if (typeof code === "undefined") {
|
|
25
23
|
throw new client.AppwriteException('Missing required parameter: "code"');
|
|
26
24
|
}
|
|
@@ -39,7 +37,7 @@ class Avatars {
|
|
|
39
37
|
const apiHeaders = {
|
|
40
38
|
"content-type": "application/json"
|
|
41
39
|
};
|
|
42
|
-
return
|
|
40
|
+
return this.client.call(
|
|
43
41
|
"get",
|
|
44
42
|
uri,
|
|
45
43
|
apiHeaders,
|
|
@@ -48,8 +46,6 @@ class Avatars {
|
|
|
48
46
|
);
|
|
49
47
|
}
|
|
50
48
|
/**
|
|
51
|
-
* Get credit card icon
|
|
52
|
-
*
|
|
53
49
|
* 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.
|
|
54
50
|
|
|
55
51
|
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.
|
|
@@ -62,7 +58,7 @@ class Avatars {
|
|
|
62
58
|
* @throws {AppwriteException}
|
|
63
59
|
* @returns {Promise<ArrayBuffer>}
|
|
64
60
|
*/
|
|
65
|
-
|
|
61
|
+
getCreditCard(code, width, height, quality) {
|
|
66
62
|
if (typeof code === "undefined") {
|
|
67
63
|
throw new client.AppwriteException('Missing required parameter: "code"');
|
|
68
64
|
}
|
|
@@ -81,7 +77,7 @@ class Avatars {
|
|
|
81
77
|
const apiHeaders = {
|
|
82
78
|
"content-type": "application/json"
|
|
83
79
|
};
|
|
84
|
-
return
|
|
80
|
+
return this.client.call(
|
|
85
81
|
"get",
|
|
86
82
|
uri,
|
|
87
83
|
apiHeaders,
|
|
@@ -90,8 +86,6 @@ class Avatars {
|
|
|
90
86
|
);
|
|
91
87
|
}
|
|
92
88
|
/**
|
|
93
|
-
* Get favicon
|
|
94
|
-
*
|
|
95
89
|
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
|
|
96
90
|
|
|
97
91
|
This endpoint does not follow HTTP redirects.
|
|
@@ -100,7 +94,7 @@ class Avatars {
|
|
|
100
94
|
* @throws {AppwriteException}
|
|
101
95
|
* @returns {Promise<ArrayBuffer>}
|
|
102
96
|
*/
|
|
103
|
-
|
|
97
|
+
getFavicon(url) {
|
|
104
98
|
if (typeof url === "undefined") {
|
|
105
99
|
throw new client.AppwriteException('Missing required parameter: "url"');
|
|
106
100
|
}
|
|
@@ -113,7 +107,7 @@ class Avatars {
|
|
|
113
107
|
const apiHeaders = {
|
|
114
108
|
"content-type": "application/json"
|
|
115
109
|
};
|
|
116
|
-
return
|
|
110
|
+
return this.client.call(
|
|
117
111
|
"get",
|
|
118
112
|
uri,
|
|
119
113
|
apiHeaders,
|
|
@@ -122,8 +116,6 @@ class Avatars {
|
|
|
122
116
|
);
|
|
123
117
|
}
|
|
124
118
|
/**
|
|
125
|
-
* Get country flag
|
|
126
|
-
*
|
|
127
119
|
* 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.
|
|
128
120
|
|
|
129
121
|
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.
|
|
@@ -136,7 +128,7 @@ class Avatars {
|
|
|
136
128
|
* @throws {AppwriteException}
|
|
137
129
|
* @returns {Promise<ArrayBuffer>}
|
|
138
130
|
*/
|
|
139
|
-
|
|
131
|
+
getFlag(code, width, height, quality) {
|
|
140
132
|
if (typeof code === "undefined") {
|
|
141
133
|
throw new client.AppwriteException('Missing required parameter: "code"');
|
|
142
134
|
}
|
|
@@ -155,7 +147,7 @@ class Avatars {
|
|
|
155
147
|
const apiHeaders = {
|
|
156
148
|
"content-type": "application/json"
|
|
157
149
|
};
|
|
158
|
-
return
|
|
150
|
+
return this.client.call(
|
|
159
151
|
"get",
|
|
160
152
|
uri,
|
|
161
153
|
apiHeaders,
|
|
@@ -164,8 +156,6 @@ class Avatars {
|
|
|
164
156
|
);
|
|
165
157
|
}
|
|
166
158
|
/**
|
|
167
|
-
* Get image from URL
|
|
168
|
-
*
|
|
169
159
|
* 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.
|
|
170
160
|
|
|
171
161
|
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.
|
|
@@ -178,7 +168,7 @@ class Avatars {
|
|
|
178
168
|
* @throws {AppwriteException}
|
|
179
169
|
* @returns {Promise<ArrayBuffer>}
|
|
180
170
|
*/
|
|
181
|
-
|
|
171
|
+
getImage(url, width, height) {
|
|
182
172
|
if (typeof url === "undefined") {
|
|
183
173
|
throw new client.AppwriteException('Missing required parameter: "url"');
|
|
184
174
|
}
|
|
@@ -197,7 +187,7 @@ class Avatars {
|
|
|
197
187
|
const apiHeaders = {
|
|
198
188
|
"content-type": "application/json"
|
|
199
189
|
};
|
|
200
|
-
return
|
|
190
|
+
return this.client.call(
|
|
201
191
|
"get",
|
|
202
192
|
uri,
|
|
203
193
|
apiHeaders,
|
|
@@ -206,8 +196,6 @@ class Avatars {
|
|
|
206
196
|
);
|
|
207
197
|
}
|
|
208
198
|
/**
|
|
209
|
-
* Get user initials
|
|
210
|
-
*
|
|
211
199
|
* 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.
|
|
212
200
|
|
|
213
201
|
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.
|
|
@@ -222,7 +210,7 @@ class Avatars {
|
|
|
222
210
|
* @throws {AppwriteException}
|
|
223
211
|
* @returns {Promise<ArrayBuffer>}
|
|
224
212
|
*/
|
|
225
|
-
|
|
213
|
+
getInitials(name, width, height, background) {
|
|
226
214
|
const apiPath = "/avatars/initials";
|
|
227
215
|
const payload = {};
|
|
228
216
|
if (typeof name !== "undefined") {
|
|
@@ -241,7 +229,7 @@ class Avatars {
|
|
|
241
229
|
const apiHeaders = {
|
|
242
230
|
"content-type": "application/json"
|
|
243
231
|
};
|
|
244
|
-
return
|
|
232
|
+
return this.client.call(
|
|
245
233
|
"get",
|
|
246
234
|
uri,
|
|
247
235
|
apiHeaders,
|
|
@@ -250,8 +238,6 @@ class Avatars {
|
|
|
250
238
|
);
|
|
251
239
|
}
|
|
252
240
|
/**
|
|
253
|
-
* Get QR code
|
|
254
|
-
*
|
|
255
241
|
* 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.
|
|
256
242
|
|
|
257
243
|
*
|
|
@@ -262,7 +248,7 @@ class Avatars {
|
|
|
262
248
|
* @throws {AppwriteException}
|
|
263
249
|
* @returns {Promise<ArrayBuffer>}
|
|
264
250
|
*/
|
|
265
|
-
|
|
251
|
+
getQR(text, size, margin, download) {
|
|
266
252
|
if (typeof text === "undefined") {
|
|
267
253
|
throw new client.AppwriteException('Missing required parameter: "text"');
|
|
268
254
|
}
|
|
@@ -284,7 +270,7 @@ class Avatars {
|
|
|
284
270
|
const apiHeaders = {
|
|
285
271
|
"content-type": "application/json"
|
|
286
272
|
};
|
|
287
|
-
return
|
|
273
|
+
return this.client.call(
|
|
288
274
|
"get",
|
|
289
275
|
uri,
|
|
290
276
|
apiHeaders,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/avatars.ts"],"names":[],"mappings":"AAAA,SAAS,yBAA+D;AAMjE,MAAM,QAAQ;AAAA,EAGjB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAM,WAAW,MAAe,OAAgB,QAAiB,SAAwC;AACrG,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBA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AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,MAAM,KAAK,OAAO;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,MAAM,MAAc,MAAe,QAAiB,UAA0C;AAChG,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AACA,UAAM,UAAU;AAChB,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,QAAI,OAAO,aAAa,aAAa;AACjC,cAAQ,UAAU,IAAI;AAAA,IAC1B;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,MAAM,KAAK,OAAO;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\nimport { Browser } from '../enums/browser';\nimport { CreditCard } from '../enums/credit-card';\nimport { Flag } from '../enums/flag';\n\nexport class Avatars {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Get browser icon\n *\n * 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.\n\nWhen 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.\n *\n * @param {Browser} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get credit card icon\n *\n * 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.\n\nWhen 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.\n\n *\n * @param {CreditCard} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get favicon\n *\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getFavicon(url: string): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/favicon';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get country flag\n *\n * 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.\n\nWhen 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.\n\n *\n * @param {Flag} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/flags/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get image from URL\n *\n * 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.\n\nWhen 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.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @param {number} width\n * @param {number} height\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/image';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get user initials\n *\n * 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.\n\nYou 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.\n\nWhen 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.\n\n *\n * @param {string} name\n * @param {number} width\n * @param {number} height\n * @param {string} background\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer> {\n const apiPath = '/avatars/initials';\n const payload: Payload = {};\n if (typeof name !== 'undefined') {\n payload['name'] = name;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof background !== 'undefined') {\n payload['background'] = background;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get QR code\n *\n * 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.\n\n *\n * @param {string} text\n * @param {number} size\n * @param {number} margin\n * @param {boolean} download\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer> {\n if (typeof text === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"text\"');\n }\n const apiPath = '/avatars/qr';\n const payload: Payload = {};\n if (typeof text !== 'undefined') {\n payload['text'] = text;\n }\n if (typeof size !== 'undefined') {\n payload['size'] = size;\n }\n if (typeof margin !== 'undefined') {\n payload['margin'] = margin;\n }\n if (typeof download !== 'undefined') {\n payload['download'] = download;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/services/avatars.ts"],"names":[],"mappings":"AAAA,SAAS,yBAA+D;AAMjE,MAAM,QAAQ;AAAA,EAGjB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,WAAW,MAAe,OAAgB,QAAiB,SAAwC;AA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AA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,MAAc,MAAe,QAAiB,UAA0C;AAC1F,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AACA,UAAM,UAAU;AAChB,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,QAAI,OAAO,aAAa,aAAa;AACjC,cAAQ,UAAU,IAAI;AAAA,IAC1B;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\nimport { Browser } from '../enums/browser';\nimport { CreditCard } from '../enums/credit-card';\nimport { Flag } from '../enums/flag';\n\nexport class Avatars {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * 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.\n\nWhen 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.\n *\n * @param {Browser} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nWhen 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.\n\n *\n * @param {CreditCard} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getFavicon(url: string): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/favicon';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nWhen 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.\n\n *\n * @param {Flag} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/flags/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nWhen 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.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @param {number} width\n * @param {number} height\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/image';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nYou 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.\n\nWhen 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.\n\n *\n * @param {string} name\n * @param {number} width\n * @param {number} height\n * @param {string} background\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer> {\n const apiPath = '/avatars/initials';\n const payload: Payload = {};\n if (typeof name !== 'undefined') {\n payload['name'] = name;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof background !== 'undefined') {\n payload['background'] = background;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\n *\n * @param {string} text\n * @param {number} size\n * @param {number} margin\n * @param {boolean} download\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer> {\n if (typeof text === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"text\"');\n }\n const apiPath = '/avatars/qr';\n const payload: Payload = {};\n if (typeof text !== 'undefined') {\n payload['text'] = text;\n }\n if (typeof size !== 'undefined') {\n payload['size'] = size;\n }\n if (typeof margin !== 'undefined') {\n payload['margin'] = margin;\n }\n if (typeof download !== 'undefined') {\n payload['download'] = download;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n}\n"]}
|
|
@@ -6,8 +6,6 @@ var Avatars = class {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get browser icon
|
|
10
|
-
*
|
|
11
9
|
* 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.
|
|
12
10
|
|
|
13
11
|
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.
|
|
@@ -19,7 +17,7 @@ var Avatars = class {
|
|
|
19
17
|
* @throws {AppwriteException}
|
|
20
18
|
* @returns {Promise<ArrayBuffer>}
|
|
21
19
|
*/
|
|
22
|
-
|
|
20
|
+
getBrowser(code, width, height, quality) {
|
|
23
21
|
if (typeof code === "undefined") {
|
|
24
22
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
25
23
|
}
|
|
@@ -38,7 +36,7 @@ var Avatars = class {
|
|
|
38
36
|
const apiHeaders = {
|
|
39
37
|
"content-type": "application/json"
|
|
40
38
|
};
|
|
41
|
-
return
|
|
39
|
+
return this.client.call(
|
|
42
40
|
"get",
|
|
43
41
|
uri,
|
|
44
42
|
apiHeaders,
|
|
@@ -47,8 +45,6 @@ var Avatars = class {
|
|
|
47
45
|
);
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
50
|
-
* Get credit card icon
|
|
51
|
-
*
|
|
52
48
|
* 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.
|
|
53
49
|
|
|
54
50
|
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.
|
|
@@ -61,7 +57,7 @@ var Avatars = class {
|
|
|
61
57
|
* @throws {AppwriteException}
|
|
62
58
|
* @returns {Promise<ArrayBuffer>}
|
|
63
59
|
*/
|
|
64
|
-
|
|
60
|
+
getCreditCard(code, width, height, quality) {
|
|
65
61
|
if (typeof code === "undefined") {
|
|
66
62
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
67
63
|
}
|
|
@@ -80,7 +76,7 @@ var Avatars = class {
|
|
|
80
76
|
const apiHeaders = {
|
|
81
77
|
"content-type": "application/json"
|
|
82
78
|
};
|
|
83
|
-
return
|
|
79
|
+
return this.client.call(
|
|
84
80
|
"get",
|
|
85
81
|
uri,
|
|
86
82
|
apiHeaders,
|
|
@@ -89,8 +85,6 @@ var Avatars = class {
|
|
|
89
85
|
);
|
|
90
86
|
}
|
|
91
87
|
/**
|
|
92
|
-
* Get favicon
|
|
93
|
-
*
|
|
94
88
|
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
|
|
95
89
|
|
|
96
90
|
This endpoint does not follow HTTP redirects.
|
|
@@ -99,7 +93,7 @@ var Avatars = class {
|
|
|
99
93
|
* @throws {AppwriteException}
|
|
100
94
|
* @returns {Promise<ArrayBuffer>}
|
|
101
95
|
*/
|
|
102
|
-
|
|
96
|
+
getFavicon(url) {
|
|
103
97
|
if (typeof url === "undefined") {
|
|
104
98
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
105
99
|
}
|
|
@@ -112,7 +106,7 @@ var Avatars = class {
|
|
|
112
106
|
const apiHeaders = {
|
|
113
107
|
"content-type": "application/json"
|
|
114
108
|
};
|
|
115
|
-
return
|
|
109
|
+
return this.client.call(
|
|
116
110
|
"get",
|
|
117
111
|
uri,
|
|
118
112
|
apiHeaders,
|
|
@@ -121,8 +115,6 @@ var Avatars = class {
|
|
|
121
115
|
);
|
|
122
116
|
}
|
|
123
117
|
/**
|
|
124
|
-
* Get country flag
|
|
125
|
-
*
|
|
126
118
|
* 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.
|
|
127
119
|
|
|
128
120
|
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.
|
|
@@ -135,7 +127,7 @@ var Avatars = class {
|
|
|
135
127
|
* @throws {AppwriteException}
|
|
136
128
|
* @returns {Promise<ArrayBuffer>}
|
|
137
129
|
*/
|
|
138
|
-
|
|
130
|
+
getFlag(code, width, height, quality) {
|
|
139
131
|
if (typeof code === "undefined") {
|
|
140
132
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
141
133
|
}
|
|
@@ -154,7 +146,7 @@ var Avatars = class {
|
|
|
154
146
|
const apiHeaders = {
|
|
155
147
|
"content-type": "application/json"
|
|
156
148
|
};
|
|
157
|
-
return
|
|
149
|
+
return this.client.call(
|
|
158
150
|
"get",
|
|
159
151
|
uri,
|
|
160
152
|
apiHeaders,
|
|
@@ -163,8 +155,6 @@ var Avatars = class {
|
|
|
163
155
|
);
|
|
164
156
|
}
|
|
165
157
|
/**
|
|
166
|
-
* Get image from URL
|
|
167
|
-
*
|
|
168
158
|
* 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.
|
|
169
159
|
|
|
170
160
|
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.
|
|
@@ -177,7 +167,7 @@ var Avatars = class {
|
|
|
177
167
|
* @throws {AppwriteException}
|
|
178
168
|
* @returns {Promise<ArrayBuffer>}
|
|
179
169
|
*/
|
|
180
|
-
|
|
170
|
+
getImage(url, width, height) {
|
|
181
171
|
if (typeof url === "undefined") {
|
|
182
172
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
183
173
|
}
|
|
@@ -196,7 +186,7 @@ var Avatars = class {
|
|
|
196
186
|
const apiHeaders = {
|
|
197
187
|
"content-type": "application/json"
|
|
198
188
|
};
|
|
199
|
-
return
|
|
189
|
+
return this.client.call(
|
|
200
190
|
"get",
|
|
201
191
|
uri,
|
|
202
192
|
apiHeaders,
|
|
@@ -205,8 +195,6 @@ var Avatars = class {
|
|
|
205
195
|
);
|
|
206
196
|
}
|
|
207
197
|
/**
|
|
208
|
-
* Get user initials
|
|
209
|
-
*
|
|
210
198
|
* 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.
|
|
211
199
|
|
|
212
200
|
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.
|
|
@@ -221,7 +209,7 @@ var Avatars = class {
|
|
|
221
209
|
* @throws {AppwriteException}
|
|
222
210
|
* @returns {Promise<ArrayBuffer>}
|
|
223
211
|
*/
|
|
224
|
-
|
|
212
|
+
getInitials(name, width, height, background) {
|
|
225
213
|
const apiPath = "/avatars/initials";
|
|
226
214
|
const payload = {};
|
|
227
215
|
if (typeof name !== "undefined") {
|
|
@@ -240,7 +228,7 @@ var Avatars = class {
|
|
|
240
228
|
const apiHeaders = {
|
|
241
229
|
"content-type": "application/json"
|
|
242
230
|
};
|
|
243
|
-
return
|
|
231
|
+
return this.client.call(
|
|
244
232
|
"get",
|
|
245
233
|
uri,
|
|
246
234
|
apiHeaders,
|
|
@@ -249,8 +237,6 @@ var Avatars = class {
|
|
|
249
237
|
);
|
|
250
238
|
}
|
|
251
239
|
/**
|
|
252
|
-
* Get QR code
|
|
253
|
-
*
|
|
254
240
|
* 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.
|
|
255
241
|
|
|
256
242
|
*
|
|
@@ -261,7 +247,7 @@ var Avatars = class {
|
|
|
261
247
|
* @throws {AppwriteException}
|
|
262
248
|
* @returns {Promise<ArrayBuffer>}
|
|
263
249
|
*/
|
|
264
|
-
|
|
250
|
+
getQR(text, size, margin, download) {
|
|
265
251
|
if (typeof text === "undefined") {
|
|
266
252
|
throw new AppwriteException('Missing required parameter: "text"');
|
|
267
253
|
}
|
|
@@ -283,7 +269,7 @@ var Avatars = class {
|
|
|
283
269
|
const apiHeaders = {
|
|
284
270
|
"content-type": "application/json"
|
|
285
271
|
};
|
|
286
|
-
return
|
|
272
|
+
return this.client.call(
|
|
287
273
|
"get",
|
|
288
274
|
uri,
|
|
289
275
|
apiHeaders,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/avatars.ts"],"names":[],"mappings":";AAAA,SAAS,yBAA+D;AAMjE,IAAM,UAAN,MAAc;AAAA,EAGjB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,QAAI,OAAO,eAAe,aAAa;AACnC,cAAQ,YAAY,IAAI;AAAA,IAC5B;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,MAAM,KAAK,OAAO;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,MAAM,MAAc,MAAe,QAAiB,UAA0C;AAChG,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AACA,UAAM,UAAU;AAChB,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,QAAI,OAAO,aAAa,aAAa;AACjC,cAAQ,UAAU,IAAI;AAAA,IAC1B;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,MAAM,KAAK,OAAO;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\nimport { Browser } from '../enums/browser';\nimport { CreditCard } from '../enums/credit-card';\nimport { Flag } from '../enums/flag';\n\nexport class Avatars {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Get browser icon\n *\n * 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.\n\nWhen 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.\n *\n * @param {Browser} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get credit card icon\n *\n * 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.\n\nWhen 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.\n\n *\n * @param {CreditCard} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get favicon\n *\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getFavicon(url: string): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/favicon';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get country flag\n *\n * 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.\n\nWhen 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.\n\n *\n * @param {Flag} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/flags/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get image from URL\n *\n * 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.\n\nWhen 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.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @param {number} width\n * @param {number} height\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/image';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get user initials\n *\n * 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.\n\nYou 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.\n\nWhen 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.\n\n *\n * @param {string} name\n * @param {number} width\n * @param {number} height\n * @param {string} background\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer> {\n const apiPath = '/avatars/initials';\n const payload: Payload = {};\n if (typeof name !== 'undefined') {\n payload['name'] = name;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof background !== 'undefined') {\n payload['background'] = background;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Get QR code\n *\n * 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.\n\n *\n * @param {string} text\n * @param {number} size\n * @param {number} margin\n * @param {boolean} download\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n async getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer> {\n if (typeof text === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"text\"');\n }\n const apiPath = '/avatars/qr';\n const payload: Payload = {};\n if (typeof text !== 'undefined') {\n payload['text'] = text;\n }\n if (typeof size !== 'undefined') {\n payload['size'] = size;\n }\n if (typeof margin !== 'undefined') {\n payload['margin'] = margin;\n }\n if (typeof download !== 'undefined') {\n payload['download'] = download;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return await this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/services/avatars.ts"],"names":[],"mappings":";AAAA,SAAS,yBAA+D;AAMjE,IAAM,UAAN,MAAc;AAAA,EAGjB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA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AAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,MAAc,MAAe,QAAiB,UAA0C;AAC1F,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AACA,UAAM,UAAU;AAChB,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,SAAS,aAAa;AAC7B,cAAQ,MAAM,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,QAAI,OAAO,aAAa,aAAa;AACjC,cAAQ,UAAU,IAAI;AAAA,IAC1B;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\nimport { Browser } from '../enums/browser';\nimport { CreditCard } from '../enums/credit-card';\nimport { Flag } from '../enums/flag';\n\nexport class Avatars {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * 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.\n\nWhen 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.\n *\n * @param {Browser} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nWhen 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.\n\n *\n * @param {CreditCard} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getFavicon(url: string): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/favicon';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nWhen 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.\n\n *\n * @param {Flag} code\n * @param {number} width\n * @param {number} height\n * @param {number} quality\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\n const apiPath = '/avatars/flags/{code}'.replace('{code}', code);\n const payload: Payload = {};\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof quality !== 'undefined') {\n payload['quality'] = quality;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nWhen 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.\n\nThis endpoint does not follow HTTP redirects.\n *\n * @param {string} url\n * @param {number} width\n * @param {number} height\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer> {\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\n const apiPath = '/avatars/image';\n const payload: Payload = {};\n if (typeof url !== 'undefined') {\n payload['url'] = url;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\nYou 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.\n\nWhen 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.\n\n *\n * @param {string} name\n * @param {number} width\n * @param {number} height\n * @param {string} background\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer> {\n const apiPath = '/avatars/initials';\n const payload: Payload = {};\n if (typeof name !== 'undefined') {\n payload['name'] = name;\n }\n if (typeof width !== 'undefined') {\n payload['width'] = width;\n }\n if (typeof height !== 'undefined') {\n payload['height'] = height;\n }\n if (typeof background !== 'undefined') {\n payload['background'] = background;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n /**\n * 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.\n\n *\n * @param {string} text\n * @param {number} size\n * @param {number} margin\n * @param {boolean} download\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer> {\n if (typeof text === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"text\"');\n }\n const apiPath = '/avatars/qr';\n const payload: Payload = {};\n if (typeof text !== 'undefined') {\n payload['text'] = text;\n }\n if (typeof size !== 'undefined') {\n payload['size'] = size;\n }\n if (typeof margin !== 'undefined') {\n payload['margin'] = margin;\n }\n if (typeof download !== 'undefined') {\n payload['download'] = download;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n}\n"]}
|