@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/src/models.ts
CHANGED
|
@@ -735,6 +735,10 @@ export namespace Models {
|
|
|
735
735
|
* Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
736
736
|
*/
|
|
737
737
|
default?: string;
|
|
738
|
+
/**
|
|
739
|
+
* Defines whether this attribute is encrypted or not.
|
|
740
|
+
*/
|
|
741
|
+
encrypt?: boolean;
|
|
738
742
|
}
|
|
739
743
|
/**
|
|
740
744
|
* AttributeInteger
|
|
@@ -1214,6 +1218,10 @@ export namespace Models {
|
|
|
1214
1218
|
* Document ID.
|
|
1215
1219
|
*/
|
|
1216
1220
|
$id: string;
|
|
1221
|
+
/**
|
|
1222
|
+
* Document automatically incrementing ID.
|
|
1223
|
+
*/
|
|
1224
|
+
$sequence: number;
|
|
1217
1225
|
/**
|
|
1218
1226
|
* Collection ID.
|
|
1219
1227
|
*/
|
|
@@ -5370,6 +5378,10 @@ export namespace Models {
|
|
|
5370
5378
|
* Does plan support mock numbers
|
|
5371
5379
|
*/
|
|
5372
5380
|
supportsMockNumbers: boolean;
|
|
5381
|
+
/**
|
|
5382
|
+
* Does plan support organization roles
|
|
5383
|
+
*/
|
|
5384
|
+
supportsOrganizationRoles: boolean;
|
|
5373
5385
|
/**
|
|
5374
5386
|
* Does plan support credit
|
|
5375
5387
|
*/
|
|
@@ -5382,6 +5394,18 @@ export namespace Models {
|
|
|
5382
5394
|
* How many policies does plan support
|
|
5383
5395
|
*/
|
|
5384
5396
|
backupPolicies: number;
|
|
5397
|
+
/**
|
|
5398
|
+
* Maximum function and site deployment size in MB
|
|
5399
|
+
*/
|
|
5400
|
+
deploymentSize: number;
|
|
5401
|
+
/**
|
|
5402
|
+
* Maximum function and site deployment size in MB
|
|
5403
|
+
*/
|
|
5404
|
+
buildSize: number;
|
|
5405
|
+
/**
|
|
5406
|
+
* Does the plan support encrypted string attributes or not.
|
|
5407
|
+
*/
|
|
5408
|
+
databasesAllowEncrypt: boolean;
|
|
5385
5409
|
}
|
|
5386
5410
|
/**
|
|
5387
5411
|
* BillingPlanAddon
|
|
@@ -5820,9 +5844,9 @@ export namespace Models {
|
|
|
5820
5844
|
*/
|
|
5821
5845
|
billingLimits: BillingLimits;
|
|
5822
5846
|
/**
|
|
5823
|
-
* Billing plan downgrade
|
|
5847
|
+
* Billing plan selected for downgrade.
|
|
5824
5848
|
*/
|
|
5825
|
-
billingPlanDowngrade:
|
|
5849
|
+
billingPlanDowngrade: string;
|
|
5826
5850
|
/**
|
|
5827
5851
|
* Tax Id
|
|
5828
5852
|
*/
|
|
@@ -6074,6 +6098,164 @@ export namespace Models {
|
|
|
6074
6098
|
*/
|
|
6075
6099
|
roles: string[];
|
|
6076
6100
|
}
|
|
6101
|
+
/**
|
|
6102
|
+
* UsageOrganization
|
|
6103
|
+
*/
|
|
6104
|
+
export type UsageOrganization = {
|
|
6105
|
+
/**
|
|
6106
|
+
* Aggregated stats for number of requests.
|
|
6107
|
+
*/
|
|
6108
|
+
bandwidth: Metric[];
|
|
6109
|
+
/**
|
|
6110
|
+
* Aggregated stats for consumed bandwidth.
|
|
6111
|
+
*/
|
|
6112
|
+
users: Metric[];
|
|
6113
|
+
/**
|
|
6114
|
+
* Aggregated stats for function executions.
|
|
6115
|
+
*/
|
|
6116
|
+
executions: Metric[];
|
|
6117
|
+
/**
|
|
6118
|
+
* Aggregated stats for database reads.
|
|
6119
|
+
*/
|
|
6120
|
+
databasesReads: Metric[];
|
|
6121
|
+
/**
|
|
6122
|
+
* Aggregated stats for database writes.
|
|
6123
|
+
*/
|
|
6124
|
+
databasesWrites: Metric[];
|
|
6125
|
+
/**
|
|
6126
|
+
* Aggregated stats for file transformations.
|
|
6127
|
+
*/
|
|
6128
|
+
imageTransformations: Metric[];
|
|
6129
|
+
/**
|
|
6130
|
+
* Aggregated stats for total file transformations.
|
|
6131
|
+
*/
|
|
6132
|
+
imageTransformationsTotal: number;
|
|
6133
|
+
/**
|
|
6134
|
+
* Aggregated stats for total users.
|
|
6135
|
+
*/
|
|
6136
|
+
usersTotal: number;
|
|
6137
|
+
/**
|
|
6138
|
+
* Aggregated stats for total executions.
|
|
6139
|
+
*/
|
|
6140
|
+
executionsTotal: number;
|
|
6141
|
+
/**
|
|
6142
|
+
* Aggregated stats for function executions in mb seconds.
|
|
6143
|
+
*/
|
|
6144
|
+
executionsMBSecondsTotal: number;
|
|
6145
|
+
/**
|
|
6146
|
+
* Aggregated stats for function builds in mb seconds.
|
|
6147
|
+
*/
|
|
6148
|
+
buildsMBSecondsTotal: number;
|
|
6149
|
+
/**
|
|
6150
|
+
* Aggregated stats for total file storage.
|
|
6151
|
+
*/
|
|
6152
|
+
filesStorageTotal: number;
|
|
6153
|
+
/**
|
|
6154
|
+
* Aggregated stats for total builds storage.
|
|
6155
|
+
*/
|
|
6156
|
+
buildsStorageTotal: number;
|
|
6157
|
+
/**
|
|
6158
|
+
* Aggregated stats for total deployments storage.
|
|
6159
|
+
*/
|
|
6160
|
+
deploymentsStorageTotal: number;
|
|
6161
|
+
/**
|
|
6162
|
+
* Aggregated stats for total databases storage.
|
|
6163
|
+
*/
|
|
6164
|
+
databasesStorageTotal: number;
|
|
6165
|
+
/**
|
|
6166
|
+
* Aggregated stats for total databases reads.
|
|
6167
|
+
*/
|
|
6168
|
+
databasesReadsTotal: number;
|
|
6169
|
+
/**
|
|
6170
|
+
* Aggregated stats for total databases writes.
|
|
6171
|
+
*/
|
|
6172
|
+
databasesWritesTotal: number;
|
|
6173
|
+
/**
|
|
6174
|
+
* Aggregated stats for total backups storage.
|
|
6175
|
+
*/
|
|
6176
|
+
backupsStorageTotal: number;
|
|
6177
|
+
/**
|
|
6178
|
+
* Aggregated stats for total storage.
|
|
6179
|
+
*/
|
|
6180
|
+
storageTotal: number;
|
|
6181
|
+
/**
|
|
6182
|
+
* Aggregated stats for total auth phone.
|
|
6183
|
+
*/
|
|
6184
|
+
authPhoneTotal: number;
|
|
6185
|
+
/**
|
|
6186
|
+
* Aggregated stats for total auth phone estimation.
|
|
6187
|
+
*/
|
|
6188
|
+
authPhoneEstimate: number;
|
|
6189
|
+
/**
|
|
6190
|
+
* Aggregated stats for each projects.
|
|
6191
|
+
*/
|
|
6192
|
+
projects: UsageOrganizationProject[];
|
|
6193
|
+
}
|
|
6194
|
+
/**
|
|
6195
|
+
* UsageOrganizationProject
|
|
6196
|
+
*/
|
|
6197
|
+
export type UsageOrganizationProject = {
|
|
6198
|
+
/**
|
|
6199
|
+
* projectId
|
|
6200
|
+
*/
|
|
6201
|
+
projectId: string;
|
|
6202
|
+
/**
|
|
6203
|
+
* Aggregated stats for number of requests.
|
|
6204
|
+
*/
|
|
6205
|
+
bandwidth: Metric[];
|
|
6206
|
+
/**
|
|
6207
|
+
* Aggregated stats for consumed bandwidth.
|
|
6208
|
+
*/
|
|
6209
|
+
users: Metric[];
|
|
6210
|
+
/**
|
|
6211
|
+
* Aggregated stats for function executions.
|
|
6212
|
+
*/
|
|
6213
|
+
executions: number;
|
|
6214
|
+
/**
|
|
6215
|
+
* Aggregated stats for database reads.
|
|
6216
|
+
*/
|
|
6217
|
+
databasesReads: Metric[];
|
|
6218
|
+
/**
|
|
6219
|
+
* Aggregated stats for database writes.
|
|
6220
|
+
*/
|
|
6221
|
+
databasesWrites: Metric[];
|
|
6222
|
+
/**
|
|
6223
|
+
* Aggregated stats for function executions in mb seconds.
|
|
6224
|
+
*/
|
|
6225
|
+
executionsMBSeconds: number;
|
|
6226
|
+
/**
|
|
6227
|
+
* Aggregated stats for function builds in mb seconds.
|
|
6228
|
+
*/
|
|
6229
|
+
buildsMBSeconds: number;
|
|
6230
|
+
/**
|
|
6231
|
+
* Aggregated stats for number of documents.
|
|
6232
|
+
*/
|
|
6233
|
+
storage: number;
|
|
6234
|
+
/**
|
|
6235
|
+
* Aggregated stats for phone authentication.
|
|
6236
|
+
*/
|
|
6237
|
+
authPhoneTotal: number;
|
|
6238
|
+
/**
|
|
6239
|
+
* Aggregated stats for phone authentication estimated cost.
|
|
6240
|
+
*/
|
|
6241
|
+
authPhoneEstimate: number;
|
|
6242
|
+
/**
|
|
6243
|
+
* Aggregated stats for total databases reads.
|
|
6244
|
+
*/
|
|
6245
|
+
databasesReadsTotal: number;
|
|
6246
|
+
/**
|
|
6247
|
+
* Aggregated stats for total databases writes.
|
|
6248
|
+
*/
|
|
6249
|
+
databasesWritesTotal: number;
|
|
6250
|
+
/**
|
|
6251
|
+
* Aggregated stats for file transformations.
|
|
6252
|
+
*/
|
|
6253
|
+
imageTransformations: Metric[];
|
|
6254
|
+
/**
|
|
6255
|
+
* Aggregated stats for total file transformations.
|
|
6256
|
+
*/
|
|
6257
|
+
imageTransformationsTotal: number;
|
|
6258
|
+
}
|
|
6077
6259
|
/**
|
|
6078
6260
|
* Domain
|
|
6079
6261
|
*/
|
|
@@ -6242,6 +6424,106 @@ export namespace Models {
|
|
|
6242
6424
|
*/
|
|
6243
6425
|
imageTransformations: AdditionalResource;
|
|
6244
6426
|
}
|
|
6427
|
+
/**
|
|
6428
|
+
* Estimation
|
|
6429
|
+
*/
|
|
6430
|
+
export type Estimation = {
|
|
6431
|
+
/**
|
|
6432
|
+
* Total amount
|
|
6433
|
+
*/
|
|
6434
|
+
amount: number;
|
|
6435
|
+
/**
|
|
6436
|
+
* Gross payable amount
|
|
6437
|
+
*/
|
|
6438
|
+
grossAmount: number;
|
|
6439
|
+
/**
|
|
6440
|
+
* Discount amount
|
|
6441
|
+
*/
|
|
6442
|
+
discount: number;
|
|
6443
|
+
/**
|
|
6444
|
+
* Credits amount
|
|
6445
|
+
*/
|
|
6446
|
+
credits: number;
|
|
6447
|
+
/**
|
|
6448
|
+
* Estimation items
|
|
6449
|
+
*/
|
|
6450
|
+
items: EstimationItem[];
|
|
6451
|
+
/**
|
|
6452
|
+
* Estimation discount items
|
|
6453
|
+
*/
|
|
6454
|
+
discounts: EstimationItem[];
|
|
6455
|
+
/**
|
|
6456
|
+
* Trial days
|
|
6457
|
+
*/
|
|
6458
|
+
trialDays: number;
|
|
6459
|
+
/**
|
|
6460
|
+
* Trial end date
|
|
6461
|
+
*/
|
|
6462
|
+
trialEndDate?: string;
|
|
6463
|
+
}
|
|
6464
|
+
/**
|
|
6465
|
+
* EstimationUpdatePlan
|
|
6466
|
+
*/
|
|
6467
|
+
export type EstimationUpdatePlan = {
|
|
6468
|
+
/**
|
|
6469
|
+
* Total amount
|
|
6470
|
+
*/
|
|
6471
|
+
amount: number;
|
|
6472
|
+
/**
|
|
6473
|
+
* Gross payable amount
|
|
6474
|
+
*/
|
|
6475
|
+
grossAmount: number;
|
|
6476
|
+
/**
|
|
6477
|
+
* Discount amount
|
|
6478
|
+
*/
|
|
6479
|
+
discount: number;
|
|
6480
|
+
/**
|
|
6481
|
+
* Credits amount
|
|
6482
|
+
*/
|
|
6483
|
+
credits: number;
|
|
6484
|
+
/**
|
|
6485
|
+
* Estimation items
|
|
6486
|
+
*/
|
|
6487
|
+
items: EstimationItem[];
|
|
6488
|
+
/**
|
|
6489
|
+
* Estimation discount items
|
|
6490
|
+
*/
|
|
6491
|
+
discounts: EstimationItem[];
|
|
6492
|
+
/**
|
|
6493
|
+
* Trial days
|
|
6494
|
+
*/
|
|
6495
|
+
trialDays: number;
|
|
6496
|
+
/**
|
|
6497
|
+
* Trial end date
|
|
6498
|
+
*/
|
|
6499
|
+
trialEndDate?: string;
|
|
6500
|
+
/**
|
|
6501
|
+
* Organization's existing credits
|
|
6502
|
+
*/
|
|
6503
|
+
organizationCredits: number;
|
|
6504
|
+
}
|
|
6505
|
+
/**
|
|
6506
|
+
* EstimationDeleteOrganization
|
|
6507
|
+
*/
|
|
6508
|
+
export type EstimationDeleteOrganization = {
|
|
6509
|
+
/**
|
|
6510
|
+
* List of unpaid invoices
|
|
6511
|
+
*/
|
|
6512
|
+
unpaidInvoices: Invoice[];
|
|
6513
|
+
}
|
|
6514
|
+
/**
|
|
6515
|
+
* EstimationItem
|
|
6516
|
+
*/
|
|
6517
|
+
export type EstimationItem = {
|
|
6518
|
+
/**
|
|
6519
|
+
* Label
|
|
6520
|
+
*/
|
|
6521
|
+
label: string;
|
|
6522
|
+
/**
|
|
6523
|
+
* Gross payable amount
|
|
6524
|
+
*/
|
|
6525
|
+
value: number;
|
|
6526
|
+
}
|
|
6245
6527
|
/**
|
|
6246
6528
|
* Aggregation team list
|
|
6247
6529
|
*/
|
|
@@ -1733,13 +1733,16 @@ export class Databases {
|
|
|
1733
1733
|
* @throws {AppwriteException}
|
|
1734
1734
|
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1735
1735
|
*/
|
|
1736
|
-
upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents
|
|
1736
|
+
upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>> {
|
|
1737
1737
|
if (typeof databaseId === 'undefined') {
|
|
1738
1738
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1739
1739
|
}
|
|
1740
1740
|
if (typeof collectionId === 'undefined') {
|
|
1741
1741
|
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1742
1742
|
}
|
|
1743
|
+
if (typeof documents === 'undefined') {
|
|
1744
|
+
throw new AppwriteException('Missing required parameter: "documents"');
|
|
1745
|
+
}
|
|
1743
1746
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1744
1747
|
const payload: Payload = {};
|
|
1745
1748
|
if (typeof documents !== 'undefined') {
|
|
@@ -1867,6 +1870,51 @@ export class Databases {
|
|
|
1867
1870
|
payload
|
|
1868
1871
|
);
|
|
1869
1872
|
}
|
|
1873
|
+
/**
|
|
1874
|
+
* 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.
|
|
1875
|
+
*
|
|
1876
|
+
* @param {string} databaseId
|
|
1877
|
+
* @param {string} collectionId
|
|
1878
|
+
* @param {string} documentId
|
|
1879
|
+
* @param {object} data
|
|
1880
|
+
* @param {string[]} permissions
|
|
1881
|
+
* @throws {AppwriteException}
|
|
1882
|
+
* @returns {Promise<Document>}
|
|
1883
|
+
*/
|
|
1884
|
+
upsertDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document> {
|
|
1885
|
+
if (typeof databaseId === 'undefined') {
|
|
1886
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1887
|
+
}
|
|
1888
|
+
if (typeof collectionId === 'undefined') {
|
|
1889
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1890
|
+
}
|
|
1891
|
+
if (typeof documentId === 'undefined') {
|
|
1892
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1893
|
+
}
|
|
1894
|
+
if (typeof data === 'undefined') {
|
|
1895
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
1896
|
+
}
|
|
1897
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1898
|
+
const payload: Payload = {};
|
|
1899
|
+
if (typeof data !== 'undefined') {
|
|
1900
|
+
payload['data'] = data;
|
|
1901
|
+
}
|
|
1902
|
+
if (typeof permissions !== 'undefined') {
|
|
1903
|
+
payload['permissions'] = permissions;
|
|
1904
|
+
}
|
|
1905
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1906
|
+
|
|
1907
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1908
|
+
'content-type': 'application/json',
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
return this.client.call(
|
|
1912
|
+
'put',
|
|
1913
|
+
uri,
|
|
1914
|
+
apiHeaders,
|
|
1915
|
+
payload
|
|
1916
|
+
);
|
|
1917
|
+
}
|
|
1870
1918
|
/**
|
|
1871
1919
|
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
1872
1920
|
*
|
|
@@ -1980,6 +2028,98 @@ export class Databases {
|
|
|
1980
2028
|
payload
|
|
1981
2029
|
);
|
|
1982
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Decrement a specific attribute of a document by a given value.
|
|
2033
|
+
*
|
|
2034
|
+
* @param {string} databaseId
|
|
2035
|
+
* @param {string} collectionId
|
|
2036
|
+
* @param {string} documentId
|
|
2037
|
+
* @param {string} attribute
|
|
2038
|
+
* @param {number} value
|
|
2039
|
+
* @param {number} min
|
|
2040
|
+
* @throws {AppwriteException}
|
|
2041
|
+
* @returns {Promise<Document>}
|
|
2042
|
+
*/
|
|
2043
|
+
decrementDocumentAttribute<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise<Document> {
|
|
2044
|
+
if (typeof databaseId === 'undefined') {
|
|
2045
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2046
|
+
}
|
|
2047
|
+
if (typeof collectionId === 'undefined') {
|
|
2048
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2049
|
+
}
|
|
2050
|
+
if (typeof documentId === 'undefined') {
|
|
2051
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2052
|
+
}
|
|
2053
|
+
if (typeof attribute === 'undefined') {
|
|
2054
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
2055
|
+
}
|
|
2056
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
2057
|
+
const payload: Payload = {};
|
|
2058
|
+
if (typeof value !== 'undefined') {
|
|
2059
|
+
payload['value'] = value;
|
|
2060
|
+
}
|
|
2061
|
+
if (typeof min !== 'undefined') {
|
|
2062
|
+
payload['min'] = min;
|
|
2063
|
+
}
|
|
2064
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2065
|
+
|
|
2066
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2067
|
+
'content-type': 'application/json',
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
return this.client.call(
|
|
2071
|
+
'patch',
|
|
2072
|
+
uri,
|
|
2073
|
+
apiHeaders,
|
|
2074
|
+
payload
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Increment a specific attribute of a document by a given value.
|
|
2079
|
+
*
|
|
2080
|
+
* @param {string} databaseId
|
|
2081
|
+
* @param {string} collectionId
|
|
2082
|
+
* @param {string} documentId
|
|
2083
|
+
* @param {string} attribute
|
|
2084
|
+
* @param {number} value
|
|
2085
|
+
* @param {number} max
|
|
2086
|
+
* @throws {AppwriteException}
|
|
2087
|
+
* @returns {Promise<Document>}
|
|
2088
|
+
*/
|
|
2089
|
+
incrementDocumentAttribute<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise<Document> {
|
|
2090
|
+
if (typeof databaseId === 'undefined') {
|
|
2091
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2092
|
+
}
|
|
2093
|
+
if (typeof collectionId === 'undefined') {
|
|
2094
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2095
|
+
}
|
|
2096
|
+
if (typeof documentId === 'undefined') {
|
|
2097
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2098
|
+
}
|
|
2099
|
+
if (typeof attribute === 'undefined') {
|
|
2100
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
2101
|
+
}
|
|
2102
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
2103
|
+
const payload: Payload = {};
|
|
2104
|
+
if (typeof value !== 'undefined') {
|
|
2105
|
+
payload['value'] = value;
|
|
2106
|
+
}
|
|
2107
|
+
if (typeof max !== 'undefined') {
|
|
2108
|
+
payload['max'] = max;
|
|
2109
|
+
}
|
|
2110
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2111
|
+
|
|
2112
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2113
|
+
'content-type': 'application/json',
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
return this.client.call(
|
|
2117
|
+
'patch',
|
|
2118
|
+
uri,
|
|
2119
|
+
apiHeaders,
|
|
2120
|
+
payload
|
|
2121
|
+
);
|
|
2122
|
+
}
|
|
1983
2123
|
/**
|
|
1984
2124
|
* List indexes in the collection.
|
|
1985
2125
|
*
|
|
@@ -64,14 +64,10 @@ export class Functions {
|
|
|
64
64
|
* @param {boolean} providerSilentMode
|
|
65
65
|
* @param {string} providerRootDirectory
|
|
66
66
|
* @param {string} specification
|
|
67
|
-
* @param {string} templateRepository
|
|
68
|
-
* @param {string} templateOwner
|
|
69
|
-
* @param {string} templateRootDirectory
|
|
70
|
-
* @param {string} templateVersion
|
|
71
67
|
* @throws {AppwriteException}
|
|
72
68
|
* @returns {Promise<Models.Function>}
|
|
73
69
|
*/
|
|
74
|
-
create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string
|
|
70
|
+
create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise<Models.Function> {
|
|
75
71
|
if (typeof functionId === 'undefined') {
|
|
76
72
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
77
73
|
}
|
|
@@ -137,18 +133,6 @@ export class Functions {
|
|
|
137
133
|
if (typeof specification !== 'undefined') {
|
|
138
134
|
payload['specification'] = specification;
|
|
139
135
|
}
|
|
140
|
-
if (typeof templateRepository !== 'undefined') {
|
|
141
|
-
payload['templateRepository'] = templateRepository;
|
|
142
|
-
}
|
|
143
|
-
if (typeof templateOwner !== 'undefined') {
|
|
144
|
-
payload['templateOwner'] = templateOwner;
|
|
145
|
-
}
|
|
146
|
-
if (typeof templateRootDirectory !== 'undefined') {
|
|
147
|
-
payload['templateRootDirectory'] = templateRootDirectory;
|
|
148
|
-
}
|
|
149
|
-
if (typeof templateVersion !== 'undefined') {
|
|
150
|
-
payload['templateVersion'] = templateVersion;
|
|
151
|
-
}
|
|
152
136
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
153
137
|
|
|
154
138
|
const apiHeaders: { [header: string]: string } = {
|
package/src/services/health.ts
CHANGED
|
@@ -141,14 +141,39 @@ export class Health {
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
|
-
* Get billing aggregation queue
|
|
144
|
+
* Get billing project aggregation queue
|
|
145
145
|
*
|
|
146
146
|
* @param {number} threshold
|
|
147
147
|
* @throws {AppwriteException}
|
|
148
148
|
* @returns {Promise<Models.HealthQueue>}
|
|
149
149
|
*/
|
|
150
|
-
|
|
151
|
-
const apiPath = '/health/queue/billing-aggregation';
|
|
150
|
+
getQueueBillingProjectAggregation(threshold?: number): Promise<Models.HealthQueue> {
|
|
151
|
+
const apiPath = '/health/queue/billing-project-aggregation';
|
|
152
|
+
const payload: Payload = {};
|
|
153
|
+
if (typeof threshold !== 'undefined') {
|
|
154
|
+
payload['threshold'] = threshold;
|
|
155
|
+
}
|
|
156
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
157
|
+
|
|
158
|
+
const apiHeaders: { [header: string]: string } = {
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return this.client.call(
|
|
162
|
+
'get',
|
|
163
|
+
uri,
|
|
164
|
+
apiHeaders,
|
|
165
|
+
payload
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get billing team aggregation queue
|
|
170
|
+
*
|
|
171
|
+
* @param {number} threshold
|
|
172
|
+
* @throws {AppwriteException}
|
|
173
|
+
* @returns {Promise<Models.HealthQueue>}
|
|
174
|
+
*/
|
|
175
|
+
getQueueBillingTeamAggregation(threshold?: number): Promise<Models.HealthQueue> {
|
|
176
|
+
const apiPath = '/health/queue/billing-team-aggregation';
|
|
152
177
|
const payload: Payload = {};
|
|
153
178
|
if (typeof threshold !== 'undefined') {
|
|
154
179
|
payload['threshold'] = threshold;
|