@appconda/nextjs 1.0.18 → 1.0.19

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 (118) hide show
  1. package/dist/Cache/Adapter.js +1 -0
  2. package/dist/Cache/Adapters/Filesystem.js +102 -0
  3. package/dist/Cache/Adapters/Memory.js +46 -0
  4. package/dist/Cache/Adapters/None.js +27 -0
  5. package/dist/Cache/Adapters/Redis.js +79 -0
  6. package/dist/Cache/Adapters/Sharding.js +72 -0
  7. package/dist/Cache/Cache.js +51 -0
  8. package/dist/Cache/index.js +5 -0
  9. package/dist/Cache/test.js +0 -0
  10. package/dist/Services.js +28 -0
  11. package/dist/actions/actionClient.js +35 -0
  12. package/dist/actions/index.js +1 -0
  13. package/dist/actions/nodes.js +9 -0
  14. package/dist/client.js +334 -0
  15. package/dist/decorators/Cache.js +78 -0
  16. package/dist/decorators/CacheKey.js +8 -0
  17. package/dist/decorators/Invalidate.js +46 -0
  18. package/dist/enums/api-service.js +14 -0
  19. package/dist/enums/api.js +6 -0
  20. package/dist/enums/auth-method.js +10 -0
  21. package/dist/enums/authentication-factor.js +7 -0
  22. package/dist/enums/authenticator-type.js +4 -0
  23. package/dist/enums/browser.js +17 -0
  24. package/dist/enums/compression.js +6 -0
  25. package/dist/enums/credit-card.js +19 -0
  26. package/dist/enums/database-usage-range.js +6 -0
  27. package/dist/enums/email-template-locale.js +134 -0
  28. package/dist/enums/email-template-type.js +10 -0
  29. package/dist/enums/entities/EntityLimitType.js +5 -0
  30. package/dist/enums/entities/PropertyAttributeName.js +28 -0
  31. package/dist/enums/entities/PropertyCondition.js +9 -0
  32. package/dist/enums/entities/PropertyType.js +17 -0
  33. package/dist/enums/entities/PropertyValueType.js +7 -0
  34. package/dist/enums/entities/RowAccess.js +1 -0
  35. package/dist/enums/entities/ViewFilterCondition.js +13 -0
  36. package/dist/enums/execution-method.js +9 -0
  37. package/dist/enums/flag.js +198 -0
  38. package/dist/enums/function-usage-range.js +6 -0
  39. package/dist/enums/image-format.js +8 -0
  40. package/dist/enums/image-gravity.js +12 -0
  41. package/dist/enums/index-type.js +6 -0
  42. package/dist/enums/messaging-provider-type.js +6 -0
  43. package/dist/enums/name.js +15 -0
  44. package/dist/enums/o-auth-provider copy.js +42 -0
  45. package/dist/enums/o-auth-provider.js +42 -0
  46. package/dist/enums/password-hash.js +14 -0
  47. package/dist/enums/platform-type.js +18 -0
  48. package/dist/enums/project-usage-range.js +5 -0
  49. package/dist/enums/region.js +5 -0
  50. package/dist/enums/relation-mutate.js +6 -0
  51. package/dist/enums/relationship-type.js +7 -0
  52. package/dist/enums/resource-type.js +5 -0
  53. package/dist/enums/runtime.js +49 -0
  54. package/dist/enums/s-m-t-p-secure.js +4 -0
  55. package/dist/enums/shared/ApplicationLayout.js +5 -0
  56. package/dist/enums/shared/Colors.js +25 -0
  57. package/dist/enums/shared/InputType.js +7 -0
  58. package/dist/enums/shared/Periodicity.js +8 -0
  59. package/dist/enums/shared/SvgIcon.js +38 -0
  60. package/dist/enums/shared/Theme.js +5 -0
  61. package/dist/enums/sms-template-locale.js +134 -0
  62. package/dist/enums/sms-template-type.js +7 -0
  63. package/dist/enums/smtp-encryption.js +6 -0
  64. package/dist/enums/storage-usage-range.js +6 -0
  65. package/dist/enums/subscriptions/PricingModel.js +11 -0
  66. package/dist/enums/subscriptions/SubscriptionBillingPeriod.js +10 -0
  67. package/dist/enums/subscriptions/SubscriptionFeatureLimitType.js +12 -0
  68. package/dist/enums/subscriptions/SubscriptionPriceType.js +7 -0
  69. package/dist/enums/tenants/LinkedAccountStatus.js +6 -0
  70. package/dist/enums/tenants/TenantUserJoined.js +7 -0
  71. package/dist/enums/tenants/TenantUserStatus.js +7 -0
  72. package/dist/enums/tenants/TenantUserType.js +6 -0
  73. package/dist/enums/user-usage-range.js +6 -0
  74. package/dist/getAppcondaClient.js +42 -0
  75. package/dist/getSDKForCurrentUser.js +62 -0
  76. package/dist/id.js +44 -0
  77. package/dist/iife/sdk.js +7063 -7805
  78. package/dist/index.js +12558 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/inputFile.js +16 -0
  81. package/dist/lib/Registry/Registry.js +55 -0
  82. package/dist/lib/Registry/index.js +1 -0
  83. package/dist/models.js +1 -0
  84. package/dist/permission.js +53 -0
  85. package/dist/query.js +203 -0
  86. package/dist/role.js +93 -0
  87. package/dist/service-client.js +13 -0
  88. package/dist/service.js +22 -0
  89. package/dist/services/account.js +1259 -0
  90. package/dist/services/applets.js +39 -0
  91. package/dist/services/avatars.js +250 -0
  92. package/dist/services/community.js +68 -0
  93. package/dist/services/configuration.js +10 -0
  94. package/dist/services/databases.js +1735 -0
  95. package/dist/services/functions.js +809 -0
  96. package/dist/services/graphql.js +56 -0
  97. package/dist/services/health.js +462 -0
  98. package/dist/services/locale.js +143 -0
  99. package/dist/services/messaging.js +1919 -0
  100. package/dist/services/node.js +10 -0
  101. package/dist/services/permissions.js +89 -0
  102. package/dist/services/pricing.js +20 -0
  103. package/dist/services/projects.js +1525 -0
  104. package/dist/services/roles.js +71 -0
  105. package/dist/services/schema.js +47 -0
  106. package/dist/services/storage.js +473 -0
  107. package/dist/services/subscription.js +45 -0
  108. package/dist/services/teams.js +394 -0
  109. package/dist/services/tenant-subscription.js +51 -0
  110. package/dist/services/tenant.js +124 -0
  111. package/dist/services/users.js +1282 -0
  112. package/dist/services/waitlist.js +11 -0
  113. package/package.json +5 -12
  114. package/tsconfig.json +2 -1
  115. package/dist/cjs/sdk.js +0 -13300
  116. package/dist/cjs/sdk.js.map +0 -1
  117. package/dist/esm/sdk.js +0 -13278
  118. package/dist/esm/sdk.js.map +0 -1
@@ -0,0 +1,1735 @@
1
+ import { AppcondaException } from '../client';
2
+ export class Databases {
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ /**
7
+ * List databases
8
+ *
9
+ * Get a list of all databases from the current Appconda project. You can use the search parameter to filter your results.
10
+ *
11
+ * @param {string[]} queries
12
+ * @param {string} search
13
+ * @throws {AppcondaException}
14
+ * @returns {Promise<Models.DatabaseList>}
15
+ */
16
+ async list(queries, search) {
17
+ const apiPath = '/databases';
18
+ const payload = {};
19
+ if (typeof queries !== 'undefined') {
20
+ payload['queries'] = queries;
21
+ }
22
+ if (typeof search !== 'undefined') {
23
+ payload['search'] = search;
24
+ }
25
+ const uri = new URL(this.client.config.endpoint + apiPath);
26
+ const apiHeaders = {
27
+ 'content-type': 'application/json',
28
+ };
29
+ return await this.client.call('get', uri, apiHeaders, payload);
30
+ }
31
+ /**
32
+ * Create database
33
+ *
34
+ * Create a new Database.
35
+
36
+ *
37
+ * @param {string} databaseId
38
+ * @param {string} name
39
+ * @param {boolean} enabled
40
+ * @throws {AppcondaException}
41
+ * @returns {Promise<Models.Database>}
42
+ */
43
+ async create(databaseId, name, enabled) {
44
+ if (typeof databaseId === 'undefined') {
45
+ throw new AppcondaException('Missing required parameter: "databaseId"');
46
+ }
47
+ if (typeof name === 'undefined') {
48
+ throw new AppcondaException('Missing required parameter: "name"');
49
+ }
50
+ const apiPath = '/databases';
51
+ const payload = {};
52
+ if (typeof databaseId !== 'undefined') {
53
+ payload['databaseId'] = databaseId;
54
+ }
55
+ if (typeof name !== 'undefined') {
56
+ payload['name'] = name;
57
+ }
58
+ if (typeof enabled !== 'undefined') {
59
+ payload['enabled'] = enabled;
60
+ }
61
+ const uri = new URL(this.client.config.endpoint + apiPath);
62
+ const apiHeaders = {
63
+ 'content-type': 'application/json',
64
+ };
65
+ return await this.client.call('post', uri, apiHeaders, payload);
66
+ }
67
+ /**
68
+ * Get database
69
+ *
70
+ * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
71
+ *
72
+ * @param {string} databaseId
73
+ * @throws {AppcondaException}
74
+ * @returns {Promise<Models.Database>}
75
+ */
76
+ async get(databaseId) {
77
+ if (typeof databaseId === 'undefined') {
78
+ throw new AppcondaException('Missing required parameter: "databaseId"');
79
+ }
80
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
81
+ const payload = {};
82
+ const uri = new URL(this.client.config.endpoint + apiPath);
83
+ const apiHeaders = {
84
+ 'content-type': 'application/json',
85
+ };
86
+ return await this.client.call('get', uri, apiHeaders, payload);
87
+ }
88
+ /**
89
+ * Update database
90
+ *
91
+ * Update a database by its unique ID.
92
+ *
93
+ * @param {string} databaseId
94
+ * @param {string} name
95
+ * @param {boolean} enabled
96
+ * @throws {AppcondaException}
97
+ * @returns {Promise<Models.Database>}
98
+ */
99
+ async update(databaseId, name, enabled) {
100
+ if (typeof databaseId === 'undefined') {
101
+ throw new AppcondaException('Missing required parameter: "databaseId"');
102
+ }
103
+ if (typeof name === 'undefined') {
104
+ throw new AppcondaException('Missing required parameter: "name"');
105
+ }
106
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
107
+ const payload = {};
108
+ if (typeof name !== 'undefined') {
109
+ payload['name'] = name;
110
+ }
111
+ if (typeof enabled !== 'undefined') {
112
+ payload['enabled'] = enabled;
113
+ }
114
+ const uri = new URL(this.client.config.endpoint + apiPath);
115
+ const apiHeaders = {
116
+ 'content-type': 'application/json',
117
+ };
118
+ return await this.client.call('put', uri, apiHeaders, payload);
119
+ }
120
+ /**
121
+ * Delete database
122
+ *
123
+ * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
124
+ *
125
+ * @param {string} databaseId
126
+ * @throws {AppcondaException}
127
+ * @returns {Promise<{}>}
128
+ */
129
+ async delete(databaseId) {
130
+ if (typeof databaseId === 'undefined') {
131
+ throw new AppcondaException('Missing required parameter: "databaseId"');
132
+ }
133
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
134
+ const payload = {};
135
+ const uri = new URL(this.client.config.endpoint + apiPath);
136
+ const apiHeaders = {
137
+ 'content-type': 'application/json',
138
+ };
139
+ return await this.client.call('delete', uri, apiHeaders, payload);
140
+ }
141
+ /**
142
+ * List collections
143
+ *
144
+ * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
145
+ *
146
+ * @param {string} databaseId
147
+ * @param {string[]} queries
148
+ * @param {string} search
149
+ * @throws {AppcondaException}
150
+ * @returns {Promise<Models.CollectionList>}
151
+ */
152
+ async listCollections(databaseId, queries, search) {
153
+ if (typeof databaseId === 'undefined') {
154
+ throw new AppcondaException('Missing required parameter: "databaseId"');
155
+ }
156
+ const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
157
+ const payload = {};
158
+ if (typeof queries !== 'undefined') {
159
+ payload['queries'] = queries;
160
+ }
161
+ if (typeof search !== 'undefined') {
162
+ payload['search'] = search;
163
+ }
164
+ const uri = new URL(this.client.config.endpoint + apiPath);
165
+ const apiHeaders = {
166
+ 'content-type': 'application/json',
167
+ };
168
+ return await this.client.call('get', uri, apiHeaders, payload);
169
+ }
170
+ /**
171
+ * Create collection
172
+ *
173
+ * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appconda.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
174
+ *
175
+ * @param {string} databaseId
176
+ * @param {string} collectionId
177
+ * @param {string} name
178
+ * @param {string[]} permissions
179
+ * @param {boolean} documentSecurity
180
+ * @param {boolean} enabled
181
+ * @throws {AppcondaException}
182
+ * @returns {Promise<Models.Collection>}
183
+ */
184
+ async createCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
185
+ if (typeof databaseId === 'undefined') {
186
+ throw new AppcondaException('Missing required parameter: "databaseId"');
187
+ }
188
+ if (typeof collectionId === 'undefined') {
189
+ throw new AppcondaException('Missing required parameter: "collectionId"');
190
+ }
191
+ if (typeof name === 'undefined') {
192
+ throw new AppcondaException('Missing required parameter: "name"');
193
+ }
194
+ const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
195
+ const payload = {};
196
+ if (typeof collectionId !== 'undefined') {
197
+ payload['collectionId'] = collectionId;
198
+ }
199
+ if (typeof name !== 'undefined') {
200
+ payload['name'] = name;
201
+ }
202
+ if (typeof permissions !== 'undefined') {
203
+ payload['permissions'] = permissions;
204
+ }
205
+ if (typeof documentSecurity !== 'undefined') {
206
+ payload['documentSecurity'] = documentSecurity;
207
+ }
208
+ if (typeof enabled !== 'undefined') {
209
+ payload['enabled'] = enabled;
210
+ }
211
+ const uri = new URL(this.client.config.endpoint + apiPath);
212
+ const apiHeaders = {
213
+ 'content-type': 'application/json',
214
+ };
215
+ return await this.client.call('post', uri, apiHeaders, payload);
216
+ }
217
+ /**
218
+ * Get collection
219
+ *
220
+ * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
221
+ *
222
+ * @param {string} databaseId
223
+ * @param {string} collectionId
224
+ * @throws {AppcondaException}
225
+ * @returns {Promise<Models.Collection>}
226
+ */
227
+ async getCollection(databaseId, collectionId) {
228
+ if (typeof databaseId === 'undefined') {
229
+ throw new AppcondaException('Missing required parameter: "databaseId"');
230
+ }
231
+ if (typeof collectionId === 'undefined') {
232
+ throw new AppcondaException('Missing required parameter: "collectionId"');
233
+ }
234
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
235
+ const payload = {};
236
+ const uri = new URL(this.client.config.endpoint + apiPath);
237
+ const apiHeaders = {
238
+ 'content-type': 'application/json',
239
+ };
240
+ return await this.client.call('get', uri, apiHeaders, payload);
241
+ }
242
+ /**
243
+ * Update collection
244
+ *
245
+ * Update a collection by its unique ID.
246
+ *
247
+ * @param {string} databaseId
248
+ * @param {string} collectionId
249
+ * @param {string} name
250
+ * @param {string[]} permissions
251
+ * @param {boolean} documentSecurity
252
+ * @param {boolean} enabled
253
+ * @throws {AppcondaException}
254
+ * @returns {Promise<Models.Collection>}
255
+ */
256
+ async updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
257
+ if (typeof databaseId === 'undefined') {
258
+ throw new AppcondaException('Missing required parameter: "databaseId"');
259
+ }
260
+ if (typeof collectionId === 'undefined') {
261
+ throw new AppcondaException('Missing required parameter: "collectionId"');
262
+ }
263
+ if (typeof name === 'undefined') {
264
+ throw new AppcondaException('Missing required parameter: "name"');
265
+ }
266
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
267
+ const payload = {};
268
+ if (typeof name !== 'undefined') {
269
+ payload['name'] = name;
270
+ }
271
+ if (typeof permissions !== 'undefined') {
272
+ payload['permissions'] = permissions;
273
+ }
274
+ if (typeof documentSecurity !== 'undefined') {
275
+ payload['documentSecurity'] = documentSecurity;
276
+ }
277
+ if (typeof enabled !== 'undefined') {
278
+ payload['enabled'] = enabled;
279
+ }
280
+ const uri = new URL(this.client.config.endpoint + apiPath);
281
+ const apiHeaders = {
282
+ 'content-type': 'application/json',
283
+ };
284
+ return await this.client.call('put', uri, apiHeaders, payload);
285
+ }
286
+ /**
287
+ * Delete collection
288
+ *
289
+ * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
290
+ *
291
+ * @param {string} databaseId
292
+ * @param {string} collectionId
293
+ * @throws {AppcondaException}
294
+ * @returns {Promise<{}>}
295
+ */
296
+ async deleteCollection(databaseId, collectionId) {
297
+ if (typeof databaseId === 'undefined') {
298
+ throw new AppcondaException('Missing required parameter: "databaseId"');
299
+ }
300
+ if (typeof collectionId === 'undefined') {
301
+ throw new AppcondaException('Missing required parameter: "collectionId"');
302
+ }
303
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
304
+ const payload = {};
305
+ const uri = new URL(this.client.config.endpoint + apiPath);
306
+ const apiHeaders = {
307
+ 'content-type': 'application/json',
308
+ };
309
+ return await this.client.call('delete', uri, apiHeaders, payload);
310
+ }
311
+ /**
312
+ * List attributes
313
+ *
314
+ * List attributes in the collection.
315
+ *
316
+ * @param {string} databaseId
317
+ * @param {string} collectionId
318
+ * @param {string[]} queries
319
+ * @throws {AppcondaException}
320
+ * @returns {Promise<Models.AttributeList>}
321
+ */
322
+ async listAttributes(databaseId, collectionId, queries) {
323
+ if (typeof databaseId === 'undefined') {
324
+ throw new AppcondaException('Missing required parameter: "databaseId"');
325
+ }
326
+ if (typeof collectionId === 'undefined') {
327
+ throw new AppcondaException('Missing required parameter: "collectionId"');
328
+ }
329
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
330
+ const payload = {};
331
+ if (typeof queries !== 'undefined') {
332
+ payload['queries'] = queries;
333
+ }
334
+ const uri = new URL(this.client.config.endpoint + apiPath);
335
+ const apiHeaders = {
336
+ 'content-type': 'application/json',
337
+ };
338
+ return await this.client.call('get', uri, apiHeaders, payload);
339
+ }
340
+ /**
341
+ * Create boolean attribute
342
+ *
343
+ * Create a boolean attribute.
344
+
345
+ *
346
+ * @param {string} databaseId
347
+ * @param {string} collectionId
348
+ * @param {string} key
349
+ * @param {boolean} required
350
+ * @param {boolean} xdefault
351
+ * @param {boolean} array
352
+ * @throws {AppcondaException}
353
+ * @returns {Promise<Models.AttributeBoolean>}
354
+ */
355
+ async createBooleanAttribute(databaseId, collectionId, key, required, xdefault, array) {
356
+ if (typeof databaseId === 'undefined') {
357
+ throw new AppcondaException('Missing required parameter: "databaseId"');
358
+ }
359
+ if (typeof collectionId === 'undefined') {
360
+ throw new AppcondaException('Missing required parameter: "collectionId"');
361
+ }
362
+ if (typeof key === 'undefined') {
363
+ throw new AppcondaException('Missing required parameter: "key"');
364
+ }
365
+ if (typeof required === 'undefined') {
366
+ throw new AppcondaException('Missing required parameter: "required"');
367
+ }
368
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
369
+ const payload = {};
370
+ if (typeof key !== 'undefined') {
371
+ payload['key'] = key;
372
+ }
373
+ if (typeof required !== 'undefined') {
374
+ payload['required'] = required;
375
+ }
376
+ if (typeof xdefault !== 'undefined') {
377
+ payload['default'] = xdefault;
378
+ }
379
+ if (typeof array !== 'undefined') {
380
+ payload['array'] = array;
381
+ }
382
+ const uri = new URL(this.client.config.endpoint + apiPath);
383
+ const apiHeaders = {
384
+ 'content-type': 'application/json',
385
+ };
386
+ return await this.client.call('post', uri, apiHeaders, payload);
387
+ }
388
+ /**
389
+ * Update boolean attribute
390
+ *
391
+ * Update a boolean attribute. Changing the `default` value will not update already existing documents.
392
+ *
393
+ * @param {string} databaseId
394
+ * @param {string} collectionId
395
+ * @param {string} key
396
+ * @param {boolean} required
397
+ * @param {boolean} xdefault
398
+ * @param {string} newKey
399
+ * @throws {AppcondaException}
400
+ * @returns {Promise<Models.AttributeBoolean>}
401
+ */
402
+ async updateBooleanAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
403
+ if (typeof databaseId === 'undefined') {
404
+ throw new AppcondaException('Missing required parameter: "databaseId"');
405
+ }
406
+ if (typeof collectionId === 'undefined') {
407
+ throw new AppcondaException('Missing required parameter: "collectionId"');
408
+ }
409
+ if (typeof key === 'undefined') {
410
+ throw new AppcondaException('Missing required parameter: "key"');
411
+ }
412
+ if (typeof required === 'undefined') {
413
+ throw new AppcondaException('Missing required parameter: "required"');
414
+ }
415
+ if (typeof xdefault === 'undefined') {
416
+ throw new AppcondaException('Missing required parameter: "xdefault"');
417
+ }
418
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
419
+ const payload = {};
420
+ if (typeof required !== 'undefined') {
421
+ payload['required'] = required;
422
+ }
423
+ if (typeof xdefault !== 'undefined') {
424
+ payload['default'] = xdefault;
425
+ }
426
+ if (typeof newKey !== 'undefined') {
427
+ payload['newKey'] = newKey;
428
+ }
429
+ const uri = new URL(this.client.config.endpoint + apiPath);
430
+ const apiHeaders = {
431
+ 'content-type': 'application/json',
432
+ };
433
+ return await this.client.call('patch', uri, apiHeaders, payload);
434
+ }
435
+ /**
436
+ * Create datetime attribute
437
+ *
438
+ * Create a date time attribute according to the ISO 8601 standard.
439
+ *
440
+ * @param {string} databaseId
441
+ * @param {string} collectionId
442
+ * @param {string} key
443
+ * @param {boolean} required
444
+ * @param {string} xdefault
445
+ * @param {boolean} array
446
+ * @throws {AppcondaException}
447
+ * @returns {Promise<Models.AttributeDatetime>}
448
+ */
449
+ async createDatetimeAttribute(databaseId, collectionId, key, required, xdefault, array) {
450
+ if (typeof databaseId === 'undefined') {
451
+ throw new AppcondaException('Missing required parameter: "databaseId"');
452
+ }
453
+ if (typeof collectionId === 'undefined') {
454
+ throw new AppcondaException('Missing required parameter: "collectionId"');
455
+ }
456
+ if (typeof key === 'undefined') {
457
+ throw new AppcondaException('Missing required parameter: "key"');
458
+ }
459
+ if (typeof required === 'undefined') {
460
+ throw new AppcondaException('Missing required parameter: "required"');
461
+ }
462
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
463
+ const payload = {};
464
+ if (typeof key !== 'undefined') {
465
+ payload['key'] = key;
466
+ }
467
+ if (typeof required !== 'undefined') {
468
+ payload['required'] = required;
469
+ }
470
+ if (typeof xdefault !== 'undefined') {
471
+ payload['default'] = xdefault;
472
+ }
473
+ if (typeof array !== 'undefined') {
474
+ payload['array'] = array;
475
+ }
476
+ const uri = new URL(this.client.config.endpoint + apiPath);
477
+ const apiHeaders = {
478
+ 'content-type': 'application/json',
479
+ };
480
+ return await this.client.call('post', uri, apiHeaders, payload);
481
+ }
482
+ /**
483
+ * Update dateTime attribute
484
+ *
485
+ * Update a date time attribute. Changing the `default` value will not update already existing documents.
486
+ *
487
+ * @param {string} databaseId
488
+ * @param {string} collectionId
489
+ * @param {string} key
490
+ * @param {boolean} required
491
+ * @param {string} xdefault
492
+ * @param {string} newKey
493
+ * @throws {AppcondaException}
494
+ * @returns {Promise<Models.AttributeDatetime>}
495
+ */
496
+ async updateDatetimeAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
497
+ if (typeof databaseId === 'undefined') {
498
+ throw new AppcondaException('Missing required parameter: "databaseId"');
499
+ }
500
+ if (typeof collectionId === 'undefined') {
501
+ throw new AppcondaException('Missing required parameter: "collectionId"');
502
+ }
503
+ if (typeof key === 'undefined') {
504
+ throw new AppcondaException('Missing required parameter: "key"');
505
+ }
506
+ if (typeof required === 'undefined') {
507
+ throw new AppcondaException('Missing required parameter: "required"');
508
+ }
509
+ if (typeof xdefault === 'undefined') {
510
+ throw new AppcondaException('Missing required parameter: "xdefault"');
511
+ }
512
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
513
+ const payload = {};
514
+ if (typeof required !== 'undefined') {
515
+ payload['required'] = required;
516
+ }
517
+ if (typeof xdefault !== 'undefined') {
518
+ payload['default'] = xdefault;
519
+ }
520
+ if (typeof newKey !== 'undefined') {
521
+ payload['newKey'] = newKey;
522
+ }
523
+ const uri = new URL(this.client.config.endpoint + apiPath);
524
+ const apiHeaders = {
525
+ 'content-type': 'application/json',
526
+ };
527
+ return await this.client.call('patch', uri, apiHeaders, payload);
528
+ }
529
+ /**
530
+ * Create email attribute
531
+ *
532
+ * Create an email attribute.
533
+
534
+ *
535
+ * @param {string} databaseId
536
+ * @param {string} collectionId
537
+ * @param {string} key
538
+ * @param {boolean} required
539
+ * @param {string} xdefault
540
+ * @param {boolean} array
541
+ * @throws {AppcondaException}
542
+ * @returns {Promise<Models.AttributeEmail>}
543
+ */
544
+ async createEmailAttribute(databaseId, collectionId, key, required, xdefault, array) {
545
+ if (typeof databaseId === 'undefined') {
546
+ throw new AppcondaException('Missing required parameter: "databaseId"');
547
+ }
548
+ if (typeof collectionId === 'undefined') {
549
+ throw new AppcondaException('Missing required parameter: "collectionId"');
550
+ }
551
+ if (typeof key === 'undefined') {
552
+ throw new AppcondaException('Missing required parameter: "key"');
553
+ }
554
+ if (typeof required === 'undefined') {
555
+ throw new AppcondaException('Missing required parameter: "required"');
556
+ }
557
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
558
+ const payload = {};
559
+ if (typeof key !== 'undefined') {
560
+ payload['key'] = key;
561
+ }
562
+ if (typeof required !== 'undefined') {
563
+ payload['required'] = required;
564
+ }
565
+ if (typeof xdefault !== 'undefined') {
566
+ payload['default'] = xdefault;
567
+ }
568
+ if (typeof array !== 'undefined') {
569
+ payload['array'] = array;
570
+ }
571
+ const uri = new URL(this.client.config.endpoint + apiPath);
572
+ const apiHeaders = {
573
+ 'content-type': 'application/json',
574
+ };
575
+ return await this.client.call('post', uri, apiHeaders, payload);
576
+ }
577
+ /**
578
+ * Update email attribute
579
+ *
580
+ * Update an email attribute. Changing the `default` value will not update already existing documents.
581
+
582
+ *
583
+ * @param {string} databaseId
584
+ * @param {string} collectionId
585
+ * @param {string} key
586
+ * @param {boolean} required
587
+ * @param {string} xdefault
588
+ * @param {string} newKey
589
+ * @throws {AppcondaException}
590
+ * @returns {Promise<Models.AttributeEmail>}
591
+ */
592
+ async updateEmailAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
593
+ if (typeof databaseId === 'undefined') {
594
+ throw new AppcondaException('Missing required parameter: "databaseId"');
595
+ }
596
+ if (typeof collectionId === 'undefined') {
597
+ throw new AppcondaException('Missing required parameter: "collectionId"');
598
+ }
599
+ if (typeof key === 'undefined') {
600
+ throw new AppcondaException('Missing required parameter: "key"');
601
+ }
602
+ if (typeof required === 'undefined') {
603
+ throw new AppcondaException('Missing required parameter: "required"');
604
+ }
605
+ if (typeof xdefault === 'undefined') {
606
+ throw new AppcondaException('Missing required parameter: "xdefault"');
607
+ }
608
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
609
+ const payload = {};
610
+ if (typeof required !== 'undefined') {
611
+ payload['required'] = required;
612
+ }
613
+ if (typeof xdefault !== 'undefined') {
614
+ payload['default'] = xdefault;
615
+ }
616
+ if (typeof newKey !== 'undefined') {
617
+ payload['newKey'] = newKey;
618
+ }
619
+ const uri = new URL(this.client.config.endpoint + apiPath);
620
+ const apiHeaders = {
621
+ 'content-type': 'application/json',
622
+ };
623
+ return await this.client.call('patch', uri, apiHeaders, payload);
624
+ }
625
+ /**
626
+ * Create enum attribute
627
+ *
628
+ * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute.
629
+
630
+ *
631
+ * @param {string} databaseId
632
+ * @param {string} collectionId
633
+ * @param {string} key
634
+ * @param {string[]} elements
635
+ * @param {boolean} required
636
+ * @param {string} xdefault
637
+ * @param {boolean} array
638
+ * @throws {AppcondaException}
639
+ * @returns {Promise<Models.AttributeEnum>}
640
+ */
641
+ async createEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, array) {
642
+ if (typeof databaseId === 'undefined') {
643
+ throw new AppcondaException('Missing required parameter: "databaseId"');
644
+ }
645
+ if (typeof collectionId === 'undefined') {
646
+ throw new AppcondaException('Missing required parameter: "collectionId"');
647
+ }
648
+ if (typeof key === 'undefined') {
649
+ throw new AppcondaException('Missing required parameter: "key"');
650
+ }
651
+ if (typeof elements === 'undefined') {
652
+ throw new AppcondaException('Missing required parameter: "elements"');
653
+ }
654
+ if (typeof required === 'undefined') {
655
+ throw new AppcondaException('Missing required parameter: "required"');
656
+ }
657
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
658
+ const payload = {};
659
+ if (typeof key !== 'undefined') {
660
+ payload['key'] = key;
661
+ }
662
+ if (typeof elements !== 'undefined') {
663
+ payload['elements'] = elements;
664
+ }
665
+ if (typeof required !== 'undefined') {
666
+ payload['required'] = required;
667
+ }
668
+ if (typeof xdefault !== 'undefined') {
669
+ payload['default'] = xdefault;
670
+ }
671
+ if (typeof array !== 'undefined') {
672
+ payload['array'] = array;
673
+ }
674
+ const uri = new URL(this.client.config.endpoint + apiPath);
675
+ const apiHeaders = {
676
+ 'content-type': 'application/json',
677
+ };
678
+ return await this.client.call('post', uri, apiHeaders, payload);
679
+ }
680
+ /**
681
+ * Update enum attribute
682
+ *
683
+ * Update an enum attribute. Changing the `default` value will not update already existing documents.
684
+
685
+ *
686
+ * @param {string} databaseId
687
+ * @param {string} collectionId
688
+ * @param {string} key
689
+ * @param {string[]} elements
690
+ * @param {boolean} required
691
+ * @param {string} xdefault
692
+ * @param {string} newKey
693
+ * @throws {AppcondaException}
694
+ * @returns {Promise<Models.AttributeEnum>}
695
+ */
696
+ async updateEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, newKey) {
697
+ if (typeof databaseId === 'undefined') {
698
+ throw new AppcondaException('Missing required parameter: "databaseId"');
699
+ }
700
+ if (typeof collectionId === 'undefined') {
701
+ throw new AppcondaException('Missing required parameter: "collectionId"');
702
+ }
703
+ if (typeof key === 'undefined') {
704
+ throw new AppcondaException('Missing required parameter: "key"');
705
+ }
706
+ if (typeof elements === 'undefined') {
707
+ throw new AppcondaException('Missing required parameter: "elements"');
708
+ }
709
+ if (typeof required === 'undefined') {
710
+ throw new AppcondaException('Missing required parameter: "required"');
711
+ }
712
+ if (typeof xdefault === 'undefined') {
713
+ throw new AppcondaException('Missing required parameter: "xdefault"');
714
+ }
715
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
716
+ const payload = {};
717
+ if (typeof elements !== 'undefined') {
718
+ payload['elements'] = elements;
719
+ }
720
+ if (typeof required !== 'undefined') {
721
+ payload['required'] = required;
722
+ }
723
+ if (typeof xdefault !== 'undefined') {
724
+ payload['default'] = xdefault;
725
+ }
726
+ if (typeof newKey !== 'undefined') {
727
+ payload['newKey'] = newKey;
728
+ }
729
+ const uri = new URL(this.client.config.endpoint + apiPath);
730
+ const apiHeaders = {
731
+ 'content-type': 'application/json',
732
+ };
733
+ return await this.client.call('patch', uri, apiHeaders, payload);
734
+ }
735
+ /**
736
+ * Create float attribute
737
+ *
738
+ * Create a float attribute. Optionally, minimum and maximum values can be provided.
739
+
740
+ *
741
+ * @param {string} databaseId
742
+ * @param {string} collectionId
743
+ * @param {string} key
744
+ * @param {boolean} required
745
+ * @param {number} min
746
+ * @param {number} max
747
+ * @param {number} xdefault
748
+ * @param {boolean} array
749
+ * @throws {AppcondaException}
750
+ * @returns {Promise<Models.AttributeFloat>}
751
+ */
752
+ async createFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
753
+ if (typeof databaseId === 'undefined') {
754
+ throw new AppcondaException('Missing required parameter: "databaseId"');
755
+ }
756
+ if (typeof collectionId === 'undefined') {
757
+ throw new AppcondaException('Missing required parameter: "collectionId"');
758
+ }
759
+ if (typeof key === 'undefined') {
760
+ throw new AppcondaException('Missing required parameter: "key"');
761
+ }
762
+ if (typeof required === 'undefined') {
763
+ throw new AppcondaException('Missing required parameter: "required"');
764
+ }
765
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
766
+ const payload = {};
767
+ if (typeof key !== 'undefined') {
768
+ payload['key'] = key;
769
+ }
770
+ if (typeof required !== 'undefined') {
771
+ payload['required'] = required;
772
+ }
773
+ if (typeof min !== 'undefined') {
774
+ payload['min'] = min;
775
+ }
776
+ if (typeof max !== 'undefined') {
777
+ payload['max'] = max;
778
+ }
779
+ if (typeof xdefault !== 'undefined') {
780
+ payload['default'] = xdefault;
781
+ }
782
+ if (typeof array !== 'undefined') {
783
+ payload['array'] = array;
784
+ }
785
+ const uri = new URL(this.client.config.endpoint + apiPath);
786
+ const apiHeaders = {
787
+ 'content-type': 'application/json',
788
+ };
789
+ return await this.client.call('post', uri, apiHeaders, payload);
790
+ }
791
+ /**
792
+ * Update float attribute
793
+ *
794
+ * Update a float attribute. Changing the `default` value will not update already existing documents.
795
+
796
+ *
797
+ * @param {string} databaseId
798
+ * @param {string} collectionId
799
+ * @param {string} key
800
+ * @param {boolean} required
801
+ * @param {number} min
802
+ * @param {number} max
803
+ * @param {number} xdefault
804
+ * @param {string} newKey
805
+ * @throws {AppcondaException}
806
+ * @returns {Promise<Models.AttributeFloat>}
807
+ */
808
+ async updateFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, newKey) {
809
+ if (typeof databaseId === 'undefined') {
810
+ throw new AppcondaException('Missing required parameter: "databaseId"');
811
+ }
812
+ if (typeof collectionId === 'undefined') {
813
+ throw new AppcondaException('Missing required parameter: "collectionId"');
814
+ }
815
+ if (typeof key === 'undefined') {
816
+ throw new AppcondaException('Missing required parameter: "key"');
817
+ }
818
+ if (typeof required === 'undefined') {
819
+ throw new AppcondaException('Missing required parameter: "required"');
820
+ }
821
+ if (typeof min === 'undefined') {
822
+ throw new AppcondaException('Missing required parameter: "min"');
823
+ }
824
+ if (typeof max === 'undefined') {
825
+ throw new AppcondaException('Missing required parameter: "max"');
826
+ }
827
+ if (typeof xdefault === 'undefined') {
828
+ throw new AppcondaException('Missing required parameter: "xdefault"');
829
+ }
830
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
831
+ const payload = {};
832
+ if (typeof required !== 'undefined') {
833
+ payload['required'] = required;
834
+ }
835
+ if (typeof min !== 'undefined') {
836
+ payload['min'] = min;
837
+ }
838
+ if (typeof max !== 'undefined') {
839
+ payload['max'] = max;
840
+ }
841
+ if (typeof xdefault !== 'undefined') {
842
+ payload['default'] = xdefault;
843
+ }
844
+ if (typeof newKey !== 'undefined') {
845
+ payload['newKey'] = newKey;
846
+ }
847
+ const uri = new URL(this.client.config.endpoint + apiPath);
848
+ const apiHeaders = {
849
+ 'content-type': 'application/json',
850
+ };
851
+ return await this.client.call('patch', uri, apiHeaders, payload);
852
+ }
853
+ /**
854
+ * Create integer attribute
855
+ *
856
+ * Create an integer attribute. Optionally, minimum and maximum values can be provided.
857
+
858
+ *
859
+ * @param {string} databaseId
860
+ * @param {string} collectionId
861
+ * @param {string} key
862
+ * @param {boolean} required
863
+ * @param {number} min
864
+ * @param {number} max
865
+ * @param {number} xdefault
866
+ * @param {boolean} array
867
+ * @throws {AppcondaException}
868
+ * @returns {Promise<Models.AttributeInteger>}
869
+ */
870
+ async createIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
871
+ if (typeof databaseId === 'undefined') {
872
+ throw new AppcondaException('Missing required parameter: "databaseId"');
873
+ }
874
+ if (typeof collectionId === 'undefined') {
875
+ throw new AppcondaException('Missing required parameter: "collectionId"');
876
+ }
877
+ if (typeof key === 'undefined') {
878
+ throw new AppcondaException('Missing required parameter: "key"');
879
+ }
880
+ if (typeof required === 'undefined') {
881
+ throw new AppcondaException('Missing required parameter: "required"');
882
+ }
883
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
884
+ const payload = {};
885
+ if (typeof key !== 'undefined') {
886
+ payload['key'] = key;
887
+ }
888
+ if (typeof required !== 'undefined') {
889
+ payload['required'] = required;
890
+ }
891
+ if (typeof min !== 'undefined') {
892
+ payload['min'] = min;
893
+ }
894
+ if (typeof max !== 'undefined') {
895
+ payload['max'] = max;
896
+ }
897
+ if (typeof xdefault !== 'undefined') {
898
+ payload['default'] = xdefault;
899
+ }
900
+ if (typeof array !== 'undefined') {
901
+ payload['array'] = array;
902
+ }
903
+ const uri = new URL(this.client.config.endpoint + apiPath);
904
+ const apiHeaders = {
905
+ 'content-type': 'application/json',
906
+ };
907
+ return await this.client.call('post', uri, apiHeaders, payload);
908
+ }
909
+ /**
910
+ * Update integer attribute
911
+ *
912
+ * Update an integer attribute. Changing the `default` value will not update already existing documents.
913
+
914
+ *
915
+ * @param {string} databaseId
916
+ * @param {string} collectionId
917
+ * @param {string} key
918
+ * @param {boolean} required
919
+ * @param {number} min
920
+ * @param {number} max
921
+ * @param {number} xdefault
922
+ * @param {string} newKey
923
+ * @throws {AppcondaException}
924
+ * @returns {Promise<Models.AttributeInteger>}
925
+ */
926
+ async updateIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, newKey) {
927
+ if (typeof databaseId === 'undefined') {
928
+ throw new AppcondaException('Missing required parameter: "databaseId"');
929
+ }
930
+ if (typeof collectionId === 'undefined') {
931
+ throw new AppcondaException('Missing required parameter: "collectionId"');
932
+ }
933
+ if (typeof key === 'undefined') {
934
+ throw new AppcondaException('Missing required parameter: "key"');
935
+ }
936
+ if (typeof required === 'undefined') {
937
+ throw new AppcondaException('Missing required parameter: "required"');
938
+ }
939
+ if (typeof min === 'undefined') {
940
+ throw new AppcondaException('Missing required parameter: "min"');
941
+ }
942
+ if (typeof max === 'undefined') {
943
+ throw new AppcondaException('Missing required parameter: "max"');
944
+ }
945
+ if (typeof xdefault === 'undefined') {
946
+ throw new AppcondaException('Missing required parameter: "xdefault"');
947
+ }
948
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
949
+ const payload = {};
950
+ if (typeof required !== 'undefined') {
951
+ payload['required'] = required;
952
+ }
953
+ if (typeof min !== 'undefined') {
954
+ payload['min'] = min;
955
+ }
956
+ if (typeof max !== 'undefined') {
957
+ payload['max'] = max;
958
+ }
959
+ if (typeof xdefault !== 'undefined') {
960
+ payload['default'] = xdefault;
961
+ }
962
+ if (typeof newKey !== 'undefined') {
963
+ payload['newKey'] = newKey;
964
+ }
965
+ const uri = new URL(this.client.config.endpoint + apiPath);
966
+ const apiHeaders = {
967
+ 'content-type': 'application/json',
968
+ };
969
+ return await this.client.call('patch', uri, apiHeaders, payload);
970
+ }
971
+ /**
972
+ * Create IP address attribute
973
+ *
974
+ * Create IP address attribute.
975
+
976
+ *
977
+ * @param {string} databaseId
978
+ * @param {string} collectionId
979
+ * @param {string} key
980
+ * @param {boolean} required
981
+ * @param {string} xdefault
982
+ * @param {boolean} array
983
+ * @throws {AppcondaException}
984
+ * @returns {Promise<Models.AttributeIp>}
985
+ */
986
+ async createIpAttribute(databaseId, collectionId, key, required, xdefault, array) {
987
+ if (typeof databaseId === 'undefined') {
988
+ throw new AppcondaException('Missing required parameter: "databaseId"');
989
+ }
990
+ if (typeof collectionId === 'undefined') {
991
+ throw new AppcondaException('Missing required parameter: "collectionId"');
992
+ }
993
+ if (typeof key === 'undefined') {
994
+ throw new AppcondaException('Missing required parameter: "key"');
995
+ }
996
+ if (typeof required === 'undefined') {
997
+ throw new AppcondaException('Missing required parameter: "required"');
998
+ }
999
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1000
+ const payload = {};
1001
+ if (typeof key !== 'undefined') {
1002
+ payload['key'] = key;
1003
+ }
1004
+ if (typeof required !== 'undefined') {
1005
+ payload['required'] = required;
1006
+ }
1007
+ if (typeof xdefault !== 'undefined') {
1008
+ payload['default'] = xdefault;
1009
+ }
1010
+ if (typeof array !== 'undefined') {
1011
+ payload['array'] = array;
1012
+ }
1013
+ const uri = new URL(this.client.config.endpoint + apiPath);
1014
+ const apiHeaders = {
1015
+ 'content-type': 'application/json',
1016
+ };
1017
+ return await this.client.call('post', uri, apiHeaders, payload);
1018
+ }
1019
+ /**
1020
+ * Update IP address attribute
1021
+ *
1022
+ * Update an ip attribute. Changing the `default` value will not update already existing documents.
1023
+
1024
+ *
1025
+ * @param {string} databaseId
1026
+ * @param {string} collectionId
1027
+ * @param {string} key
1028
+ * @param {boolean} required
1029
+ * @param {string} xdefault
1030
+ * @param {string} newKey
1031
+ * @throws {AppcondaException}
1032
+ * @returns {Promise<Models.AttributeIp>}
1033
+ */
1034
+ async updateIpAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
1035
+ if (typeof databaseId === 'undefined') {
1036
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1037
+ }
1038
+ if (typeof collectionId === 'undefined') {
1039
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1040
+ }
1041
+ if (typeof key === 'undefined') {
1042
+ throw new AppcondaException('Missing required parameter: "key"');
1043
+ }
1044
+ if (typeof required === 'undefined') {
1045
+ throw new AppcondaException('Missing required parameter: "required"');
1046
+ }
1047
+ if (typeof xdefault === 'undefined') {
1048
+ throw new AppcondaException('Missing required parameter: "xdefault"');
1049
+ }
1050
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1051
+ const payload = {};
1052
+ if (typeof required !== 'undefined') {
1053
+ payload['required'] = required;
1054
+ }
1055
+ if (typeof xdefault !== 'undefined') {
1056
+ payload['default'] = xdefault;
1057
+ }
1058
+ if (typeof newKey !== 'undefined') {
1059
+ payload['newKey'] = newKey;
1060
+ }
1061
+ const uri = new URL(this.client.config.endpoint + apiPath);
1062
+ const apiHeaders = {
1063
+ 'content-type': 'application/json',
1064
+ };
1065
+ return await this.client.call('patch', uri, apiHeaders, payload);
1066
+ }
1067
+ /**
1068
+ * Create relationship attribute
1069
+ *
1070
+ * Create relationship attribute. [Learn more about relationship attributes](https://appconda.io/docs/databases-relationships#relationship-attributes).
1071
+
1072
+ *
1073
+ * @param {string} databaseId
1074
+ * @param {string} collectionId
1075
+ * @param {string} relatedCollectionId
1076
+ * @param {RelationshipType} type
1077
+ * @param {boolean} twoWay
1078
+ * @param {string} key
1079
+ * @param {string} twoWayKey
1080
+ * @param {RelationMutate} onDelete
1081
+ * @throws {AppcondaException}
1082
+ * @returns {Promise<Models.AttributeRelationship>}
1083
+ */
1084
+ async createRelationshipAttribute(databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete) {
1085
+ if (typeof databaseId === 'undefined') {
1086
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1087
+ }
1088
+ if (typeof collectionId === 'undefined') {
1089
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1090
+ }
1091
+ if (typeof relatedCollectionId === 'undefined') {
1092
+ throw new AppcondaException('Missing required parameter: "relatedCollectionId"');
1093
+ }
1094
+ if (typeof type === 'undefined') {
1095
+ throw new AppcondaException('Missing required parameter: "type"');
1096
+ }
1097
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1098
+ const payload = {};
1099
+ if (typeof relatedCollectionId !== 'undefined') {
1100
+ payload['relatedCollectionId'] = relatedCollectionId;
1101
+ }
1102
+ if (typeof type !== 'undefined') {
1103
+ payload['type'] = type;
1104
+ }
1105
+ if (typeof twoWay !== 'undefined') {
1106
+ payload['twoWay'] = twoWay;
1107
+ }
1108
+ if (typeof key !== 'undefined') {
1109
+ payload['key'] = key;
1110
+ }
1111
+ if (typeof twoWayKey !== 'undefined') {
1112
+ payload['twoWayKey'] = twoWayKey;
1113
+ }
1114
+ if (typeof onDelete !== 'undefined') {
1115
+ payload['onDelete'] = onDelete;
1116
+ }
1117
+ const uri = new URL(this.client.config.endpoint + apiPath);
1118
+ const apiHeaders = {
1119
+ 'content-type': 'application/json',
1120
+ };
1121
+ return await this.client.call('post', uri, apiHeaders, payload);
1122
+ }
1123
+ /**
1124
+ * Create string attribute
1125
+ *
1126
+ * Create a string attribute.
1127
+
1128
+ *
1129
+ * @param {string} databaseId
1130
+ * @param {string} collectionId
1131
+ * @param {string} key
1132
+ * @param {number} size
1133
+ * @param {boolean} required
1134
+ * @param {string} xdefault
1135
+ * @param {boolean} array
1136
+ * @param {boolean} encrypt
1137
+ * @throws {AppcondaException}
1138
+ * @returns {Promise<Models.AttributeString>}
1139
+ */
1140
+ async createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array, encrypt) {
1141
+ if (typeof databaseId === 'undefined') {
1142
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1143
+ }
1144
+ if (typeof collectionId === 'undefined') {
1145
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1146
+ }
1147
+ if (typeof key === 'undefined') {
1148
+ throw new AppcondaException('Missing required parameter: "key"');
1149
+ }
1150
+ if (typeof size === 'undefined') {
1151
+ throw new AppcondaException('Missing required parameter: "size"');
1152
+ }
1153
+ if (typeof required === 'undefined') {
1154
+ throw new AppcondaException('Missing required parameter: "required"');
1155
+ }
1156
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1157
+ const payload = {};
1158
+ if (typeof key !== 'undefined') {
1159
+ payload['key'] = key;
1160
+ }
1161
+ if (typeof size !== 'undefined') {
1162
+ payload['size'] = size;
1163
+ }
1164
+ if (typeof required !== 'undefined') {
1165
+ payload['required'] = required;
1166
+ }
1167
+ if (typeof xdefault !== 'undefined') {
1168
+ payload['default'] = xdefault;
1169
+ }
1170
+ if (typeof array !== 'undefined') {
1171
+ payload['array'] = array;
1172
+ }
1173
+ if (typeof encrypt !== 'undefined') {
1174
+ payload['encrypt'] = encrypt;
1175
+ }
1176
+ const uri = new URL(this.client.config.endpoint + apiPath);
1177
+ const apiHeaders = {
1178
+ 'content-type': 'application/json',
1179
+ };
1180
+ return await this.client.call('post', uri, apiHeaders, payload);
1181
+ }
1182
+ /**
1183
+ * Update string attribute
1184
+ *
1185
+ * Update a string attribute. Changing the `default` value will not update already existing documents.
1186
+
1187
+ *
1188
+ * @param {string} databaseId
1189
+ * @param {string} collectionId
1190
+ * @param {string} key
1191
+ * @param {boolean} required
1192
+ * @param {string} xdefault
1193
+ * @param {number} size
1194
+ * @param {string} newKey
1195
+ * @throws {AppcondaException}
1196
+ * @returns {Promise<Models.AttributeString>}
1197
+ */
1198
+ async updateStringAttribute(databaseId, collectionId, key, required, xdefault, size, newKey) {
1199
+ if (typeof databaseId === 'undefined') {
1200
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1201
+ }
1202
+ if (typeof collectionId === 'undefined') {
1203
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1204
+ }
1205
+ if (typeof key === 'undefined') {
1206
+ throw new AppcondaException('Missing required parameter: "key"');
1207
+ }
1208
+ if (typeof required === 'undefined') {
1209
+ throw new AppcondaException('Missing required parameter: "required"');
1210
+ }
1211
+ if (typeof xdefault === 'undefined') {
1212
+ throw new AppcondaException('Missing required parameter: "xdefault"');
1213
+ }
1214
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1215
+ const payload = {};
1216
+ if (typeof required !== 'undefined') {
1217
+ payload['required'] = required;
1218
+ }
1219
+ if (typeof xdefault !== 'undefined') {
1220
+ payload['default'] = xdefault;
1221
+ }
1222
+ if (typeof size !== 'undefined') {
1223
+ payload['size'] = size;
1224
+ }
1225
+ if (typeof newKey !== 'undefined') {
1226
+ payload['newKey'] = newKey;
1227
+ }
1228
+ const uri = new URL(this.client.config.endpoint + apiPath);
1229
+ const apiHeaders = {
1230
+ 'content-type': 'application/json',
1231
+ };
1232
+ return await this.client.call('patch', uri, apiHeaders, payload);
1233
+ }
1234
+ /**
1235
+ * Create URL attribute
1236
+ *
1237
+ * Create a URL attribute.
1238
+
1239
+ *
1240
+ * @param {string} databaseId
1241
+ * @param {string} collectionId
1242
+ * @param {string} key
1243
+ * @param {boolean} required
1244
+ * @param {string} xdefault
1245
+ * @param {boolean} array
1246
+ * @throws {AppcondaException}
1247
+ * @returns {Promise<Models.AttributeUrl>}
1248
+ */
1249
+ async createUrlAttribute(databaseId, collectionId, key, required, xdefault, array) {
1250
+ if (typeof databaseId === 'undefined') {
1251
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1252
+ }
1253
+ if (typeof collectionId === 'undefined') {
1254
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1255
+ }
1256
+ if (typeof key === 'undefined') {
1257
+ throw new AppcondaException('Missing required parameter: "key"');
1258
+ }
1259
+ if (typeof required === 'undefined') {
1260
+ throw new AppcondaException('Missing required parameter: "required"');
1261
+ }
1262
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1263
+ const payload = {};
1264
+ if (typeof key !== 'undefined') {
1265
+ payload['key'] = key;
1266
+ }
1267
+ if (typeof required !== 'undefined') {
1268
+ payload['required'] = required;
1269
+ }
1270
+ if (typeof xdefault !== 'undefined') {
1271
+ payload['default'] = xdefault;
1272
+ }
1273
+ if (typeof array !== 'undefined') {
1274
+ payload['array'] = array;
1275
+ }
1276
+ const uri = new URL(this.client.config.endpoint + apiPath);
1277
+ const apiHeaders = {
1278
+ 'content-type': 'application/json',
1279
+ };
1280
+ return await this.client.call('post', uri, apiHeaders, payload);
1281
+ }
1282
+ /**
1283
+ * Update URL attribute
1284
+ *
1285
+ * Update an url attribute. Changing the `default` value will not update already existing documents.
1286
+
1287
+ *
1288
+ * @param {string} databaseId
1289
+ * @param {string} collectionId
1290
+ * @param {string} key
1291
+ * @param {boolean} required
1292
+ * @param {string} xdefault
1293
+ * @param {string} newKey
1294
+ * @throws {AppcondaException}
1295
+ * @returns {Promise<Models.AttributeUrl>}
1296
+ */
1297
+ async updateUrlAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
1298
+ if (typeof databaseId === 'undefined') {
1299
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1300
+ }
1301
+ if (typeof collectionId === 'undefined') {
1302
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1303
+ }
1304
+ if (typeof key === 'undefined') {
1305
+ throw new AppcondaException('Missing required parameter: "key"');
1306
+ }
1307
+ if (typeof required === 'undefined') {
1308
+ throw new AppcondaException('Missing required parameter: "required"');
1309
+ }
1310
+ if (typeof xdefault === 'undefined') {
1311
+ throw new AppcondaException('Missing required parameter: "xdefault"');
1312
+ }
1313
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1314
+ const payload = {};
1315
+ if (typeof required !== 'undefined') {
1316
+ payload['required'] = required;
1317
+ }
1318
+ if (typeof xdefault !== 'undefined') {
1319
+ payload['default'] = xdefault;
1320
+ }
1321
+ if (typeof newKey !== 'undefined') {
1322
+ payload['newKey'] = newKey;
1323
+ }
1324
+ const uri = new URL(this.client.config.endpoint + apiPath);
1325
+ const apiHeaders = {
1326
+ 'content-type': 'application/json',
1327
+ };
1328
+ return await this.client.call('patch', uri, apiHeaders, payload);
1329
+ }
1330
+ /**
1331
+ * Get attribute
1332
+ *
1333
+ * Get attribute by ID.
1334
+ *
1335
+ * @param {string} databaseId
1336
+ * @param {string} collectionId
1337
+ * @param {string} key
1338
+ * @throws {AppcondaException}
1339
+ * @returns {Promise<{}>}
1340
+ */
1341
+ async getAttribute(databaseId, collectionId, key) {
1342
+ if (typeof databaseId === 'undefined') {
1343
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1344
+ }
1345
+ if (typeof collectionId === 'undefined') {
1346
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1347
+ }
1348
+ if (typeof key === 'undefined') {
1349
+ throw new AppcondaException('Missing required parameter: "key"');
1350
+ }
1351
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1352
+ const payload = {};
1353
+ const uri = new URL(this.client.config.endpoint + apiPath);
1354
+ const apiHeaders = {
1355
+ 'content-type': 'application/json',
1356
+ };
1357
+ return await this.client.call('get', uri, apiHeaders, payload);
1358
+ }
1359
+ /**
1360
+ * Delete attribute
1361
+ *
1362
+ * Deletes an attribute.
1363
+ *
1364
+ * @param {string} databaseId
1365
+ * @param {string} collectionId
1366
+ * @param {string} key
1367
+ * @throws {AppcondaException}
1368
+ * @returns {Promise<{}>}
1369
+ */
1370
+ async deleteAttribute(databaseId, collectionId, key) {
1371
+ if (typeof databaseId === 'undefined') {
1372
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1373
+ }
1374
+ if (typeof collectionId === 'undefined') {
1375
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1376
+ }
1377
+ if (typeof key === 'undefined') {
1378
+ throw new AppcondaException('Missing required parameter: "key"');
1379
+ }
1380
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1381
+ const payload = {};
1382
+ const uri = new URL(this.client.config.endpoint + apiPath);
1383
+ const apiHeaders = {
1384
+ 'content-type': 'application/json',
1385
+ };
1386
+ return await this.client.call('delete', uri, apiHeaders, payload);
1387
+ }
1388
+ /**
1389
+ * Update relationship attribute
1390
+ *
1391
+ * Update relationship attribute. [Learn more about relationship attributes](https://appconda.io/docs/databases-relationships#relationship-attributes).
1392
+
1393
+ *
1394
+ * @param {string} databaseId
1395
+ * @param {string} collectionId
1396
+ * @param {string} key
1397
+ * @param {RelationMutate} onDelete
1398
+ * @param {string} newKey
1399
+ * @throws {AppcondaException}
1400
+ * @returns {Promise<Models.AttributeRelationship>}
1401
+ */
1402
+ async updateRelationshipAttribute(databaseId, collectionId, key, onDelete, newKey) {
1403
+ if (typeof databaseId === 'undefined') {
1404
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1405
+ }
1406
+ if (typeof collectionId === 'undefined') {
1407
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1408
+ }
1409
+ if (typeof key === 'undefined') {
1410
+ throw new AppcondaException('Missing required parameter: "key"');
1411
+ }
1412
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1413
+ const payload = {};
1414
+ if (typeof onDelete !== 'undefined') {
1415
+ payload['onDelete'] = onDelete;
1416
+ }
1417
+ if (typeof newKey !== 'undefined') {
1418
+ payload['newKey'] = newKey;
1419
+ }
1420
+ const uri = new URL(this.client.config.endpoint + apiPath);
1421
+ const apiHeaders = {
1422
+ 'content-type': 'application/json',
1423
+ };
1424
+ return await this.client.call('patch', uri, apiHeaders, payload);
1425
+ }
1426
+ /**
1427
+ * List documents
1428
+ *
1429
+ * Get a list of all the user&#039;s documents in a given collection. You can use the query params to filter your results.
1430
+ *
1431
+ * @param {string} databaseId
1432
+ * @param {string} collectionId
1433
+ * @param {string[]} queries
1434
+ * @throws {AppcondaException}
1435
+ * @returns {Promise<Models.DocumentList<Document>>}
1436
+ */
1437
+ async listDocuments(databaseId, collectionId, queries) {
1438
+ if (typeof databaseId === 'undefined') {
1439
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1440
+ }
1441
+ if (typeof collectionId === 'undefined') {
1442
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1443
+ }
1444
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1445
+ const payload = {};
1446
+ if (typeof queries !== 'undefined') {
1447
+ payload['queries'] = queries;
1448
+ }
1449
+ const uri = new URL(this.client.config.endpoint + apiPath);
1450
+ const apiHeaders = {
1451
+ 'content-type': 'application/json',
1452
+ };
1453
+ return await this.client.call('get', uri, apiHeaders, payload);
1454
+ }
1455
+ /**
1456
+ * Create document
1457
+ *
1458
+ * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appconda.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
1459
+ *
1460
+ * @param {string} databaseId
1461
+ * @param {string} collectionId
1462
+ * @param {string} documentId
1463
+ * @param {Omit<Document, keyof Models.Document>} data
1464
+ * @param {string[]} permissions
1465
+ * @throws {AppcondaException}
1466
+ * @returns {Promise<Document>}
1467
+ */
1468
+ async createDocument(databaseId, collectionId, documentId, data, permissions) {
1469
+ if (typeof databaseId === 'undefined') {
1470
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1471
+ }
1472
+ if (typeof collectionId === 'undefined') {
1473
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1474
+ }
1475
+ if (typeof documentId === 'undefined') {
1476
+ throw new AppcondaException('Missing required parameter: "documentId"');
1477
+ }
1478
+ if (typeof data === 'undefined') {
1479
+ throw new AppcondaException('Missing required parameter: "data"');
1480
+ }
1481
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1482
+ const payload = {};
1483
+ if (typeof documentId !== 'undefined') {
1484
+ payload['documentId'] = documentId;
1485
+ }
1486
+ if (typeof data !== 'undefined') {
1487
+ payload['data'] = data;
1488
+ }
1489
+ if (typeof permissions !== 'undefined') {
1490
+ payload['permissions'] = permissions;
1491
+ }
1492
+ const uri = new URL(this.client.config.endpoint + apiPath);
1493
+ const apiHeaders = {
1494
+ 'content-type': 'application/json',
1495
+ };
1496
+ return await this.client.call('post', uri, apiHeaders, payload);
1497
+ }
1498
+ /**
1499
+ * Get document
1500
+ *
1501
+ * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1502
+ *
1503
+ * @param {string} databaseId
1504
+ * @param {string} collectionId
1505
+ * @param {string} documentId
1506
+ * @param {string[]} queries
1507
+ * @throws {AppcondaException}
1508
+ * @returns {Promise<Document>}
1509
+ */
1510
+ async getDocument(databaseId, collectionId, documentId, queries) {
1511
+ if (typeof databaseId === 'undefined') {
1512
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1513
+ }
1514
+ if (typeof collectionId === 'undefined') {
1515
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1516
+ }
1517
+ if (typeof documentId === 'undefined') {
1518
+ throw new AppcondaException('Missing required parameter: "documentId"');
1519
+ }
1520
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1521
+ const payload = {};
1522
+ if (typeof queries !== 'undefined') {
1523
+ payload['queries'] = queries;
1524
+ }
1525
+ const uri = new URL(this.client.config.endpoint + apiPath);
1526
+ const apiHeaders = {
1527
+ 'content-type': 'application/json',
1528
+ };
1529
+ return await this.client.call('get', uri, apiHeaders, payload);
1530
+ }
1531
+ /**
1532
+ * Update document
1533
+ *
1534
+ * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1535
+ *
1536
+ * @param {string} databaseId
1537
+ * @param {string} collectionId
1538
+ * @param {string} documentId
1539
+ * @param {Partial<Omit<Document, keyof Models.Document>>} data
1540
+ * @param {string[]} permissions
1541
+ * @throws {AppcondaException}
1542
+ * @returns {Promise<Document>}
1543
+ */
1544
+ async updateDocument(databaseId, collectionId, documentId, data, permissions) {
1545
+ if (typeof databaseId === 'undefined') {
1546
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1547
+ }
1548
+ if (typeof collectionId === 'undefined') {
1549
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1550
+ }
1551
+ if (typeof documentId === 'undefined') {
1552
+ throw new AppcondaException('Missing required parameter: "documentId"');
1553
+ }
1554
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1555
+ const payload = {};
1556
+ if (typeof data !== 'undefined') {
1557
+ payload['data'] = data;
1558
+ }
1559
+ if (typeof permissions !== 'undefined') {
1560
+ payload['permissions'] = permissions;
1561
+ }
1562
+ const uri = new URL(this.client.config.endpoint + apiPath);
1563
+ const apiHeaders = {
1564
+ 'content-type': 'application/json',
1565
+ };
1566
+ return await this.client.call('patch', uri, apiHeaders, payload);
1567
+ }
1568
+ /**
1569
+ * Delete document
1570
+ *
1571
+ * Delete a document by its unique ID.
1572
+ *
1573
+ * @param {string} databaseId
1574
+ * @param {string} collectionId
1575
+ * @param {string} documentId
1576
+ * @throws {AppcondaException}
1577
+ * @returns {Promise<{}>}
1578
+ */
1579
+ async deleteDocument(databaseId, collectionId, documentId) {
1580
+ if (typeof databaseId === 'undefined') {
1581
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1582
+ }
1583
+ if (typeof collectionId === 'undefined') {
1584
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1585
+ }
1586
+ if (typeof documentId === 'undefined') {
1587
+ throw new AppcondaException('Missing required parameter: "documentId"');
1588
+ }
1589
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1590
+ const payload = {};
1591
+ const uri = new URL(this.client.config.endpoint + apiPath);
1592
+ const apiHeaders = {
1593
+ 'content-type': 'application/json',
1594
+ };
1595
+ return await this.client.call('delete', uri, apiHeaders, payload);
1596
+ }
1597
+ /**
1598
+ * List indexes
1599
+ *
1600
+ * List indexes in the collection.
1601
+ *
1602
+ * @param {string} databaseId
1603
+ * @param {string} collectionId
1604
+ * @param {string[]} queries
1605
+ * @throws {AppcondaException}
1606
+ * @returns {Promise<Models.IndexList>}
1607
+ */
1608
+ async listIndexes(databaseId, collectionId, queries) {
1609
+ if (typeof databaseId === 'undefined') {
1610
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1611
+ }
1612
+ if (typeof collectionId === 'undefined') {
1613
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1614
+ }
1615
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1616
+ const payload = {};
1617
+ if (typeof queries !== 'undefined') {
1618
+ payload['queries'] = queries;
1619
+ }
1620
+ const uri = new URL(this.client.config.endpoint + apiPath);
1621
+ const apiHeaders = {
1622
+ 'content-type': 'application/json',
1623
+ };
1624
+ return await this.client.call('get', uri, apiHeaders, payload);
1625
+ }
1626
+ /**
1627
+ * Create index
1628
+ *
1629
+ * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
1630
+ Attributes can be `key`, `fulltext`, and `unique`.
1631
+ *
1632
+ * @param {string} databaseId
1633
+ * @param {string} collectionId
1634
+ * @param {string} key
1635
+ * @param {IndexType} type
1636
+ * @param {string[]} attributes
1637
+ * @param {string[]} orders
1638
+ * @throws {AppcondaException}
1639
+ * @returns {Promise<Models.Index>}
1640
+ */
1641
+ async createIndex(databaseId, collectionId, key, type, attributes, orders) {
1642
+ if (typeof databaseId === 'undefined') {
1643
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1644
+ }
1645
+ if (typeof collectionId === 'undefined') {
1646
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1647
+ }
1648
+ if (typeof key === 'undefined') {
1649
+ throw new AppcondaException('Missing required parameter: "key"');
1650
+ }
1651
+ if (typeof type === 'undefined') {
1652
+ throw new AppcondaException('Missing required parameter: "type"');
1653
+ }
1654
+ if (typeof attributes === 'undefined') {
1655
+ throw new AppcondaException('Missing required parameter: "attributes"');
1656
+ }
1657
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1658
+ const payload = {};
1659
+ if (typeof key !== 'undefined') {
1660
+ payload['key'] = key;
1661
+ }
1662
+ if (typeof type !== 'undefined') {
1663
+ payload['type'] = type;
1664
+ }
1665
+ if (typeof attributes !== 'undefined') {
1666
+ payload['attributes'] = attributes;
1667
+ }
1668
+ if (typeof orders !== 'undefined') {
1669
+ payload['orders'] = orders;
1670
+ }
1671
+ const uri = new URL(this.client.config.endpoint + apiPath);
1672
+ const apiHeaders = {
1673
+ 'content-type': 'application/json',
1674
+ };
1675
+ return await this.client.call('post', uri, apiHeaders, payload);
1676
+ }
1677
+ /**
1678
+ * Get index
1679
+ *
1680
+ * Get index by ID.
1681
+ *
1682
+ * @param {string} databaseId
1683
+ * @param {string} collectionId
1684
+ * @param {string} key
1685
+ * @throws {AppcondaException}
1686
+ * @returns {Promise<Models.Index>}
1687
+ */
1688
+ async getIndex(databaseId, collectionId, key) {
1689
+ if (typeof databaseId === 'undefined') {
1690
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1691
+ }
1692
+ if (typeof collectionId === 'undefined') {
1693
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1694
+ }
1695
+ if (typeof key === 'undefined') {
1696
+ throw new AppcondaException('Missing required parameter: "key"');
1697
+ }
1698
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1699
+ const payload = {};
1700
+ const uri = new URL(this.client.config.endpoint + apiPath);
1701
+ const apiHeaders = {
1702
+ 'content-type': 'application/json',
1703
+ };
1704
+ return await this.client.call('get', uri, apiHeaders, payload);
1705
+ }
1706
+ /**
1707
+ * Delete index
1708
+ *
1709
+ * Delete an index.
1710
+ *
1711
+ * @param {string} databaseId
1712
+ * @param {string} collectionId
1713
+ * @param {string} key
1714
+ * @throws {AppcondaException}
1715
+ * @returns {Promise<{}>}
1716
+ */
1717
+ async deleteIndex(databaseId, collectionId, key) {
1718
+ if (typeof databaseId === 'undefined') {
1719
+ throw new AppcondaException('Missing required parameter: "databaseId"');
1720
+ }
1721
+ if (typeof collectionId === 'undefined') {
1722
+ throw new AppcondaException('Missing required parameter: "collectionId"');
1723
+ }
1724
+ if (typeof key === 'undefined') {
1725
+ throw new AppcondaException('Missing required parameter: "key"');
1726
+ }
1727
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1728
+ const payload = {};
1729
+ const uri = new URL(this.client.config.endpoint + apiPath);
1730
+ const apiHeaders = {
1731
+ 'content-type': 'application/json',
1732
+ };
1733
+ return await this.client.call('delete', uri, apiHeaders, payload);
1734
+ }
1735
+ }