node-appwrite 17.2.0 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +67 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/credit-card.d.mts +1 -1
  7. package/dist/enums/credit-card.d.ts +1 -1
  8. package/dist/enums/credit-card.js +1 -1
  9. package/dist/enums/credit-card.js.map +1 -1
  10. package/dist/enums/credit-card.mjs +1 -1
  11. package/dist/enums/credit-card.mjs.map +1 -1
  12. package/dist/enums/execution-method.d.mts +2 -1
  13. package/dist/enums/execution-method.d.ts +2 -1
  14. package/dist/enums/execution-method.js +1 -0
  15. package/dist/enums/execution-method.js.map +1 -1
  16. package/dist/enums/execution-method.mjs +1 -0
  17. package/dist/enums/execution-method.mjs.map +1 -1
  18. package/dist/enums/index-type.d.mts +2 -1
  19. package/dist/enums/index-type.d.ts +2 -1
  20. package/dist/enums/index-type.js +1 -0
  21. package/dist/enums/index-type.js.map +1 -1
  22. package/dist/enums/index-type.mjs +1 -0
  23. package/dist/enums/index-type.mjs.map +1 -1
  24. package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
  25. package/dist/enums/vcs-deployment-type.js.map +1 -0
  26. package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
  27. package/dist/enums/vcs-deployment-type.mjs.map +1 -0
  28. package/dist/index.d.mts +2 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +7 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +2 -1
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/models.d.mts +1058 -153
  35. package/dist/models.d.ts +1058 -153
  36. package/dist/query.d.mts +196 -6
  37. package/dist/query.d.ts +196 -6
  38. package/dist/query.js +192 -2
  39. package/dist/query.js.map +1 -1
  40. package/dist/query.mjs +192 -2
  41. package/dist/query.mjs.map +1 -1
  42. package/dist/services/account.d.mts +625 -70
  43. package/dist/services/account.d.ts +625 -70
  44. package/dist/services/account.js +592 -292
  45. package/dist/services/account.js.map +1 -1
  46. package/dist/services/account.mjs +592 -292
  47. package/dist/services/account.mjs.map +1 -1
  48. package/dist/services/avatars.d.mts +157 -26
  49. package/dist/services/avatars.d.ts +157 -26
  50. package/dist/services/avatars.js +104 -93
  51. package/dist/services/avatars.js.map +1 -1
  52. package/dist/services/avatars.mjs +104 -93
  53. package/dist/services/avatars.mjs.map +1 -1
  54. package/dist/services/databases.d.mts +1425 -248
  55. package/dist/services/databases.d.ts +1425 -248
  56. package/dist/services/databases.js +1186 -611
  57. package/dist/services/databases.js.map +1 -1
  58. package/dist/services/databases.mjs +1186 -611
  59. package/dist/services/databases.mjs.map +1 -1
  60. package/dist/services/functions.d.mts +530 -107
  61. package/dist/services/functions.d.ts +530 -107
  62. package/dist/services/functions.js +393 -276
  63. package/dist/services/functions.js.map +1 -1
  64. package/dist/services/functions.mjs +393 -276
  65. package/dist/services/functions.mjs.map +1 -1
  66. package/dist/services/graphql.d.mts +24 -2
  67. package/dist/services/graphql.d.ts +24 -2
  68. package/dist/services/graphql.js +20 -16
  69. package/dist/services/graphql.js.map +1 -1
  70. package/dist/services/graphql.mjs +20 -16
  71. package/dist/services/graphql.mjs.map +1 -1
  72. package/dist/services/health.d.mts +175 -16
  73. package/dist/services/health.d.ts +175 -16
  74. package/dist/services/health.js +144 -115
  75. package/dist/services/health.js.map +1 -1
  76. package/dist/services/health.mjs +144 -115
  77. package/dist/services/health.mjs.map +1 -1
  78. package/dist/services/locale.js.map +1 -1
  79. package/dist/services/locale.mjs.map +1 -1
  80. package/dist/services/messaging.d.mts +1544 -262
  81. package/dist/services/messaging.d.ts +1544 -262
  82. package/dist/services/messaging.js +1417 -592
  83. package/dist/services/messaging.js.map +1 -1
  84. package/dist/services/messaging.mjs +1417 -592
  85. package/dist/services/messaging.mjs.map +1 -1
  86. package/dist/services/sites.d.mts +495 -99
  87. package/dist/services/sites.d.ts +495 -99
  88. package/dist/services/sites.js +371 -258
  89. package/dist/services/sites.js.map +1 -1
  90. package/dist/services/sites.mjs +371 -258
  91. package/dist/services/sites.mjs.map +1 -1
  92. package/dist/services/storage.d.mts +306 -63
  93. package/dist/services/storage.d.ts +306 -63
  94. package/dist/services/storage.js +225 -158
  95. package/dist/services/storage.js.map +1 -1
  96. package/dist/services/storage.mjs +225 -158
  97. package/dist/services/storage.mjs.map +1 -1
  98. package/dist/services/tables-db.d.mts +1744 -0
  99. package/dist/services/tables-db.d.ts +1744 -0
  100. package/dist/services/tables-db.js +2692 -0
  101. package/dist/services/tables-db.js.map +1 -0
  102. package/dist/services/tables-db.mjs +2691 -0
  103. package/dist/services/tables-db.mjs.map +1 -0
  104. package/dist/services/teams.d.mts +233 -39
  105. package/dist/services/teams.d.ts +233 -39
  106. package/dist/services/teams.js +170 -135
  107. package/dist/services/teams.js.map +1 -1
  108. package/dist/services/teams.mjs +170 -135
  109. package/dist/services/teams.mjs.map +1 -1
  110. package/dist/services/tokens.d.mts +76 -11
  111. package/dist/services/tokens.d.ts +76 -11
  112. package/dist/services/tokens.js +60 -45
  113. package/dist/services/tokens.js.map +1 -1
  114. package/dist/services/tokens.mjs +60 -45
  115. package/dist/services/tokens.mjs.map +1 -1
  116. package/dist/services/users.d.mts +842 -115
  117. package/dist/services/users.d.ts +842 -115
  118. package/dist/services/users.js +719 -408
  119. package/dist/services/users.js.map +1 -1
  120. package/dist/services/users.mjs +719 -408
  121. package/dist/services/users.mjs.map +1 -1
  122. package/package.json +1 -1
  123. package/dist/enums/v-c-s-deployment-type.js.map +0 -1
  124. package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
  125. /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
  126. /package/dist/enums/{v-c-s-deployment-type.d.ts → vcs-deployment-type.d.ts} +0 -0
@@ -6,19 +6,22 @@ class Avatars {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
  }
9
- /**
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.
11
- *
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.
13
- *
14
- * @param {Browser} code
15
- * @param {number} width
16
- * @param {number} height
17
- * @param {number} quality
18
- * @throws {AppwriteException}
19
- * @returns {Promise<ArrayBuffer>}
20
- */
21
- getBrowser(code, width, height, quality) {
9
+ getBrowser(paramsOrFirst, ...rest) {
10
+ let params;
11
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
12
+ params = paramsOrFirst || {};
13
+ } else {
14
+ params = {
15
+ code: paramsOrFirst,
16
+ width: rest[0],
17
+ height: rest[1],
18
+ quality: rest[2]
19
+ };
20
+ }
21
+ const code = params.code;
22
+ const width = params.width;
23
+ const height = params.height;
24
+ const quality = params.quality;
22
25
  if (typeof code === "undefined") {
23
26
  throw new client.AppwriteException('Missing required parameter: "code"');
24
27
  }
@@ -43,20 +46,22 @@ class Avatars {
43
46
  "arrayBuffer"
44
47
  );
45
48
  }
46
- /**
47
- * 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.
48
- *
49
- * 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.
50
- *
51
- *
52
- * @param {CreditCard} code
53
- * @param {number} width
54
- * @param {number} height
55
- * @param {number} quality
56
- * @throws {AppwriteException}
57
- * @returns {Promise<ArrayBuffer>}
58
- */
59
- getCreditCard(code, width, height, quality) {
49
+ getCreditCard(paramsOrFirst, ...rest) {
50
+ let params;
51
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
52
+ params = paramsOrFirst || {};
53
+ } else {
54
+ params = {
55
+ code: paramsOrFirst,
56
+ width: rest[0],
57
+ height: rest[1],
58
+ quality: rest[2]
59
+ };
60
+ }
61
+ const code = params.code;
62
+ const width = params.width;
63
+ const height = params.height;
64
+ const quality = params.quality;
60
65
  if (typeof code === "undefined") {
61
66
  throw new client.AppwriteException('Missing required parameter: "code"');
62
67
  }
@@ -81,16 +86,16 @@ class Avatars {
81
86
  "arrayBuffer"
82
87
  );
83
88
  }
84
- /**
85
- * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
86
- *
87
- * This endpoint does not follow HTTP redirects.
88
- *
89
- * @param {string} url
90
- * @throws {AppwriteException}
91
- * @returns {Promise<ArrayBuffer>}
92
- */
93
- getFavicon(url) {
89
+ getFavicon(paramsOrFirst) {
90
+ let params;
91
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
92
+ params = paramsOrFirst || {};
93
+ } else {
94
+ params = {
95
+ url: paramsOrFirst
96
+ };
97
+ }
98
+ const url = params.url;
94
99
  if (typeof url === "undefined") {
95
100
  throw new client.AppwriteException('Missing required parameter: "url"');
96
101
  }
@@ -109,20 +114,22 @@ class Avatars {
109
114
  "arrayBuffer"
110
115
  );
111
116
  }
112
- /**
113
- * 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.
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 {Flag} code
119
- * @param {number} width
120
- * @param {number} height
121
- * @param {number} quality
122
- * @throws {AppwriteException}
123
- * @returns {Promise<ArrayBuffer>}
124
- */
125
- getFlag(code, width, height, quality) {
117
+ getFlag(paramsOrFirst, ...rest) {
118
+ let params;
119
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
120
+ params = paramsOrFirst || {};
121
+ } else {
122
+ params = {
123
+ code: paramsOrFirst,
124
+ width: rest[0],
125
+ height: rest[1],
126
+ quality: rest[2]
127
+ };
128
+ }
129
+ const code = params.code;
130
+ const width = params.width;
131
+ const height = params.height;
132
+ const quality = params.quality;
126
133
  if (typeof code === "undefined") {
127
134
  throw new client.AppwriteException('Missing required parameter: "code"');
128
135
  }
@@ -147,20 +154,20 @@ class Avatars {
147
154
  "arrayBuffer"
148
155
  );
149
156
  }
150
- /**
151
- * 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.
152
- *
153
- * 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.
154
- *
155
- * This endpoint does not follow HTTP redirects.
156
- *
157
- * @param {string} url
158
- * @param {number} width
159
- * @param {number} height
160
- * @throws {AppwriteException}
161
- * @returns {Promise<ArrayBuffer>}
162
- */
163
- getImage(url, width, height) {
157
+ getImage(paramsOrFirst, ...rest) {
158
+ let params;
159
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
160
+ params = paramsOrFirst || {};
161
+ } else {
162
+ params = {
163
+ url: paramsOrFirst,
164
+ width: rest[0],
165
+ height: rest[1]
166
+ };
167
+ }
168
+ const url = params.url;
169
+ const width = params.width;
170
+ const height = params.height;
164
171
  if (typeof url === "undefined") {
165
172
  throw new client.AppwriteException('Missing required parameter: "url"');
166
173
  }
@@ -185,22 +192,22 @@ class Avatars {
185
192
  "arrayBuffer"
186
193
  );
187
194
  }
188
- /**
189
- * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
190
- *
191
- * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
192
- *
193
- * 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.
194
- *
195
- *
196
- * @param {string} name
197
- * @param {number} width
198
- * @param {number} height
199
- * @param {string} background
200
- * @throws {AppwriteException}
201
- * @returns {Promise<ArrayBuffer>}
202
- */
203
- getInitials(name, width, height, background) {
195
+ getInitials(paramsOrFirst, ...rest) {
196
+ let params;
197
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
198
+ params = paramsOrFirst || {};
199
+ } else {
200
+ params = {
201
+ name: paramsOrFirst,
202
+ width: rest[0],
203
+ height: rest[1],
204
+ background: rest[2]
205
+ };
206
+ }
207
+ const name = params.name;
208
+ const width = params.width;
209
+ const height = params.height;
210
+ const background = params.background;
204
211
  const apiPath = "/avatars/initials";
205
212
  const payload = {};
206
213
  if (typeof name !== "undefined") {
@@ -225,18 +232,22 @@ class Avatars {
225
232
  "arrayBuffer"
226
233
  );
227
234
  }
228
- /**
229
- * 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.
230
- *
231
- *
232
- * @param {string} text
233
- * @param {number} size
234
- * @param {number} margin
235
- * @param {boolean} download
236
- * @throws {AppwriteException}
237
- * @returns {Promise<ArrayBuffer>}
238
- */
239
- getQR(text, size, margin, download) {
235
+ getQR(paramsOrFirst, ...rest) {
236
+ let params;
237
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
238
+ params = paramsOrFirst || {};
239
+ } else {
240
+ params = {
241
+ text: paramsOrFirst,
242
+ size: rest[0],
243
+ margin: rest[1],
244
+ download: rest[2]
245
+ };
246
+ }
247
+ const text = params.text;
248
+ const size = params.size;
249
+ const margin = params.margin;
250
+ const download = params.download;
240
251
  if (typeof text === "undefined") {
241
252
  throw new client.AppwriteException('Missing required parameter: "text"');
242
253
  }
@@ -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,EAcA,WAAW,MAAe,OAAgB,QAAiB,SAAwC;AAC/F,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AACA,UAAM,UAAU,2BAA2B,QAAQ,UAAU,IAAI;AACjE,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,UAAU,aAAa;AAC9B,cAAQ,OAAO,IAAI;AAAA,IACvB;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,QAAI,OAAO,YAAY,aAAa;AAChC,cAAQ,SAAS,IAAI;AAAA,IACzB;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C,CACjD;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;AAAA;AAAA,EAeA,cAAc,MAAkB,OAAgB,QAAiB,SAAwC;AACrG,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AACA,UAAM,UAAU,+BAA+B,QAAQ,UAAU,IAAI;AACrE,UAAM,UAAmB,CAAC;AA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vB;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,QAAI,OAAO,eAAe,aAAa;AACnC,cAAQ,YAAY,IAAI;AAAA,IAC5B;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C,CACjD;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,EAaA,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,CACjD;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 * \n * 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.\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n\n /**\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n * \n * This 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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\n * \n * This 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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.\n * \n * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.\n * \n * 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.\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 }\n\n return 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;AAOjE,MAAM,QAAQ;AAAA,EAGjB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA,EA6BA,WACI,kBACG,MACiB;AACpB,QAAI;AAEJ,QAAK,iBAAiB,OAAO,kBAAkB,YAAY,CAAC,MAAM,QAAQ,aAAa,KAAK,UAAU,eAAgB;AAClH,eAAU,iBAAiB,CAAC;AAAA,IAChC,OAAO;AACH,eAAS;AAAA,QACL,MAAM;AAAA,QACN,OA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CACjD;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EA2BA,MACI,kBACG,MACiB;AACpB,QAAI;AAEJ,QAAK,iBAAiB,OAAO,kBAAkB,YAAY,CAAC,MAAM,QAAQ,aAAa,GAAI;AACvF,eAAU,iBAAiB,CAAC;AAAA,IAChC,OAAO;AACH,eAAS;AAAA,QACL,MAAM;AAAA,QACN,MAAM,KAAK,CAAC;AAAA,QACZ,QAAQ,KAAK,CAAC;AAAA,QACd,UAAU,KAAK,CAAC;AAAA,MACpB;AAAA,IACJ;AAEA,UAAM,OAAO,OAAO;AACpB,UAAM,OAAO,OAAO;AACpB,UAAM,SAAS,OAAO;AACtB,UAAM,WAAW,OAAO;AAExB,QAAI,OAAO,SAAS,aAAa;AAC7B,YAAM,IAAI,kBAAkB,oCAAoC;AAAA,IACpE;AAEA,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,CACjD;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';\n\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 * \n * 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.\n *\n * @param {Browser} params.code - Browser Code.\n * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>;\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 * \n * 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.\n *\n * @param {Browser} code - Browser Code.\n * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;\n getBrowser(\n paramsOrFirst: { code: Browser, width?: number, height?: number, quality?: number } | Browser,\n ...rest: [(number)?, (number)?, (number)?] \n ): Promise<ArrayBuffer> {\n let params: { code: Browser, width?: number, height?: number, quality?: number };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {\n params = (paramsOrFirst || {}) as { code: Browser, width?: number, height?: number, quality?: number };\n } else {\n params = {\n code: paramsOrFirst as Browser,\n width: rest[0] as number,\n height: rest[1] as number,\n quality: rest[2] as number \n };\n }\n \n const code = params.code;\n const width = params.width;\n const height = params.height;\n const quality = params.quality;\n\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\n * \n *\n * @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.\n * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>;\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 * \n * 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.\n * \n *\n * @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.\n * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;\n getCreditCard(\n paramsOrFirst: { code: CreditCard, width?: number, height?: number, quality?: number } | CreditCard,\n ...rest: [(number)?, (number)?, (number)?] \n ): Promise<ArrayBuffer> {\n let params: { code: CreditCard, width?: number, height?: number, quality?: number };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {\n params = (paramsOrFirst || {}) as { code: CreditCard, width?: number, height?: number, quality?: number };\n } else {\n params = {\n code: paramsOrFirst as CreditCard,\n width: rest[0] as number,\n height: rest[1] as number,\n quality: rest[2] as number \n };\n }\n \n const code = params.code;\n const width = params.width;\n const height = params.height;\n const quality = params.quality;\n\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n\n /**\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n * \n * This endpoint does not follow HTTP redirects.\n *\n * @param {string} params.url - Website URL which you want to fetch the favicon from.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getFavicon(params: { url: string }): Promise<ArrayBuffer>;\n /**\n * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n * \n * This endpoint does not follow HTTP redirects.\n *\n * @param {string} url - Website URL which you want to fetch the favicon from.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getFavicon(url: string): Promise<ArrayBuffer>;\n getFavicon(\n paramsOrFirst: { url: string } | string \n ): Promise<ArrayBuffer> {\n let params: { url: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { url: string };\n } else {\n params = {\n url: paramsOrFirst as string \n };\n }\n \n const url = params.url;\n\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\n * \n *\n * @param {Flag} params.code - Country Code. ISO Alpha-2 country code format.\n * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>;\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 * \n * 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.\n * \n *\n * @param {Flag} code - Country Code. ISO Alpha-2 country code format.\n * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;\n getFlag(\n paramsOrFirst: { code: Flag, width?: number, height?: number, quality?: number } | Flag,\n ...rest: [(number)?, (number)?, (number)?] \n ): Promise<ArrayBuffer> {\n let params: { code: Flag, width?: number, height?: number, quality?: number };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {\n params = (paramsOrFirst || {}) as { code: Flag, width?: number, height?: number, quality?: number };\n } else {\n params = {\n code: paramsOrFirst as Flag,\n width: rest[0] as number,\n height: rest[1] as number,\n quality: rest[2] as number \n };\n }\n \n const code = params.code;\n const width = params.width;\n const height = params.height;\n const quality = params.quality;\n\n if (typeof code === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"code\"');\n }\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\n * \n * This endpoint does not follow HTTP redirects.\n *\n * @param {string} params.url - Image URL which you want to crop.\n * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.\n * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getImage(params: { url: string, width?: number, height?: number }): Promise<ArrayBuffer>;\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 * \n * 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.\n * \n * This endpoint does not follow HTTP redirects.\n *\n * @param {string} url - Image URL which you want to crop.\n * @param {number} width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.\n * @param {number} height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer>;\n getImage(\n paramsOrFirst: { url: string, width?: number, height?: number } | string,\n ...rest: [(number)?, (number)?] \n ): Promise<ArrayBuffer> {\n let params: { url: string, width?: number, height?: number };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { url: string, width?: number, height?: number };\n } else {\n params = {\n url: paramsOrFirst as string,\n width: rest[0] as number,\n height: rest[1] as number \n };\n }\n \n const url = params.url;\n const width = params.width;\n const height = params.height;\n\n if (typeof url === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"url\"');\n }\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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 * \n * 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.\n * \n * 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.\n * \n *\n * @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.\n * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {string} params.background - Changes background color. By default a random color will be picked and stay will persistent to the given name.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise<ArrayBuffer>;\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 * \n * 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.\n * \n * 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.\n * \n *\n * @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.\n * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.\n * @param {string} background - Changes background color. By default a random color will be picked and stay will persistent to the given name.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer>;\n getInitials(\n paramsOrFirst?: { name?: string, width?: number, height?: number, background?: string } | string,\n ...rest: [(number)?, (number)?, (string)?] \n ): Promise<ArrayBuffer> {\n let params: { name?: string, width?: number, height?: number, background?: string };\n \n if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { name?: string, width?: number, height?: number, background?: string };\n } else {\n params = {\n name: paramsOrFirst as string,\n width: rest[0] as number,\n height: rest[1] as number,\n background: rest[2] as string \n };\n }\n \n const name = params.name;\n const width = params.width;\n const height = params.height;\n const background = params.background;\n\n\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\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} params.text - Plain text to be converted to QR code image.\n * @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.\n * @param {number} params.margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.\n * @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.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n */\n getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise<ArrayBuffer>;\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 - Plain text to be converted to QR code image.\n * @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.\n * @param {number} margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.\n * @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.\n * @throws {AppwriteException}\n * @returns {Promise<ArrayBuffer>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer>;\n getQR(\n paramsOrFirst: { text: string, size?: number, margin?: number, download?: boolean } | string,\n ...rest: [(number)?, (number)?, (boolean)?] \n ): Promise<ArrayBuffer> {\n let params: { text: string, size?: number, margin?: number, download?: boolean };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { text: string, size?: number, margin?: number, download?: boolean };\n } else {\n params = {\n text: paramsOrFirst as string,\n size: rest[0] as number,\n margin: rest[1] as number,\n download: rest[2] as boolean \n };\n }\n \n const text = params.text;\n const size = params.size;\n const margin = params.margin;\n const download = params.download;\n\n if (typeof text === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"text\"');\n }\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 }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n 'arrayBuffer'\n );\n }\n}\n"]}
@@ -5,19 +5,22 @@ var Avatars = class {
5
5
  constructor(client) {
6
6
  this.client = client;
7
7
  }
8
- /**
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.
10
- *
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.
12
- *
13
- * @param {Browser} code
14
- * @param {number} width
15
- * @param {number} height
16
- * @param {number} quality
17
- * @throws {AppwriteException}
18
- * @returns {Promise<ArrayBuffer>}
19
- */
20
- getBrowser(code, width, height, quality) {
8
+ getBrowser(paramsOrFirst, ...rest) {
9
+ let params;
10
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
11
+ params = paramsOrFirst || {};
12
+ } else {
13
+ params = {
14
+ code: paramsOrFirst,
15
+ width: rest[0],
16
+ height: rest[1],
17
+ quality: rest[2]
18
+ };
19
+ }
20
+ const code = params.code;
21
+ const width = params.width;
22
+ const height = params.height;
23
+ const quality = params.quality;
21
24
  if (typeof code === "undefined") {
22
25
  throw new AppwriteException('Missing required parameter: "code"');
23
26
  }
@@ -42,20 +45,22 @@ var Avatars = class {
42
45
  "arrayBuffer"
43
46
  );
44
47
  }
45
- /**
46
- * 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.
47
- *
48
- * 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.
49
- *
50
- *
51
- * @param {CreditCard} code
52
- * @param {number} width
53
- * @param {number} height
54
- * @param {number} quality
55
- * @throws {AppwriteException}
56
- * @returns {Promise<ArrayBuffer>}
57
- */
58
- getCreditCard(code, width, height, quality) {
48
+ getCreditCard(paramsOrFirst, ...rest) {
49
+ let params;
50
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
51
+ params = paramsOrFirst || {};
52
+ } else {
53
+ params = {
54
+ code: paramsOrFirst,
55
+ width: rest[0],
56
+ height: rest[1],
57
+ quality: rest[2]
58
+ };
59
+ }
60
+ const code = params.code;
61
+ const width = params.width;
62
+ const height = params.height;
63
+ const quality = params.quality;
59
64
  if (typeof code === "undefined") {
60
65
  throw new AppwriteException('Missing required parameter: "code"');
61
66
  }
@@ -80,16 +85,16 @@ var Avatars = class {
80
85
  "arrayBuffer"
81
86
  );
82
87
  }
83
- /**
84
- * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
85
- *
86
- * This endpoint does not follow HTTP redirects.
87
- *
88
- * @param {string} url
89
- * @throws {AppwriteException}
90
- * @returns {Promise<ArrayBuffer>}
91
- */
92
- getFavicon(url) {
88
+ getFavicon(paramsOrFirst) {
89
+ let params;
90
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
91
+ params = paramsOrFirst || {};
92
+ } else {
93
+ params = {
94
+ url: paramsOrFirst
95
+ };
96
+ }
97
+ const url = params.url;
93
98
  if (typeof url === "undefined") {
94
99
  throw new AppwriteException('Missing required parameter: "url"');
95
100
  }
@@ -108,20 +113,22 @@ var Avatars = class {
108
113
  "arrayBuffer"
109
114
  );
110
115
  }
111
- /**
112
- * 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.
113
- *
114
- * 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.
115
- *
116
- *
117
- * @param {Flag} code
118
- * @param {number} width
119
- * @param {number} height
120
- * @param {number} quality
121
- * @throws {AppwriteException}
122
- * @returns {Promise<ArrayBuffer>}
123
- */
124
- getFlag(code, width, height, quality) {
116
+ getFlag(paramsOrFirst, ...rest) {
117
+ let params;
118
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
119
+ params = paramsOrFirst || {};
120
+ } else {
121
+ params = {
122
+ code: paramsOrFirst,
123
+ width: rest[0],
124
+ height: rest[1],
125
+ quality: rest[2]
126
+ };
127
+ }
128
+ const code = params.code;
129
+ const width = params.width;
130
+ const height = params.height;
131
+ const quality = params.quality;
125
132
  if (typeof code === "undefined") {
126
133
  throw new AppwriteException('Missing required parameter: "code"');
127
134
  }
@@ -146,20 +153,20 @@ var Avatars = class {
146
153
  "arrayBuffer"
147
154
  );
148
155
  }
149
- /**
150
- * 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.
151
- *
152
- * 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.
153
- *
154
- * This endpoint does not follow HTTP redirects.
155
- *
156
- * @param {string} url
157
- * @param {number} width
158
- * @param {number} height
159
- * @throws {AppwriteException}
160
- * @returns {Promise<ArrayBuffer>}
161
- */
162
- getImage(url, width, height) {
156
+ getImage(paramsOrFirst, ...rest) {
157
+ let params;
158
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
159
+ params = paramsOrFirst || {};
160
+ } else {
161
+ params = {
162
+ url: paramsOrFirst,
163
+ width: rest[0],
164
+ height: rest[1]
165
+ };
166
+ }
167
+ const url = params.url;
168
+ const width = params.width;
169
+ const height = params.height;
163
170
  if (typeof url === "undefined") {
164
171
  throw new AppwriteException('Missing required parameter: "url"');
165
172
  }
@@ -184,22 +191,22 @@ var Avatars = class {
184
191
  "arrayBuffer"
185
192
  );
186
193
  }
187
- /**
188
- * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
189
- *
190
- * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
191
- *
192
- * 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.
193
- *
194
- *
195
- * @param {string} name
196
- * @param {number} width
197
- * @param {number} height
198
- * @param {string} background
199
- * @throws {AppwriteException}
200
- * @returns {Promise<ArrayBuffer>}
201
- */
202
- getInitials(name, width, height, background) {
194
+ getInitials(paramsOrFirst, ...rest) {
195
+ let params;
196
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
197
+ params = paramsOrFirst || {};
198
+ } else {
199
+ params = {
200
+ name: paramsOrFirst,
201
+ width: rest[0],
202
+ height: rest[1],
203
+ background: rest[2]
204
+ };
205
+ }
206
+ const name = params.name;
207
+ const width = params.width;
208
+ const height = params.height;
209
+ const background = params.background;
203
210
  const apiPath = "/avatars/initials";
204
211
  const payload = {};
205
212
  if (typeof name !== "undefined") {
@@ -224,18 +231,22 @@ var Avatars = class {
224
231
  "arrayBuffer"
225
232
  );
226
233
  }
227
- /**
228
- * 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.
229
- *
230
- *
231
- * @param {string} text
232
- * @param {number} size
233
- * @param {number} margin
234
- * @param {boolean} download
235
- * @throws {AppwriteException}
236
- * @returns {Promise<ArrayBuffer>}
237
- */
238
- getQR(text, size, margin, download) {
234
+ getQR(paramsOrFirst, ...rest) {
235
+ let params;
236
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
237
+ params = paramsOrFirst || {};
238
+ } else {
239
+ params = {
240
+ text: paramsOrFirst,
241
+ size: rest[0],
242
+ margin: rest[1],
243
+ download: rest[2]
244
+ };
245
+ }
246
+ const text = params.text;
247
+ const size = params.size;
248
+ const margin = params.margin;
249
+ const download = params.download;
239
250
  if (typeof text === "undefined") {
240
251
  throw new AppwriteException('Missing required parameter: "text"');
241
252
  }