@appwrite.io/console 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/sdk.js +330 -27
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +331 -28
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +330 -27
- package/docs/examples/databases/decrement-document-attribute.md +18 -0
- package/docs/examples/databases/increment-document-attribute.md +18 -0
- package/docs/examples/databases/upsert-document.md +17 -0
- package/docs/examples/databases/upsert-documents.md +1 -1
- package/docs/examples/domains/create-record-a-a-a-a.md +1 -1
- package/docs/examples/domains/create-record-a.md +1 -1
- package/docs/examples/domains/create-record-alias.md +1 -1
- package/docs/examples/domains/create-record-c-a-a.md +1 -1
- package/docs/examples/domains/create-record-c-n-a-m-e.md +1 -1
- package/docs/examples/domains/create-record-h-t-t-p-s.md +1 -1
- package/docs/examples/domains/create-record-m-x.md +1 -1
- package/docs/examples/domains/create-record-n-s.md +1 -1
- package/docs/examples/domains/create-record-s-r-v.md +1 -1
- package/docs/examples/domains/create-record-t-x-t.md +1 -1
- package/docs/examples/domains/update-record-a-a-a-a.md +1 -1
- package/docs/examples/domains/update-record-a.md +1 -1
- package/docs/examples/domains/update-record-alias.md +1 -1
- package/docs/examples/domains/update-record-c-a-a.md +1 -1
- package/docs/examples/domains/update-record-c-n-a-m-e.md +1 -1
- package/docs/examples/domains/update-record-h-t-t-p-s.md +1 -1
- package/docs/examples/domains/update-record-m-x.md +1 -1
- package/docs/examples/domains/update-record-n-s.md +1 -1
- package/docs/examples/domains/update-record-s-r-v.md +1 -1
- package/docs/examples/domains/update-record-t-x-t.md +1 -1
- package/docs/examples/functions/create.md +1 -5
- package/docs/examples/health/{get-queue-stats-usage-dump.md → get-queue-billing-project-aggregation.md} +2 -2
- package/docs/examples/health/{get-queue-billing-aggregation.md → get-queue-billing-team-aggregation.md} +1 -1
- package/docs/examples/organizations/cancel-downgrade.md +13 -0
- package/docs/examples/organizations/estimation-create-organization.md +16 -0
- package/docs/examples/organizations/estimation-delete-organization.md +13 -0
- package/docs/examples/organizations/estimation-update-plan.md +16 -0
- package/docs/examples/organizations/get-usage.md +1 -1
- package/docs/examples/organizations/validate-payment.md +14 -0
- package/docs/examples/proxy/create-redirect-rule.md +4 -2
- package/package.json +1 -1
- package/src/client.ts +9 -5
- package/src/enums/build-runtime.ts +2 -0
- package/src/enums/image-format.ts +1 -0
- package/src/enums/proxy-resource-type.ts +4 -0
- package/src/enums/runtime.ts +2 -0
- package/src/index.ts +1 -0
- package/src/models.ts +284 -2
- package/src/services/databases.ts +141 -1
- package/src/services/functions.ts +1 -17
- package/src/services/health.ts +28 -3
- package/src/services/organizations.ts +197 -0
- package/src/services/proxy.ts +16 -1
- package/src/services/tokens.ts +1 -1
- package/types/enums/build-runtime.d.ts +3 -1
- package/types/enums/image-format.d.ts +2 -1
- package/types/enums/proxy-resource-type.d.ts +4 -0
- package/types/enums/runtime.d.ts +3 -1
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +284 -2
- package/types/services/databases.d.ts +39 -1
- package/types/services/functions.d.ts +1 -5
- package/types/services/health.d.ts +10 -2
- package/types/services/organizations.d.ts +57 -0
- package/types/services/proxy.d.ts +4 -1
- package/types/services/tokens.d.ts +1 -1
- package/docs/examples/functions/create-build.md +0 -15
- package/docs/examples/functions/get-function-usage.md +0 -14
- package/docs/examples/functions/update-deployment-build.md +0 -14
- package/docs/examples/functions/update-deployment.md +0 -14
- package/docs/examples/proxy/create-rule.md +0 -15
- package/src/enums/resource-type.ts +0 -4
- package/types/enums/resource-type.d.ts +0 -4
package/dist/iife/sdk.js
CHANGED
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
'x-sdk-name': 'Console',
|
|
282
282
|
'x-sdk-platform': 'console',
|
|
283
283
|
'x-sdk-language': 'web',
|
|
284
|
-
'x-sdk-version': '1.
|
|
284
|
+
'x-sdk-version': '1.9.0',
|
|
285
285
|
'X-Appwrite-Response-Format': '1.7.0',
|
|
286
286
|
};
|
|
287
287
|
this.realtime = {
|
|
@@ -579,8 +579,10 @@
|
|
|
579
579
|
let options = {
|
|
580
580
|
method,
|
|
581
581
|
headers,
|
|
582
|
-
credentials: 'include',
|
|
583
582
|
};
|
|
583
|
+
if (headers['X-Appwrite-Dev-Key'] === undefined) {
|
|
584
|
+
options.credentials = 'include';
|
|
585
|
+
}
|
|
584
586
|
if (method === 'GET') {
|
|
585
587
|
for (const [key, value] of Object.entries(Client.flatten(params))) {
|
|
586
588
|
url.searchParams.append(key, value);
|
|
@@ -614,9 +616,10 @@
|
|
|
614
616
|
return { uri: url.toString(), options };
|
|
615
617
|
}
|
|
616
618
|
chunkedUpload(method, url, headers = {}, originalPayload = {}, onProgress) {
|
|
619
|
+
var _a;
|
|
617
620
|
return __awaiter(this, void 0, void 0, function* () {
|
|
618
|
-
const file = Object.
|
|
619
|
-
if (!file) {
|
|
621
|
+
const [fileParam, file] = (_a = Object.entries(originalPayload).find(([_, value]) => value instanceof File)) !== null && _a !== void 0 ? _a : [];
|
|
622
|
+
if (!file || !fileParam) {
|
|
620
623
|
throw new Error('File not found in payload');
|
|
621
624
|
}
|
|
622
625
|
if (file.size <= Client.CHUNK_SIZE) {
|
|
@@ -631,7 +634,8 @@
|
|
|
631
634
|
}
|
|
632
635
|
headers['content-range'] = `bytes ${start}-${end - 1}/${file.size}`;
|
|
633
636
|
const chunk = file.slice(start, end);
|
|
634
|
-
let payload = Object.assign(
|
|
637
|
+
let payload = Object.assign({}, originalPayload);
|
|
638
|
+
payload[fileParam] = new File([chunk], file.name);
|
|
635
639
|
response = yield this.call(method, url, headers, payload);
|
|
636
640
|
if (onProgress && typeof onProgress === 'function') {
|
|
637
641
|
onProgress({
|
|
@@ -4420,6 +4424,9 @@
|
|
|
4420
4424
|
if (typeof collectionId === 'undefined') {
|
|
4421
4425
|
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
4422
4426
|
}
|
|
4427
|
+
if (typeof documents === 'undefined') {
|
|
4428
|
+
throw new AppwriteException('Missing required parameter: "documents"');
|
|
4429
|
+
}
|
|
4423
4430
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
4424
4431
|
const payload = {};
|
|
4425
4432
|
if (typeof documents !== 'undefined') {
|
|
@@ -4518,6 +4525,44 @@
|
|
|
4518
4525
|
const apiHeaders = {};
|
|
4519
4526
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
4520
4527
|
}
|
|
4528
|
+
/**
|
|
4529
|
+
* Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
4530
|
+
*
|
|
4531
|
+
* @param {string} databaseId
|
|
4532
|
+
* @param {string} collectionId
|
|
4533
|
+
* @param {string} documentId
|
|
4534
|
+
* @param {object} data
|
|
4535
|
+
* @param {string[]} permissions
|
|
4536
|
+
* @throws {AppwriteException}
|
|
4537
|
+
* @returns {Promise<Document>}
|
|
4538
|
+
*/
|
|
4539
|
+
upsertDocument(databaseId, collectionId, documentId, data, permissions) {
|
|
4540
|
+
if (typeof databaseId === 'undefined') {
|
|
4541
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
4542
|
+
}
|
|
4543
|
+
if (typeof collectionId === 'undefined') {
|
|
4544
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
4545
|
+
}
|
|
4546
|
+
if (typeof documentId === 'undefined') {
|
|
4547
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
4548
|
+
}
|
|
4549
|
+
if (typeof data === 'undefined') {
|
|
4550
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
4551
|
+
}
|
|
4552
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
4553
|
+
const payload = {};
|
|
4554
|
+
if (typeof data !== 'undefined') {
|
|
4555
|
+
payload['data'] = data;
|
|
4556
|
+
}
|
|
4557
|
+
if (typeof permissions !== 'undefined') {
|
|
4558
|
+
payload['permissions'] = permissions;
|
|
4559
|
+
}
|
|
4560
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4561
|
+
const apiHeaders = {
|
|
4562
|
+
'content-type': 'application/json',
|
|
4563
|
+
};
|
|
4564
|
+
return this.client.call('put', uri, apiHeaders, payload);
|
|
4565
|
+
}
|
|
4521
4566
|
/**
|
|
4522
4567
|
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
4523
4568
|
*
|
|
@@ -4609,6 +4654,84 @@
|
|
|
4609
4654
|
const apiHeaders = {};
|
|
4610
4655
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
4611
4656
|
}
|
|
4657
|
+
/**
|
|
4658
|
+
* Decrement a specific attribute of a document by a given value.
|
|
4659
|
+
*
|
|
4660
|
+
* @param {string} databaseId
|
|
4661
|
+
* @param {string} collectionId
|
|
4662
|
+
* @param {string} documentId
|
|
4663
|
+
* @param {string} attribute
|
|
4664
|
+
* @param {number} value
|
|
4665
|
+
* @param {number} min
|
|
4666
|
+
* @throws {AppwriteException}
|
|
4667
|
+
* @returns {Promise<Document>}
|
|
4668
|
+
*/
|
|
4669
|
+
decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min) {
|
|
4670
|
+
if (typeof databaseId === 'undefined') {
|
|
4671
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
4672
|
+
}
|
|
4673
|
+
if (typeof collectionId === 'undefined') {
|
|
4674
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
4675
|
+
}
|
|
4676
|
+
if (typeof documentId === 'undefined') {
|
|
4677
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
4678
|
+
}
|
|
4679
|
+
if (typeof attribute === 'undefined') {
|
|
4680
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
4681
|
+
}
|
|
4682
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
4683
|
+
const payload = {};
|
|
4684
|
+
if (typeof value !== 'undefined') {
|
|
4685
|
+
payload['value'] = value;
|
|
4686
|
+
}
|
|
4687
|
+
if (typeof min !== 'undefined') {
|
|
4688
|
+
payload['min'] = min;
|
|
4689
|
+
}
|
|
4690
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4691
|
+
const apiHeaders = {
|
|
4692
|
+
'content-type': 'application/json',
|
|
4693
|
+
};
|
|
4694
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
4695
|
+
}
|
|
4696
|
+
/**
|
|
4697
|
+
* Increment a specific attribute of a document by a given value.
|
|
4698
|
+
*
|
|
4699
|
+
* @param {string} databaseId
|
|
4700
|
+
* @param {string} collectionId
|
|
4701
|
+
* @param {string} documentId
|
|
4702
|
+
* @param {string} attribute
|
|
4703
|
+
* @param {number} value
|
|
4704
|
+
* @param {number} max
|
|
4705
|
+
* @throws {AppwriteException}
|
|
4706
|
+
* @returns {Promise<Document>}
|
|
4707
|
+
*/
|
|
4708
|
+
incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max) {
|
|
4709
|
+
if (typeof databaseId === 'undefined') {
|
|
4710
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
4711
|
+
}
|
|
4712
|
+
if (typeof collectionId === 'undefined') {
|
|
4713
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
4714
|
+
}
|
|
4715
|
+
if (typeof documentId === 'undefined') {
|
|
4716
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
4717
|
+
}
|
|
4718
|
+
if (typeof attribute === 'undefined') {
|
|
4719
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
4720
|
+
}
|
|
4721
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
4722
|
+
const payload = {};
|
|
4723
|
+
if (typeof value !== 'undefined') {
|
|
4724
|
+
payload['value'] = value;
|
|
4725
|
+
}
|
|
4726
|
+
if (typeof max !== 'undefined') {
|
|
4727
|
+
payload['max'] = max;
|
|
4728
|
+
}
|
|
4729
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4730
|
+
const apiHeaders = {
|
|
4731
|
+
'content-type': 'application/json',
|
|
4732
|
+
};
|
|
4733
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
4734
|
+
}
|
|
4612
4735
|
/**
|
|
4613
4736
|
* List indexes in the collection.
|
|
4614
4737
|
*
|
|
@@ -6382,14 +6505,10 @@
|
|
|
6382
6505
|
* @param {boolean} providerSilentMode
|
|
6383
6506
|
* @param {string} providerRootDirectory
|
|
6384
6507
|
* @param {string} specification
|
|
6385
|
-
* @param {string} templateRepository
|
|
6386
|
-
* @param {string} templateOwner
|
|
6387
|
-
* @param {string} templateRootDirectory
|
|
6388
|
-
* @param {string} templateVersion
|
|
6389
6508
|
* @throws {AppwriteException}
|
|
6390
6509
|
* @returns {Promise<Models.Function>}
|
|
6391
6510
|
*/
|
|
6392
|
-
create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification
|
|
6511
|
+
create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) {
|
|
6393
6512
|
if (typeof functionId === 'undefined') {
|
|
6394
6513
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
6395
6514
|
}
|
|
@@ -6455,18 +6574,6 @@
|
|
|
6455
6574
|
if (typeof specification !== 'undefined') {
|
|
6456
6575
|
payload['specification'] = specification;
|
|
6457
6576
|
}
|
|
6458
|
-
if (typeof templateRepository !== 'undefined') {
|
|
6459
|
-
payload['templateRepository'] = templateRepository;
|
|
6460
|
-
}
|
|
6461
|
-
if (typeof templateOwner !== 'undefined') {
|
|
6462
|
-
payload['templateOwner'] = templateOwner;
|
|
6463
|
-
}
|
|
6464
|
-
if (typeof templateRootDirectory !== 'undefined') {
|
|
6465
|
-
payload['templateRootDirectory'] = templateRootDirectory;
|
|
6466
|
-
}
|
|
6467
|
-
if (typeof templateVersion !== 'undefined') {
|
|
6468
|
-
payload['templateVersion'] = templateVersion;
|
|
6469
|
-
}
|
|
6470
6577
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
6471
6578
|
const apiHeaders = {
|
|
6472
6579
|
'content-type': 'application/json',
|
|
@@ -7407,14 +7514,31 @@
|
|
|
7407
7514
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
7408
7515
|
}
|
|
7409
7516
|
/**
|
|
7410
|
-
* Get billing aggregation queue
|
|
7517
|
+
* Get billing project aggregation queue
|
|
7411
7518
|
*
|
|
7412
7519
|
* @param {number} threshold
|
|
7413
7520
|
* @throws {AppwriteException}
|
|
7414
7521
|
* @returns {Promise<Models.HealthQueue>}
|
|
7415
7522
|
*/
|
|
7416
|
-
|
|
7417
|
-
const apiPath = '/health/queue/billing-aggregation';
|
|
7523
|
+
getQueueBillingProjectAggregation(threshold) {
|
|
7524
|
+
const apiPath = '/health/queue/billing-project-aggregation';
|
|
7525
|
+
const payload = {};
|
|
7526
|
+
if (typeof threshold !== 'undefined') {
|
|
7527
|
+
payload['threshold'] = threshold;
|
|
7528
|
+
}
|
|
7529
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
7530
|
+
const apiHeaders = {};
|
|
7531
|
+
return this.client.call('get', uri, apiHeaders, payload);
|
|
7532
|
+
}
|
|
7533
|
+
/**
|
|
7534
|
+
* Get billing team aggregation queue
|
|
7535
|
+
*
|
|
7536
|
+
* @param {number} threshold
|
|
7537
|
+
* @throws {AppwriteException}
|
|
7538
|
+
* @returns {Promise<Models.HealthQueue>}
|
|
7539
|
+
*/
|
|
7540
|
+
getQueueBillingTeamAggregation(threshold) {
|
|
7541
|
+
const apiPath = '/health/queue/billing-team-aggregation';
|
|
7418
7542
|
const payload = {};
|
|
7419
7543
|
if (typeof threshold !== 'undefined') {
|
|
7420
7544
|
payload['threshold'] = threshold;
|
|
@@ -10257,6 +10381,40 @@
|
|
|
10257
10381
|
};
|
|
10258
10382
|
return this.client.call('post', uri, apiHeaders, payload);
|
|
10259
10383
|
}
|
|
10384
|
+
/**
|
|
10385
|
+
* Get estimation for creating an organization.
|
|
10386
|
+
*
|
|
10387
|
+
* @param {BillingPlan} billingPlan
|
|
10388
|
+
* @param {string} paymentMethodId
|
|
10389
|
+
* @param {string[]} invites
|
|
10390
|
+
* @param {string} couponId
|
|
10391
|
+
* @throws {AppwriteException}
|
|
10392
|
+
* @returns {Promise<Models.Estimation>}
|
|
10393
|
+
*/
|
|
10394
|
+
estimationCreateOrganization(billingPlan, paymentMethodId, invites, couponId) {
|
|
10395
|
+
if (typeof billingPlan === 'undefined') {
|
|
10396
|
+
throw new AppwriteException('Missing required parameter: "billingPlan"');
|
|
10397
|
+
}
|
|
10398
|
+
const apiPath = '/organizations/estimations/create-organization';
|
|
10399
|
+
const payload = {};
|
|
10400
|
+
if (typeof billingPlan !== 'undefined') {
|
|
10401
|
+
payload['billingPlan'] = billingPlan;
|
|
10402
|
+
}
|
|
10403
|
+
if (typeof paymentMethodId !== 'undefined') {
|
|
10404
|
+
payload['paymentMethodId'] = paymentMethodId;
|
|
10405
|
+
}
|
|
10406
|
+
if (typeof invites !== 'undefined') {
|
|
10407
|
+
payload['invites'] = invites;
|
|
10408
|
+
}
|
|
10409
|
+
if (typeof couponId !== 'undefined') {
|
|
10410
|
+
payload['couponId'] = couponId;
|
|
10411
|
+
}
|
|
10412
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
10413
|
+
const apiHeaders = {
|
|
10414
|
+
'content-type': 'application/json',
|
|
10415
|
+
};
|
|
10416
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
10417
|
+
}
|
|
10260
10418
|
/**
|
|
10261
10419
|
* Delete an organization.
|
|
10262
10420
|
*
|
|
@@ -10509,6 +10667,59 @@
|
|
|
10509
10667
|
const apiHeaders = {};
|
|
10510
10668
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
10511
10669
|
}
|
|
10670
|
+
/**
|
|
10671
|
+
* Get estimation for deleting an organization.
|
|
10672
|
+
*
|
|
10673
|
+
* @param {string} organizationId
|
|
10674
|
+
* @throws {AppwriteException}
|
|
10675
|
+
* @returns {Promise<Models.EstimationDeleteOrganization>}
|
|
10676
|
+
*/
|
|
10677
|
+
estimationDeleteOrganization(organizationId) {
|
|
10678
|
+
if (typeof organizationId === 'undefined') {
|
|
10679
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
10680
|
+
}
|
|
10681
|
+
const apiPath = '/organizations/{organizationId}/estimations/delete-organization'.replace('{organizationId}', organizationId);
|
|
10682
|
+
const payload = {};
|
|
10683
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
10684
|
+
const apiHeaders = {
|
|
10685
|
+
'content-type': 'application/json',
|
|
10686
|
+
};
|
|
10687
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
10688
|
+
}
|
|
10689
|
+
/**
|
|
10690
|
+
* Get estimation for updating the organization plan.
|
|
10691
|
+
*
|
|
10692
|
+
* @param {string} organizationId
|
|
10693
|
+
* @param {BillingPlan} billingPlan
|
|
10694
|
+
* @param {string[]} invites
|
|
10695
|
+
* @param {string} couponId
|
|
10696
|
+
* @throws {AppwriteException}
|
|
10697
|
+
* @returns {Promise<Models.EstimationUpdatePlan>}
|
|
10698
|
+
*/
|
|
10699
|
+
estimationUpdatePlan(organizationId, billingPlan, invites, couponId) {
|
|
10700
|
+
if (typeof organizationId === 'undefined') {
|
|
10701
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
10702
|
+
}
|
|
10703
|
+
if (typeof billingPlan === 'undefined') {
|
|
10704
|
+
throw new AppwriteException('Missing required parameter: "billingPlan"');
|
|
10705
|
+
}
|
|
10706
|
+
const apiPath = '/organizations/{organizationId}/estimations/update-plan'.replace('{organizationId}', organizationId);
|
|
10707
|
+
const payload = {};
|
|
10708
|
+
if (typeof billingPlan !== 'undefined') {
|
|
10709
|
+
payload['billingPlan'] = billingPlan;
|
|
10710
|
+
}
|
|
10711
|
+
if (typeof invites !== 'undefined') {
|
|
10712
|
+
payload['invites'] = invites;
|
|
10713
|
+
}
|
|
10714
|
+
if (typeof couponId !== 'undefined') {
|
|
10715
|
+
payload['couponId'] = couponId;
|
|
10716
|
+
}
|
|
10717
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
10718
|
+
const apiHeaders = {
|
|
10719
|
+
'content-type': 'application/json',
|
|
10720
|
+
};
|
|
10721
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
10722
|
+
}
|
|
10512
10723
|
/**
|
|
10513
10724
|
* List all invoices for an organization.
|
|
10514
10725
|
*
|
|
@@ -10825,6 +11036,25 @@
|
|
|
10825
11036
|
};
|
|
10826
11037
|
return this.client.call('patch', uri, apiHeaders, payload);
|
|
10827
11038
|
}
|
|
11039
|
+
/**
|
|
11040
|
+
* Cancel the downgrade initiated for an organization.
|
|
11041
|
+
*
|
|
11042
|
+
* @param {string} organizationId
|
|
11043
|
+
* @throws {AppwriteException}
|
|
11044
|
+
* @returns {Promise<Models.Organization<Preferences>>}
|
|
11045
|
+
*/
|
|
11046
|
+
cancelDowngrade(organizationId) {
|
|
11047
|
+
if (typeof organizationId === 'undefined') {
|
|
11048
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
11049
|
+
}
|
|
11050
|
+
const apiPath = '/organizations/{organizationId}/plan/cancel'.replace('{organizationId}', organizationId);
|
|
11051
|
+
const payload = {};
|
|
11052
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
11053
|
+
const apiHeaders = {
|
|
11054
|
+
'content-type': 'application/json',
|
|
11055
|
+
};
|
|
11056
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
11057
|
+
}
|
|
10828
11058
|
/**
|
|
10829
11059
|
* Get Scopes
|
|
10830
11060
|
*
|
|
@@ -10868,6 +11098,54 @@
|
|
|
10868
11098
|
};
|
|
10869
11099
|
return this.client.call('patch', uri, apiHeaders, payload);
|
|
10870
11100
|
}
|
|
11101
|
+
/**
|
|
11102
|
+
* Get the usage data for an organization.
|
|
11103
|
+
*
|
|
11104
|
+
* @param {string} organizationId
|
|
11105
|
+
* @param {string} startDate
|
|
11106
|
+
* @param {string} endDate
|
|
11107
|
+
* @throws {AppwriteException}
|
|
11108
|
+
* @returns {Promise<Models.UsageOrganization>}
|
|
11109
|
+
*/
|
|
11110
|
+
getUsage(organizationId, startDate, endDate) {
|
|
11111
|
+
if (typeof organizationId === 'undefined') {
|
|
11112
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
11113
|
+
}
|
|
11114
|
+
const apiPath = '/organizations/{organizationId}/usage'.replace('{organizationId}', organizationId);
|
|
11115
|
+
const payload = {};
|
|
11116
|
+
if (typeof startDate !== 'undefined') {
|
|
11117
|
+
payload['startDate'] = startDate;
|
|
11118
|
+
}
|
|
11119
|
+
if (typeof endDate !== 'undefined') {
|
|
11120
|
+
payload['endDate'] = endDate;
|
|
11121
|
+
}
|
|
11122
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
11123
|
+
const apiHeaders = {};
|
|
11124
|
+
return this.client.call('get', uri, apiHeaders, payload);
|
|
11125
|
+
}
|
|
11126
|
+
/**
|
|
11127
|
+
* Validate payment for team after creation or upgrade.
|
|
11128
|
+
*
|
|
11129
|
+
* @param {string} organizationId
|
|
11130
|
+
* @param {string[]} invites
|
|
11131
|
+
* @throws {AppwriteException}
|
|
11132
|
+
* @returns {Promise<Models.Organization<Preferences>>}
|
|
11133
|
+
*/
|
|
11134
|
+
validatePayment(organizationId, invites) {
|
|
11135
|
+
if (typeof organizationId === 'undefined') {
|
|
11136
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
11137
|
+
}
|
|
11138
|
+
const apiPath = '/organizations/{organizationId}/validate'.replace('{organizationId}', organizationId);
|
|
11139
|
+
const payload = {};
|
|
11140
|
+
if (typeof invites !== 'undefined') {
|
|
11141
|
+
payload['invites'] = invites;
|
|
11142
|
+
}
|
|
11143
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
11144
|
+
const apiHeaders = {
|
|
11145
|
+
'content-type': 'application/json',
|
|
11146
|
+
};
|
|
11147
|
+
return this.client.call('patch', uri, apiHeaders, payload);
|
|
11148
|
+
}
|
|
10871
11149
|
}
|
|
10872
11150
|
|
|
10873
11151
|
class Project {
|
|
@@ -12744,10 +13022,12 @@
|
|
|
12744
13022
|
* @param {string} domain
|
|
12745
13023
|
* @param {string} url
|
|
12746
13024
|
* @param {StatusCode} statusCode
|
|
13025
|
+
* @param {string} resourceId
|
|
13026
|
+
* @param {ProxyResourceType} resourceType
|
|
12747
13027
|
* @throws {AppwriteException}
|
|
12748
13028
|
* @returns {Promise<Models.ProxyRule>}
|
|
12749
13029
|
*/
|
|
12750
|
-
createRedirectRule(domain, url, statusCode) {
|
|
13030
|
+
createRedirectRule(domain, url, statusCode, resourceId, resourceType) {
|
|
12751
13031
|
if (typeof domain === 'undefined') {
|
|
12752
13032
|
throw new AppwriteException('Missing required parameter: "domain"');
|
|
12753
13033
|
}
|
|
@@ -12757,6 +13037,12 @@
|
|
|
12757
13037
|
if (typeof statusCode === 'undefined') {
|
|
12758
13038
|
throw new AppwriteException('Missing required parameter: "statusCode"');
|
|
12759
13039
|
}
|
|
13040
|
+
if (typeof resourceId === 'undefined') {
|
|
13041
|
+
throw new AppwriteException('Missing required parameter: "resourceId"');
|
|
13042
|
+
}
|
|
13043
|
+
if (typeof resourceType === 'undefined') {
|
|
13044
|
+
throw new AppwriteException('Missing required parameter: "resourceType"');
|
|
13045
|
+
}
|
|
12760
13046
|
const apiPath = '/proxy/rules/redirect';
|
|
12761
13047
|
const payload = {};
|
|
12762
13048
|
if (typeof domain !== 'undefined') {
|
|
@@ -12768,6 +13054,12 @@
|
|
|
12768
13054
|
if (typeof statusCode !== 'undefined') {
|
|
12769
13055
|
payload['statusCode'] = statusCode;
|
|
12770
13056
|
}
|
|
13057
|
+
if (typeof resourceId !== 'undefined') {
|
|
13058
|
+
payload['resourceId'] = resourceId;
|
|
13059
|
+
}
|
|
13060
|
+
if (typeof resourceType !== 'undefined') {
|
|
13061
|
+
payload['resourceType'] = resourceType;
|
|
13062
|
+
}
|
|
12771
13063
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
12772
13064
|
const apiHeaders = {
|
|
12773
13065
|
'content-type': 'application/json',
|
|
@@ -14642,7 +14934,7 @@
|
|
|
14642
14934
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
14643
14935
|
}
|
|
14644
14936
|
/**
|
|
14645
|
-
* Create a new token. A token is linked to a file. Token can be passed as a
|
|
14937
|
+
* Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
|
|
14646
14938
|
*
|
|
14647
14939
|
* @param {string} bucketId
|
|
14648
14940
|
* @param {string} fileId
|
|
@@ -16745,6 +17037,7 @@
|
|
|
16745
17037
|
Runtime["Dart31"] = "dart-3.1";
|
|
16746
17038
|
Runtime["Dart33"] = "dart-3.3";
|
|
16747
17039
|
Runtime["Dart35"] = "dart-3.5";
|
|
17040
|
+
Runtime["Dart38"] = "dart-3.8";
|
|
16748
17041
|
Runtime["Dotnet60"] = "dotnet-6.0";
|
|
16749
17042
|
Runtime["Dotnet70"] = "dotnet-7.0";
|
|
16750
17043
|
Runtime["Dotnet80"] = "dotnet-8.0";
|
|
@@ -16771,6 +17064,7 @@
|
|
|
16771
17064
|
Runtime["Flutter324"] = "flutter-3.24";
|
|
16772
17065
|
Runtime["Flutter327"] = "flutter-3.27";
|
|
16773
17066
|
Runtime["Flutter329"] = "flutter-3.29";
|
|
17067
|
+
Runtime["Flutter332"] = "flutter-3.32";
|
|
16774
17068
|
})(exports.Runtime || (exports.Runtime = {}));
|
|
16775
17069
|
|
|
16776
17070
|
exports.FunctionUsageRange = void 0;
|
|
@@ -17208,6 +17502,12 @@
|
|
|
17208
17502
|
StatusCode["PermanentRedirect308"] = "308";
|
|
17209
17503
|
})(exports.StatusCode || (exports.StatusCode = {}));
|
|
17210
17504
|
|
|
17505
|
+
exports.ProxyResourceType = void 0;
|
|
17506
|
+
(function (ProxyResourceType) {
|
|
17507
|
+
ProxyResourceType["Site"] = "site";
|
|
17508
|
+
ProxyResourceType["Function"] = "function";
|
|
17509
|
+
})(exports.ProxyResourceType || (exports.ProxyResourceType = {}));
|
|
17510
|
+
|
|
17211
17511
|
exports.Framework = void 0;
|
|
17212
17512
|
(function (Framework) {
|
|
17213
17513
|
Framework["Analog"] = "analog";
|
|
@@ -17262,6 +17562,7 @@
|
|
|
17262
17562
|
BuildRuntime["Dart31"] = "dart-3.1";
|
|
17263
17563
|
BuildRuntime["Dart33"] = "dart-3.3";
|
|
17264
17564
|
BuildRuntime["Dart35"] = "dart-3.5";
|
|
17565
|
+
BuildRuntime["Dart38"] = "dart-3.8";
|
|
17265
17566
|
BuildRuntime["Dotnet60"] = "dotnet-6.0";
|
|
17266
17567
|
BuildRuntime["Dotnet70"] = "dotnet-7.0";
|
|
17267
17568
|
BuildRuntime["Dotnet80"] = "dotnet-8.0";
|
|
@@ -17288,6 +17589,7 @@
|
|
|
17288
17589
|
BuildRuntime["Flutter324"] = "flutter-3.24";
|
|
17289
17590
|
BuildRuntime["Flutter327"] = "flutter-3.27";
|
|
17290
17591
|
BuildRuntime["Flutter329"] = "flutter-3.29";
|
|
17592
|
+
BuildRuntime["Flutter332"] = "flutter-3.32";
|
|
17291
17593
|
})(exports.BuildRuntime || (exports.BuildRuntime = {}));
|
|
17292
17594
|
|
|
17293
17595
|
exports.Adapter = void 0;
|
|
@@ -17331,6 +17633,7 @@
|
|
|
17331
17633
|
ImageFormat["Webp"] = "webp";
|
|
17332
17634
|
ImageFormat["Heic"] = "heic";
|
|
17333
17635
|
ImageFormat["Avif"] = "avif";
|
|
17636
|
+
ImageFormat["Gif"] = "gif";
|
|
17334
17637
|
})(exports.ImageFormat || (exports.ImageFormat = {}));
|
|
17335
17638
|
|
|
17336
17639
|
exports.StorageUsageRange = void 0;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Databases } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const databases = new Databases(client);
|
|
8
|
+
|
|
9
|
+
const result = await databases.decrementDocumentAttribute(
|
|
10
|
+
'<DATABASE_ID>', // databaseId
|
|
11
|
+
'<COLLECTION_ID>', // collectionId
|
|
12
|
+
'<DOCUMENT_ID>', // documentId
|
|
13
|
+
'', // attribute
|
|
14
|
+
null, // value (optional)
|
|
15
|
+
null // min (optional)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(result);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Databases } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const databases = new Databases(client);
|
|
8
|
+
|
|
9
|
+
const result = await databases.incrementDocumentAttribute(
|
|
10
|
+
'<DATABASE_ID>', // databaseId
|
|
11
|
+
'<COLLECTION_ID>', // collectionId
|
|
12
|
+
'<DOCUMENT_ID>', // documentId
|
|
13
|
+
'', // attribute
|
|
14
|
+
null, // value (optional)
|
|
15
|
+
null // max (optional)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(result);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Client, Databases } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const databases = new Databases(client);
|
|
8
|
+
|
|
9
|
+
const result = await databases.upsertDocument(
|
|
10
|
+
'<DATABASE_ID>', // databaseId
|
|
11
|
+
'<COLLECTION_ID>', // collectionId
|
|
12
|
+
'<DOCUMENT_ID>', // documentId
|
|
13
|
+
{}, // data
|
|
14
|
+
["read("any")"] // permissions (optional)
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
console.log(result);
|