@appwrite.io/console 0.2.0 → 0.4.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 +3353 -1497
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +3350 -1498
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +3353 -1497
- package/docs/examples/account/create-anonymous-session.md +1 -1
- package/docs/examples/account/create-email-session.md +1 -1
- package/docs/examples/account/create-j-w-t.md +1 -1
- package/docs/examples/account/create-magic-u-r-l-session.md +1 -1
- package/docs/examples/account/create-o-auth2session.md +1 -1
- package/docs/examples/account/create-phone-session.md +1 -1
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-recovery.md +1 -1
- package/docs/examples/account/create-verification.md +1 -1
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/{create-with-invite-code.md → delete-identity.md} +2 -2
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/get.md +1 -1
- package/docs/examples/account/list-identities.md +18 -0
- package/docs/examples/account/list-logs.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +1 -1
- package/docs/examples/account/update-magic-u-r-l-session.md +1 -1
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-password.md +1 -1
- package/docs/examples/account/update-phone-session.md +1 -1
- package/docs/examples/account/update-phone-verification.md +1 -1
- package/docs/examples/account/update-phone.md +1 -1
- package/docs/examples/account/update-prefs.md +1 -1
- package/docs/examples/account/update-recovery.md +1 -1
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +1 -1
- package/docs/examples/assistant/chat.md +18 -0
- package/docs/examples/avatars/get-browser.md +1 -1
- package/docs/examples/avatars/get-credit-card.md +1 -1
- package/docs/examples/avatars/get-favicon.md +1 -1
- package/docs/examples/avatars/get-flag.md +1 -1
- package/docs/examples/avatars/get-image.md +1 -1
- package/docs/examples/avatars/get-initials.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/console/variables.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +1 -1
- package/docs/examples/databases/create-collection.md +1 -1
- package/docs/examples/databases/create-datetime-attribute.md +1 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/create-email-attribute.md +1 -1
- package/docs/examples/databases/create-enum-attribute.md +1 -1
- package/docs/examples/databases/create-float-attribute.md +1 -1
- package/docs/examples/databases/create-index.md +1 -1
- package/docs/examples/databases/create-integer-attribute.md +1 -1
- package/docs/examples/databases/create-ip-attribute.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +1 -1
- package/docs/examples/databases/create-string-attribute.md +1 -1
- package/docs/examples/databases/create-url-attribute.md +1 -1
- package/docs/examples/databases/create.md +1 -1
- package/docs/examples/databases/delete-attribute.md +1 -1
- package/docs/examples/databases/delete-collection.md +1 -1
- package/docs/examples/databases/delete-document.md +1 -1
- package/docs/examples/databases/delete-index.md +1 -1
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +1 -1
- package/docs/examples/databases/get-collection-usage.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-database-usage.md +1 -1
- package/docs/examples/databases/get-document.md +1 -1
- package/docs/examples/databases/get-index.md +1 -1
- package/docs/examples/databases/get-usage.md +1 -1
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +1 -1
- package/docs/examples/databases/list-collection-logs.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-document-logs.md +1 -1
- package/docs/examples/databases/list-documents.md +1 -1
- package/docs/examples/databases/list-indexes.md +1 -1
- package/docs/examples/databases/list-logs.md +1 -1
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +1 -1
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +1 -1
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +1 -1
- package/docs/examples/databases/update-enum-attribute.md +1 -1
- package/docs/examples/databases/update-float-attribute.md +1 -1
- package/docs/examples/databases/update-integer-attribute.md +1 -1
- package/docs/examples/databases/update-ip-attribute.md +1 -1
- package/docs/examples/databases/update-relationship-attribute.md +1 -1
- package/docs/examples/databases/update-string-attribute.md +1 -1
- package/docs/examples/databases/update-url-attribute.md +1 -1
- package/docs/examples/databases/update.md +1 -1
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-deployment.md +2 -2
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +1 -1
- package/docs/examples/functions/create.md +2 -2
- package/docs/examples/functions/delete-deployment.md +1 -1
- package/docs/examples/functions/delete-variable.md +1 -1
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +14 -0
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-function-usage.md +1 -1
- package/docs/examples/functions/get-usage.md +1 -1
- package/docs/examples/functions/get-variable.md +1 -1
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/list.md +1 -1
- package/docs/examples/functions/update-deployment.md +1 -1
- package/docs/examples/functions/update-variable.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-d-b.md +1 -1
- package/docs/examples/health/get-pub-sub.md +1 -1
- package/docs/examples/health/get-queue-builds.md +18 -0
- package/docs/examples/health/get-queue-certificates.md +1 -1
- package/docs/examples/health/get-queue-databases.md +18 -0
- package/docs/examples/health/get-queue-deletes.md +18 -0
- package/docs/examples/health/get-queue-functions.md +1 -1
- package/docs/examples/health/get-queue-logs.md +1 -1
- package/docs/examples/health/get-queue-mails.md +18 -0
- package/docs/examples/health/get-queue-messaging.md +18 -0
- package/docs/examples/health/get-queue-migrations.md +18 -0
- package/docs/examples/health/get-queue-webhooks.md +1 -1
- package/docs/examples/health/get-queue.md +1 -1
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/health/get.md +1 -1
- package/docs/examples/locale/get.md +1 -1
- package/docs/examples/locale/list-codes.md +18 -0
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-e-u.md +1 -1
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/migrations/create-appwrite-migration.md +18 -0
- package/docs/examples/migrations/create-firebase-migration.md +18 -0
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +18 -0
- package/docs/examples/migrations/create-n-host-migration.md +18 -0
- package/docs/examples/migrations/create-supabase-migration.md +18 -0
- package/docs/examples/migrations/delete-firebase-auth.md +18 -0
- package/docs/examples/migrations/delete.md +18 -0
- package/docs/examples/migrations/get-appwrite-report.md +18 -0
- package/docs/examples/migrations/get-firebase-report-o-auth.md +18 -0
- package/docs/examples/migrations/get-firebase-report.md +18 -0
- package/docs/examples/migrations/get-n-host-report.md +18 -0
- package/docs/examples/migrations/get-supabase-report.md +18 -0
- package/docs/examples/migrations/get.md +18 -0
- package/docs/examples/migrations/list-firebase-projects.md +18 -0
- package/docs/examples/migrations/list.md +18 -0
- package/docs/examples/migrations/retry.md +18 -0
- package/docs/examples/project/create-variable.md +18 -0
- package/docs/examples/project/delete-variable.md +18 -0
- package/docs/examples/project/get-usage.md +2 -2
- package/docs/examples/project/get-variable.md +18 -0
- package/docs/examples/project/list-variables.md +18 -0
- package/docs/examples/project/update-variable.md +18 -0
- package/docs/examples/projects/create-key.md +1 -1
- package/docs/examples/projects/create-platform.md +1 -1
- package/docs/examples/projects/create-webhook.md +1 -1
- package/docs/examples/projects/create.md +2 -2
- package/docs/examples/projects/delete-email-template.md +18 -0
- package/docs/examples/projects/delete-key.md +1 -1
- package/docs/examples/projects/delete-platform.md +1 -1
- package/docs/examples/projects/delete-sms-template.md +18 -0
- package/docs/examples/projects/delete-webhook.md +1 -1
- package/docs/examples/projects/delete.md +2 -2
- package/docs/examples/projects/get-email-template.md +18 -0
- package/docs/examples/projects/get-key.md +1 -1
- package/docs/examples/projects/get-platform.md +1 -1
- package/docs/examples/projects/get-sms-template.md +18 -0
- package/docs/examples/projects/get-webhook.md +1 -1
- package/docs/examples/projects/get.md +1 -1
- package/docs/examples/projects/list-keys.md +1 -1
- package/docs/examples/projects/list-platforms.md +1 -1
- package/docs/examples/projects/list-webhooks.md +1 -1
- package/docs/examples/projects/list.md +1 -1
- package/docs/examples/projects/update-auth-duration.md +1 -1
- package/docs/examples/projects/update-auth-limit.md +1 -1
- package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
- package/docs/examples/projects/update-auth-password-history.md +1 -1
- package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
- package/docs/examples/projects/update-auth-status.md +1 -1
- package/docs/examples/projects/update-email-template.md +18 -0
- package/docs/examples/projects/update-key.md +1 -1
- package/docs/examples/projects/update-o-auth2.md +1 -1
- package/docs/examples/projects/{delete-domain.md → update-personal-data-check.md} +2 -2
- package/docs/examples/projects/update-platform.md +1 -1
- package/docs/examples/projects/{create-domain.md → update-service-status-all.md} +2 -2
- package/docs/examples/projects/update-service-status.md +1 -1
- package/docs/examples/projects/update-sms-template.md +18 -0
- package/docs/examples/projects/{get-domain.md → update-smtp-configuration.md} +2 -2
- package/docs/examples/projects/{list-domains.md → update-team.md} +2 -2
- package/docs/examples/projects/update-webhook-signature.md +1 -1
- package/docs/examples/projects/update-webhook.md +1 -1
- package/docs/examples/projects/update.md +1 -1
- package/docs/examples/proxy/create-rule.md +18 -0
- package/docs/examples/proxy/delete-rule.md +18 -0
- package/docs/examples/proxy/get-rule.md +18 -0
- package/docs/examples/proxy/list-rules.md +18 -0
- package/docs/examples/proxy/update-rule-verification.md +18 -0
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +1 -1
- package/docs/examples/storage/get-bucket-usage.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file-download.md +1 -1
- package/docs/examples/storage/get-file-preview.md +1 -1
- package/docs/examples/storage/get-file-view.md +1 -1
- package/docs/examples/storage/get-file.md +1 -1
- package/docs/examples/storage/get-usage.md +1 -1
- package/docs/examples/storage/list-buckets.md +1 -1
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/teams/create-membership.md +2 -2
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/delete-membership.md +1 -1
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +1 -1
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-logs.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/list.md +1 -1
- package/docs/examples/teams/update-membership-status.md +1 -1
- package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
- package/docs/examples/teams/update-name.md +1 -1
- package/docs/examples/teams/update-prefs.md +1 -1
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +1 -1
- package/docs/examples/users/create-scrypt-user.md +1 -1
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +18 -0
- package/docs/examples/users/delete-session.md +1 -1
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get-usage.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +18 -0
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list.md +1 -1
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +18 -0
- package/docs/examples/users/update-name.md +1 -1
- package/docs/examples/users/update-password.md +1 -1
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/docs/examples/vcs/create-repository-detection.md +18 -0
- package/docs/examples/vcs/create-repository.md +18 -0
- package/docs/examples/vcs/delete-installation.md +18 -0
- package/docs/examples/vcs/get-installation.md +18 -0
- package/docs/examples/vcs/get-repository.md +18 -0
- package/docs/examples/vcs/list-installations.md +18 -0
- package/docs/examples/vcs/list-repositories.md +18 -0
- package/docs/examples/vcs/list-repository-branches.md +18 -0
- package/docs/examples/vcs/update-external-deployments.md +18 -0
- package/package.json +3 -2
- package/src/client.ts +2 -2
- package/src/index.ts +4 -0
- package/src/models.ts +863 -233
- package/src/query.ts +1 -1
- package/src/role.ts +72 -6
- package/src/services/account.ts +1052 -1055
- package/src/services/assistant.ts +38 -0
- package/src/services/avatars.ts +338 -337
- package/src/services/console.ts +16 -16
- package/src/services/databases.ts +2170 -2140
- package/src/services/functions.ts +804 -657
- package/src/services/graphql.ts +47 -47
- package/src/services/health.ts +373 -204
- package/src/services/locale.ts +156 -137
- package/src/services/migrations.ts +707 -0
- package/src/services/project.ts +178 -20
- package/src/services/projects.ts +1511 -1256
- package/src/services/proxy.ts +150 -0
- package/src/services/storage.ts +572 -577
- package/src/services/teams.ts +498 -501
- package/src/services/users.ts +1091 -1001
- package/src/services/vcs.ts +272 -0
- package/types/index.d.ts +4 -0
- package/types/models.d.ts +863 -233
- package/types/role.d.ts +62 -0
- package/types/services/account.d.ts +116 -104
- package/types/services/assistant.d.ts +14 -0
- package/types/services/avatars.d.ts +18 -17
- package/types/services/console.d.ts +2 -2
- package/types/services/databases.d.ts +111 -105
- package/types/services/functions.d.ts +95 -55
- package/types/services/graphql.d.ts +4 -4
- package/types/services/health.d.ts +97 -26
- package/types/services/locale.d.ts +24 -14
- package/types/services/migrations.d.ts +185 -0
- package/types/services/project.d.ts +60 -3
- package/types/services/projects.d.ts +174 -104
- package/types/services/proxy.d.ts +59 -0
- package/types/services/storage.d.ts +29 -28
- package/types/services/teams.d.ts +36 -35
- package/types/services/users.d.ts +105 -66
- package/types/services/vcs.d.ts +97 -0
- package/docs/examples/projects/update-domain-verification.md +0 -18
|
@@ -10,2145 +10,2175 @@ export class Databases extends Service {
|
|
|
10
10
|
super(client);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (typeof search !== 'undefined') {
|
|
33
|
-
payload['search'] = search;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
37
|
-
return await this.client.call('get', uri, {
|
|
38
|
-
'content-type': 'application/json',
|
|
39
|
-
}, payload);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Create Database
|
|
44
|
-
*
|
|
45
|
-
* Create a new Database.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @param {string} databaseId
|
|
49
|
-
* @param {string} name
|
|
50
|
-
* @throws {AppwriteException}
|
|
51
|
-
* @returns {Promise}
|
|
52
|
-
*/
|
|
53
|
-
async create(databaseId: string, name: string): Promise<Models.Database> {
|
|
54
|
-
if (typeof databaseId === 'undefined') {
|
|
55
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (typeof name === 'undefined') {
|
|
59
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
let path = '/databases';
|
|
63
|
-
let payload: Payload = {};
|
|
64
|
-
|
|
65
|
-
if (typeof databaseId !== 'undefined') {
|
|
66
|
-
payload['databaseId'] = databaseId;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (typeof name !== 'undefined') {
|
|
70
|
-
payload['name'] = name;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
74
|
-
return await this.client.call('post', uri, {
|
|
75
|
-
'content-type': 'application/json',
|
|
76
|
-
}, payload);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Get usage stats for the database
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @param {string} range
|
|
84
|
-
* @throws {AppwriteException}
|
|
85
|
-
* @returns {Promise}
|
|
86
|
-
*/
|
|
87
|
-
async getUsage(range?: string): Promise<Models.UsageDatabases> {
|
|
88
|
-
let path = '/databases/usage';
|
|
89
|
-
let payload: Payload = {};
|
|
90
|
-
|
|
91
|
-
if (typeof range !== 'undefined') {
|
|
92
|
-
payload['range'] = range;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
96
|
-
return await this.client.call('get', uri, {
|
|
97
|
-
'content-type': 'application/json',
|
|
98
|
-
}, payload);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Get Database
|
|
103
|
-
*
|
|
104
|
-
* Get a database by its unique ID. This endpoint response returns a JSON
|
|
105
|
-
* object with the database metadata.
|
|
106
|
-
*
|
|
107
|
-
* @param {string} databaseId
|
|
108
|
-
* @throws {AppwriteException}
|
|
109
|
-
* @returns {Promise}
|
|
110
|
-
*/
|
|
111
|
-
async get(databaseId: string): Promise<Models.Database> {
|
|
112
|
-
if (typeof databaseId === 'undefined') {
|
|
113
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
|
117
|
-
let payload: Payload = {};
|
|
118
|
-
|
|
119
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
120
|
-
return await this.client.call('get', uri, {
|
|
121
|
-
'content-type': 'application/json',
|
|
122
|
-
}, payload);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Update Database
|
|
127
|
-
*
|
|
128
|
-
* Update a database by its unique ID.
|
|
129
|
-
*
|
|
130
|
-
* @param {string} databaseId
|
|
131
|
-
* @param {string} name
|
|
132
|
-
* @throws {AppwriteException}
|
|
133
|
-
* @returns {Promise}
|
|
134
|
-
*/
|
|
135
|
-
async update(databaseId: string, name: string): Promise<Models.Database> {
|
|
136
|
-
if (typeof databaseId === 'undefined') {
|
|
137
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (typeof name === 'undefined') {
|
|
141
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
|
145
|
-
let payload: Payload = {};
|
|
146
|
-
|
|
147
|
-
if (typeof name !== 'undefined') {
|
|
148
|
-
payload['name'] = name;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
152
|
-
return await this.client.call('put', uri, {
|
|
153
|
-
'content-type': 'application/json',
|
|
154
|
-
}, payload);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Delete Database
|
|
159
|
-
*
|
|
160
|
-
* Delete a database by its unique ID. Only API keys with with databases.write
|
|
161
|
-
* scope can delete a database.
|
|
162
|
-
*
|
|
163
|
-
* @param {string} databaseId
|
|
164
|
-
* @throws {AppwriteException}
|
|
165
|
-
* @returns {Promise}
|
|
166
|
-
*/
|
|
167
|
-
async delete(databaseId: string): Promise<{}> {
|
|
168
|
-
if (typeof databaseId === 'undefined') {
|
|
169
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
|
173
|
-
let payload: Payload = {};
|
|
174
|
-
|
|
175
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
176
|
-
return await this.client.call('delete', uri, {
|
|
177
|
-
'content-type': 'application/json',
|
|
178
|
-
}, payload);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* List Collections
|
|
183
|
-
*
|
|
184
|
-
* Get a list of all collections that belong to the provided databaseId. You
|
|
185
|
-
* can use the search parameter to filter your results.
|
|
186
|
-
*
|
|
187
|
-
* @param {string} databaseId
|
|
188
|
-
* @param {string[]} queries
|
|
189
|
-
* @param {string} search
|
|
190
|
-
* @throws {AppwriteException}
|
|
191
|
-
* @returns {Promise}
|
|
192
|
-
*/
|
|
193
|
-
async listCollections(databaseId: string, queries?: string[], search?: string): Promise<Models.CollectionList> {
|
|
194
|
-
if (typeof databaseId === 'undefined') {
|
|
195
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
|
199
|
-
let payload: Payload = {};
|
|
200
|
-
|
|
201
|
-
if (typeof queries !== 'undefined') {
|
|
202
|
-
payload['queries'] = queries;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (typeof search !== 'undefined') {
|
|
206
|
-
payload['search'] = search;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
210
|
-
return await this.client.call('get', uri, {
|
|
211
|
-
'content-type': 'application/json',
|
|
212
|
-
}, payload);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Create Collection
|
|
217
|
-
*
|
|
218
|
-
* Create a new Collection. Before using this route, you should create a new
|
|
219
|
-
* database resource using either a [server
|
|
220
|
-
* integration](/docs/server/databases#databasesCreateCollection) API or
|
|
221
|
-
* directly from your database console.
|
|
222
|
-
*
|
|
223
|
-
* @param {string} databaseId
|
|
224
|
-
* @param {string} collectionId
|
|
225
|
-
* @param {string} name
|
|
226
|
-
* @param {string[]} permissions
|
|
227
|
-
* @param {boolean} documentSecurity
|
|
228
|
-
* @throws {AppwriteException}
|
|
229
|
-
* @returns {Promise}
|
|
230
|
-
*/
|
|
231
|
-
async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean): Promise<Models.Collection> {
|
|
232
|
-
if (typeof databaseId === 'undefined') {
|
|
233
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (typeof collectionId === 'undefined') {
|
|
237
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (typeof name === 'undefined') {
|
|
241
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
|
245
|
-
let payload: Payload = {};
|
|
246
|
-
|
|
247
|
-
if (typeof collectionId !== 'undefined') {
|
|
248
|
-
payload['collectionId'] = collectionId;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (typeof name !== 'undefined') {
|
|
252
|
-
payload['name'] = name;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (typeof permissions !== 'undefined') {
|
|
256
|
-
payload['permissions'] = permissions;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (typeof documentSecurity !== 'undefined') {
|
|
260
|
-
payload['documentSecurity'] = documentSecurity;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
264
|
-
return await this.client.call('post', uri, {
|
|
265
|
-
'content-type': 'application/json',
|
|
266
|
-
}, payload);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Get Collection
|
|
271
|
-
*
|
|
272
|
-
* Get a collection by its unique ID. This endpoint response returns a JSON
|
|
273
|
-
* object with the collection metadata.
|
|
274
|
-
*
|
|
275
|
-
* @param {string} databaseId
|
|
276
|
-
* @param {string} collectionId
|
|
277
|
-
* @throws {AppwriteException}
|
|
278
|
-
* @returns {Promise}
|
|
279
|
-
*/
|
|
280
|
-
async getCollection(databaseId: string, collectionId: string): Promise<Models.Collection> {
|
|
281
|
-
if (typeof databaseId === 'undefined') {
|
|
282
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (typeof collectionId === 'undefined') {
|
|
286
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
290
|
-
let payload: Payload = {};
|
|
291
|
-
|
|
292
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
293
|
-
return await this.client.call('get', uri, {
|
|
294
|
-
'content-type': 'application/json',
|
|
295
|
-
}, payload);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Update Collection
|
|
300
|
-
*
|
|
301
|
-
* Update a collection by its unique ID.
|
|
302
|
-
*
|
|
303
|
-
* @param {string} databaseId
|
|
304
|
-
* @param {string} collectionId
|
|
305
|
-
* @param {string} name
|
|
306
|
-
* @param {string[]} permissions
|
|
307
|
-
* @param {boolean} documentSecurity
|
|
308
|
-
* @param {boolean} enabled
|
|
309
|
-
* @throws {AppwriteException}
|
|
310
|
-
* @returns {Promise}
|
|
311
|
-
*/
|
|
312
|
-
async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
|
|
313
|
-
if (typeof databaseId === 'undefined') {
|
|
314
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (typeof collectionId === 'undefined') {
|
|
318
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (typeof name === 'undefined') {
|
|
322
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
326
|
-
let payload: Payload = {};
|
|
327
|
-
|
|
328
|
-
if (typeof name !== 'undefined') {
|
|
329
|
-
payload['name'] = name;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (typeof permissions !== 'undefined') {
|
|
333
|
-
payload['permissions'] = permissions;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
if (typeof documentSecurity !== 'undefined') {
|
|
337
|
-
payload['documentSecurity'] = documentSecurity;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (typeof enabled !== 'undefined') {
|
|
341
|
-
payload['enabled'] = enabled;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
345
|
-
return await this.client.call('put', uri, {
|
|
346
|
-
'content-type': 'application/json',
|
|
347
|
-
}, payload);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Delete Collection
|
|
352
|
-
*
|
|
353
|
-
* Delete a collection by its unique ID. Only users with write permissions
|
|
354
|
-
* have access to delete this resource.
|
|
355
|
-
*
|
|
356
|
-
* @param {string} databaseId
|
|
357
|
-
* @param {string} collectionId
|
|
358
|
-
* @throws {AppwriteException}
|
|
359
|
-
* @returns {Promise}
|
|
360
|
-
*/
|
|
361
|
-
async deleteCollection(databaseId: string, collectionId: string): Promise<{}> {
|
|
362
|
-
if (typeof databaseId === 'undefined') {
|
|
363
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (typeof collectionId === 'undefined') {
|
|
367
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
371
|
-
let payload: Payload = {};
|
|
372
|
-
|
|
373
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
374
|
-
return await this.client.call('delete', uri, {
|
|
375
|
-
'content-type': 'application/json',
|
|
376
|
-
}, payload);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* List Attributes
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
* @param {string} databaseId
|
|
384
|
-
* @param {string} collectionId
|
|
385
|
-
* @throws {AppwriteException}
|
|
386
|
-
* @returns {Promise}
|
|
387
|
-
*/
|
|
388
|
-
async listAttributes(databaseId: string, collectionId: string): Promise<Models.AttributeList> {
|
|
389
|
-
if (typeof databaseId === 'undefined') {
|
|
390
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (typeof collectionId === 'undefined') {
|
|
394
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
398
|
-
let payload: Payload = {};
|
|
399
|
-
|
|
400
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
401
|
-
return await this.client.call('get', uri, {
|
|
402
|
-
'content-type': 'application/json',
|
|
403
|
-
}, payload);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Create Boolean Attribute
|
|
408
|
-
*
|
|
409
|
-
* Create a boolean attribute.
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* @param {string} databaseId
|
|
413
|
-
* @param {string} collectionId
|
|
414
|
-
* @param {string} key
|
|
415
|
-
* @param {boolean} required
|
|
416
|
-
* @param {boolean} xdefault
|
|
417
|
-
* @param {boolean} array
|
|
418
|
-
* @throws {AppwriteException}
|
|
419
|
-
* @returns {Promise}
|
|
420
|
-
*/
|
|
421
|
-
async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean> {
|
|
422
|
-
if (typeof databaseId === 'undefined') {
|
|
423
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
if (typeof collectionId === 'undefined') {
|
|
427
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (typeof key === 'undefined') {
|
|
431
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (typeof required === 'undefined') {
|
|
435
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
439
|
-
let payload: Payload = {};
|
|
440
|
-
|
|
441
|
-
if (typeof key !== 'undefined') {
|
|
442
|
-
payload['key'] = key;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if (typeof required !== 'undefined') {
|
|
446
|
-
payload['required'] = required;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (typeof xdefault !== 'undefined') {
|
|
450
|
-
payload['default'] = xdefault;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (typeof array !== 'undefined') {
|
|
454
|
-
payload['array'] = array;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
458
|
-
return await this.client.call('post', uri, {
|
|
459
|
-
'content-type': 'application/json',
|
|
460
|
-
}, payload);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Update Boolean Attribute
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
* @param {string} databaseId
|
|
468
|
-
* @param {string} collectionId
|
|
469
|
-
* @param {string} key
|
|
470
|
-
* @param {boolean} required
|
|
471
|
-
* @param {boolean} xdefault
|
|
472
|
-
* @throws {AppwriteException}
|
|
473
|
-
* @returns {Promise}
|
|
474
|
-
*/
|
|
475
|
-
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean> {
|
|
476
|
-
if (typeof databaseId === 'undefined') {
|
|
477
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (typeof collectionId === 'undefined') {
|
|
481
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (typeof key === 'undefined') {
|
|
485
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
if (typeof required === 'undefined') {
|
|
489
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (typeof xdefault === 'undefined') {
|
|
493
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
497
|
-
let payload: Payload = {};
|
|
498
|
-
|
|
499
|
-
if (typeof required !== 'undefined') {
|
|
500
|
-
payload['required'] = required;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
if (typeof xdefault !== 'undefined') {
|
|
504
|
-
payload['default'] = xdefault;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
508
|
-
return await this.client.call('patch', uri, {
|
|
509
|
-
'content-type': 'application/json',
|
|
510
|
-
}, payload);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Create DateTime Attribute
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* @param {string} databaseId
|
|
518
|
-
* @param {string} collectionId
|
|
519
|
-
* @param {string} key
|
|
520
|
-
* @param {boolean} required
|
|
521
|
-
* @param {string} xdefault
|
|
522
|
-
* @param {boolean} array
|
|
523
|
-
* @throws {AppwriteException}
|
|
524
|
-
* @returns {Promise}
|
|
525
|
-
*/
|
|
526
|
-
async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime> {
|
|
527
|
-
if (typeof databaseId === 'undefined') {
|
|
528
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (typeof collectionId === 'undefined') {
|
|
532
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
if (typeof key === 'undefined') {
|
|
536
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
if (typeof required === 'undefined') {
|
|
540
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
544
|
-
let payload: Payload = {};
|
|
545
|
-
|
|
546
|
-
if (typeof key !== 'undefined') {
|
|
547
|
-
payload['key'] = key;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (typeof required !== 'undefined') {
|
|
551
|
-
payload['required'] = required;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
if (typeof xdefault !== 'undefined') {
|
|
555
|
-
payload['default'] = xdefault;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
if (typeof array !== 'undefined') {
|
|
559
|
-
payload['array'] = array;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
563
|
-
return await this.client.call('post', uri, {
|
|
564
|
-
'content-type': 'application/json',
|
|
565
|
-
}, payload);
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* Update DateTime Attribute
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* @param {string} databaseId
|
|
573
|
-
* @param {string} collectionId
|
|
574
|
-
* @param {string} key
|
|
575
|
-
* @param {boolean} required
|
|
576
|
-
* @param {string} xdefault
|
|
577
|
-
* @throws {AppwriteException}
|
|
578
|
-
* @returns {Promise}
|
|
579
|
-
*/
|
|
580
|
-
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime> {
|
|
581
|
-
if (typeof databaseId === 'undefined') {
|
|
582
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (typeof collectionId === 'undefined') {
|
|
586
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if (typeof key === 'undefined') {
|
|
590
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (typeof required === 'undefined') {
|
|
594
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
if (typeof xdefault === 'undefined') {
|
|
598
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
602
|
-
let payload: Payload = {};
|
|
603
|
-
|
|
604
|
-
if (typeof required !== 'undefined') {
|
|
605
|
-
payload['required'] = required;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
if (typeof xdefault !== 'undefined') {
|
|
609
|
-
payload['default'] = xdefault;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
613
|
-
return await this.client.call('patch', uri, {
|
|
614
|
-
'content-type': 'application/json',
|
|
615
|
-
}, payload);
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* Create Email Attribute
|
|
620
|
-
*
|
|
621
|
-
* Create an email attribute.
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
* @param {string} databaseId
|
|
625
|
-
* @param {string} collectionId
|
|
626
|
-
* @param {string} key
|
|
627
|
-
* @param {boolean} required
|
|
628
|
-
* @param {string} xdefault
|
|
629
|
-
* @param {boolean} array
|
|
630
|
-
* @throws {AppwriteException}
|
|
631
|
-
* @returns {Promise}
|
|
632
|
-
*/
|
|
633
|
-
async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail> {
|
|
634
|
-
if (typeof databaseId === 'undefined') {
|
|
635
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
if (typeof collectionId === 'undefined') {
|
|
639
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
if (typeof key === 'undefined') {
|
|
643
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (typeof required === 'undefined') {
|
|
647
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
651
|
-
let payload: Payload = {};
|
|
652
|
-
|
|
653
|
-
if (typeof key !== 'undefined') {
|
|
654
|
-
payload['key'] = key;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
if (typeof required !== 'undefined') {
|
|
658
|
-
payload['required'] = required;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
if (typeof xdefault !== 'undefined') {
|
|
662
|
-
payload['default'] = xdefault;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
if (typeof array !== 'undefined') {
|
|
666
|
-
payload['array'] = array;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
670
|
-
return await this.client.call('post', uri, {
|
|
671
|
-
'content-type': 'application/json',
|
|
672
|
-
}, payload);
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Update Email Attribute
|
|
677
|
-
*
|
|
678
|
-
* Update an email attribute. Changing the `default` value will not update
|
|
679
|
-
* already existing documents.
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
* @param {string} databaseId
|
|
683
|
-
* @param {string} collectionId
|
|
684
|
-
* @param {string} key
|
|
685
|
-
* @param {boolean} required
|
|
686
|
-
* @param {string} xdefault
|
|
687
|
-
* @throws {AppwriteException}
|
|
688
|
-
* @returns {Promise}
|
|
689
|
-
*/
|
|
690
|
-
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail> {
|
|
691
|
-
if (typeof databaseId === 'undefined') {
|
|
692
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
if (typeof collectionId === 'undefined') {
|
|
696
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
if (typeof key === 'undefined') {
|
|
700
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
if (typeof required === 'undefined') {
|
|
704
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
if (typeof xdefault === 'undefined') {
|
|
708
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
712
|
-
let payload: Payload = {};
|
|
713
|
-
|
|
714
|
-
if (typeof required !== 'undefined') {
|
|
715
|
-
payload['required'] = required;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
if (typeof xdefault !== 'undefined') {
|
|
719
|
-
payload['default'] = xdefault;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
723
|
-
return await this.client.call('patch', uri, {
|
|
724
|
-
'content-type': 'application/json',
|
|
725
|
-
}, payload);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Create Enum Attribute
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
* @param {string} databaseId
|
|
733
|
-
* @param {string} collectionId
|
|
734
|
-
* @param {string} key
|
|
735
|
-
* @param {string[]} elements
|
|
736
|
-
* @param {boolean} required
|
|
737
|
-
* @param {string} xdefault
|
|
738
|
-
* @param {boolean} array
|
|
739
|
-
* @throws {AppwriteException}
|
|
740
|
-
* @returns {Promise}
|
|
741
|
-
*/
|
|
742
|
-
async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum> {
|
|
743
|
-
if (typeof databaseId === 'undefined') {
|
|
744
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
if (typeof collectionId === 'undefined') {
|
|
748
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
if (typeof key === 'undefined') {
|
|
752
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
if (typeof elements === 'undefined') {
|
|
756
|
-
throw new AppwriteException('Missing required parameter: "elements"');
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
if (typeof required === 'undefined') {
|
|
760
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
764
|
-
let payload: Payload = {};
|
|
765
|
-
|
|
766
|
-
if (typeof key !== 'undefined') {
|
|
767
|
-
payload['key'] = key;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
if (typeof elements !== 'undefined') {
|
|
771
|
-
payload['elements'] = elements;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (typeof required !== 'undefined') {
|
|
775
|
-
payload['required'] = required;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
if (typeof xdefault !== 'undefined') {
|
|
779
|
-
payload['default'] = xdefault;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
if (typeof array !== 'undefined') {
|
|
783
|
-
payload['array'] = array;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
787
|
-
return await this.client.call('post', uri, {
|
|
788
|
-
'content-type': 'application/json',
|
|
789
|
-
}, payload);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Update Enum Attribute
|
|
794
|
-
*
|
|
795
|
-
* Update an enum attribute. Changing the `default` value will not update
|
|
796
|
-
* already existing documents.
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
* @param {string} databaseId
|
|
800
|
-
* @param {string} collectionId
|
|
801
|
-
* @param {string} key
|
|
802
|
-
* @param {string[]} elements
|
|
803
|
-
* @param {boolean} required
|
|
804
|
-
* @param {string} xdefault
|
|
805
|
-
* @throws {AppwriteException}
|
|
806
|
-
* @returns {Promise}
|
|
807
|
-
*/
|
|
808
|
-
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum> {
|
|
809
|
-
if (typeof databaseId === 'undefined') {
|
|
810
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
if (typeof collectionId === 'undefined') {
|
|
814
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
if (typeof key === 'undefined') {
|
|
818
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
if (typeof elements === 'undefined') {
|
|
822
|
-
throw new AppwriteException('Missing required parameter: "elements"');
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
if (typeof required === 'undefined') {
|
|
826
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
if (typeof xdefault === 'undefined') {
|
|
830
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
834
|
-
let payload: Payload = {};
|
|
835
|
-
|
|
836
|
-
if (typeof elements !== 'undefined') {
|
|
837
|
-
payload['elements'] = elements;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
if (typeof required !== 'undefined') {
|
|
841
|
-
payload['required'] = required;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
if (typeof xdefault !== 'undefined') {
|
|
845
|
-
payload['default'] = xdefault;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
849
|
-
return await this.client.call('patch', uri, {
|
|
850
|
-
'content-type': 'application/json',
|
|
851
|
-
}, payload);
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
/**
|
|
855
|
-
* Create Float Attribute
|
|
856
|
-
*
|
|
857
|
-
* Create a float attribute. Optionally, minimum and maximum values can be
|
|
858
|
-
* provided.
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
* @param {string} databaseId
|
|
862
|
-
* @param {string} collectionId
|
|
863
|
-
* @param {string} key
|
|
864
|
-
* @param {boolean} required
|
|
865
|
-
* @param {number} min
|
|
866
|
-
* @param {number} max
|
|
867
|
-
* @param {number} xdefault
|
|
868
|
-
* @param {boolean} array
|
|
869
|
-
* @throws {AppwriteException}
|
|
870
|
-
* @returns {Promise}
|
|
871
|
-
*/
|
|
872
|
-
async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat> {
|
|
873
|
-
if (typeof databaseId === 'undefined') {
|
|
874
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
if (typeof collectionId === 'undefined') {
|
|
878
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
if (typeof key === 'undefined') {
|
|
882
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
if (typeof required === 'undefined') {
|
|
886
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
890
|
-
let payload: Payload = {};
|
|
891
|
-
|
|
892
|
-
if (typeof key !== 'undefined') {
|
|
893
|
-
payload['key'] = key;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
if (typeof required !== 'undefined') {
|
|
897
|
-
payload['required'] = required;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
if (typeof min !== 'undefined') {
|
|
901
|
-
payload['min'] = min;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
if (typeof max !== 'undefined') {
|
|
905
|
-
payload['max'] = max;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
if (typeof xdefault !== 'undefined') {
|
|
909
|
-
payload['default'] = xdefault;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
if (typeof array !== 'undefined') {
|
|
913
|
-
payload['array'] = array;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
917
|
-
return await this.client.call('post', uri, {
|
|
918
|
-
'content-type': 'application/json',
|
|
919
|
-
}, payload);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Update Float Attribute
|
|
924
|
-
*
|
|
925
|
-
* Update a float attribute. Changing the `default` value will not update
|
|
926
|
-
* already existing documents.
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
* @param {string} databaseId
|
|
930
|
-
* @param {string} collectionId
|
|
931
|
-
* @param {string} key
|
|
932
|
-
* @param {boolean} required
|
|
933
|
-
* @param {number} min
|
|
934
|
-
* @param {number} max
|
|
935
|
-
* @param {number} xdefault
|
|
936
|
-
* @throws {AppwriteException}
|
|
937
|
-
* @returns {Promise}
|
|
938
|
-
*/
|
|
939
|
-
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat> {
|
|
940
|
-
if (typeof databaseId === 'undefined') {
|
|
941
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
if (typeof collectionId === 'undefined') {
|
|
945
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
if (typeof key === 'undefined') {
|
|
949
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
if (typeof required === 'undefined') {
|
|
953
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
if (typeof min === 'undefined') {
|
|
957
|
-
throw new AppwriteException('Missing required parameter: "min"');
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
if (typeof max === 'undefined') {
|
|
961
|
-
throw new AppwriteException('Missing required parameter: "max"');
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
if (typeof xdefault === 'undefined') {
|
|
965
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
969
|
-
let payload: Payload = {};
|
|
970
|
-
|
|
971
|
-
if (typeof required !== 'undefined') {
|
|
972
|
-
payload['required'] = required;
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
if (typeof min !== 'undefined') {
|
|
976
|
-
payload['min'] = min;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
if (typeof max !== 'undefined') {
|
|
980
|
-
payload['max'] = max;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
if (typeof xdefault !== 'undefined') {
|
|
984
|
-
payload['default'] = xdefault;
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
988
|
-
return await this.client.call('patch', uri, {
|
|
989
|
-
'content-type': 'application/json',
|
|
990
|
-
}, payload);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
/**
|
|
994
|
-
* Create Integer Attribute
|
|
995
|
-
*
|
|
996
|
-
* Create an integer attribute. Optionally, minimum and maximum values can be
|
|
997
|
-
* provided.
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1000
|
-
* @param {string} databaseId
|
|
1001
|
-
* @param {string} collectionId
|
|
1002
|
-
* @param {string} key
|
|
1003
|
-
* @param {boolean} required
|
|
1004
|
-
* @param {number} min
|
|
1005
|
-
* @param {number} max
|
|
1006
|
-
* @param {number} xdefault
|
|
1007
|
-
* @param {boolean} array
|
|
1008
|
-
* @throws {AppwriteException}
|
|
1009
|
-
* @returns {Promise}
|
|
1010
|
-
*/
|
|
1011
|
-
async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger> {
|
|
1012
|
-
if (typeof databaseId === 'undefined') {
|
|
1013
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
if (typeof collectionId === 'undefined') {
|
|
1017
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
if (typeof key === 'undefined') {
|
|
1021
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
if (typeof required === 'undefined') {
|
|
1025
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1029
|
-
let payload: Payload = {};
|
|
1030
|
-
|
|
1031
|
-
if (typeof key !== 'undefined') {
|
|
1032
|
-
payload['key'] = key;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
if (typeof required !== 'undefined') {
|
|
1036
|
-
payload['required'] = required;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
if (typeof min !== 'undefined') {
|
|
1040
|
-
payload['min'] = min;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
if (typeof max !== 'undefined') {
|
|
1044
|
-
payload['max'] = max;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
if (typeof xdefault !== 'undefined') {
|
|
1048
|
-
payload['default'] = xdefault;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
if (typeof array !== 'undefined') {
|
|
1052
|
-
payload['array'] = array;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1056
|
-
return await this.client.call('post', uri, {
|
|
1057
|
-
'content-type': 'application/json',
|
|
1058
|
-
}, payload);
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
/**
|
|
1062
|
-
* Update Integer Attribute
|
|
1063
|
-
*
|
|
1064
|
-
* Update an integer attribute. Changing the `default` value will not update
|
|
1065
|
-
* already existing documents.
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
* @param {string} databaseId
|
|
1069
|
-
* @param {string} collectionId
|
|
1070
|
-
* @param {string} key
|
|
1071
|
-
* @param {boolean} required
|
|
1072
|
-
* @param {number} min
|
|
1073
|
-
* @param {number} max
|
|
1074
|
-
* @param {number} xdefault
|
|
1075
|
-
* @throws {AppwriteException}
|
|
1076
|
-
* @returns {Promise}
|
|
1077
|
-
*/
|
|
1078
|
-
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger> {
|
|
1079
|
-
if (typeof databaseId === 'undefined') {
|
|
1080
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
if (typeof collectionId === 'undefined') {
|
|
1084
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
if (typeof key === 'undefined') {
|
|
1088
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
if (typeof required === 'undefined') {
|
|
1092
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
if (typeof min === 'undefined') {
|
|
1096
|
-
throw new AppwriteException('Missing required parameter: "min"');
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
if (typeof max === 'undefined') {
|
|
1100
|
-
throw new AppwriteException('Missing required parameter: "max"');
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
if (typeof xdefault === 'undefined') {
|
|
1104
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1108
|
-
let payload: Payload = {};
|
|
1109
|
-
|
|
1110
|
-
if (typeof required !== 'undefined') {
|
|
1111
|
-
payload['required'] = required;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
if (typeof min !== 'undefined') {
|
|
1115
|
-
payload['min'] = min;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
if (typeof max !== 'undefined') {
|
|
1119
|
-
payload['max'] = max;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
if (typeof xdefault !== 'undefined') {
|
|
1123
|
-
payload['default'] = xdefault;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1127
|
-
return await this.client.call('patch', uri, {
|
|
1128
|
-
'content-type': 'application/json',
|
|
1129
|
-
}, payload);
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
* Create IP Address Attribute
|
|
1134
|
-
*
|
|
1135
|
-
* Create IP address attribute.
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
* @param {string} databaseId
|
|
1139
|
-
* @param {string} collectionId
|
|
1140
|
-
* @param {string} key
|
|
1141
|
-
* @param {boolean} required
|
|
1142
|
-
* @param {string} xdefault
|
|
1143
|
-
* @param {boolean} array
|
|
1144
|
-
* @throws {AppwriteException}
|
|
1145
|
-
* @returns {Promise}
|
|
1146
|
-
*/
|
|
1147
|
-
async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp> {
|
|
1148
|
-
if (typeof databaseId === 'undefined') {
|
|
1149
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
if (typeof collectionId === 'undefined') {
|
|
1153
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
if (typeof key === 'undefined') {
|
|
1157
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
if (typeof required === 'undefined') {
|
|
1161
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1165
|
-
let payload: Payload = {};
|
|
1166
|
-
|
|
1167
|
-
if (typeof key !== 'undefined') {
|
|
1168
|
-
payload['key'] = key;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
if (typeof required !== 'undefined') {
|
|
1172
|
-
payload['required'] = required;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
if (typeof xdefault !== 'undefined') {
|
|
1176
|
-
payload['default'] = xdefault;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
if (typeof array !== 'undefined') {
|
|
1180
|
-
payload['array'] = array;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1184
|
-
return await this.client.call('post', uri, {
|
|
1185
|
-
'content-type': 'application/json',
|
|
1186
|
-
}, payload);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
1190
|
-
* Update IP Address Attribute
|
|
1191
|
-
*
|
|
1192
|
-
* Update an ip attribute. Changing the `default` value will not update
|
|
1193
|
-
* already existing documents.
|
|
1194
|
-
*
|
|
1195
|
-
*
|
|
1196
|
-
* @param {string} databaseId
|
|
1197
|
-
* @param {string} collectionId
|
|
1198
|
-
* @param {string} key
|
|
1199
|
-
* @param {boolean} required
|
|
1200
|
-
* @param {string} xdefault
|
|
1201
|
-
* @throws {AppwriteException}
|
|
1202
|
-
* @returns {Promise}
|
|
1203
|
-
*/
|
|
1204
|
-
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp> {
|
|
1205
|
-
if (typeof databaseId === 'undefined') {
|
|
1206
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
if (typeof collectionId === 'undefined') {
|
|
1210
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
if (typeof key === 'undefined') {
|
|
1214
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
if (typeof required === 'undefined') {
|
|
1218
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
if (typeof xdefault === 'undefined') {
|
|
1222
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1226
|
-
let payload: Payload = {};
|
|
1227
|
-
|
|
1228
|
-
if (typeof required !== 'undefined') {
|
|
1229
|
-
payload['required'] = required;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
if (typeof xdefault !== 'undefined') {
|
|
1233
|
-
payload['default'] = xdefault;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1237
|
-
return await this.client.call('patch', uri, {
|
|
1238
|
-
'content-type': 'application/json',
|
|
1239
|
-
}, payload);
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* Create Relationship Attribute
|
|
1244
|
-
*
|
|
1245
|
-
* Create relationship attribute. [Learn more about relationship
|
|
1246
|
-
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
* @param {string} databaseId
|
|
1250
|
-
* @param {string} collectionId
|
|
1251
|
-
* @param {string} relatedCollectionId
|
|
1252
|
-
* @param {string} type
|
|
1253
|
-
* @param {boolean} twoWay
|
|
1254
|
-
* @param {string} key
|
|
1255
|
-
* @param {string} twoWayKey
|
|
1256
|
-
* @param {string} onDelete
|
|
1257
|
-
* @throws {AppwriteException}
|
|
1258
|
-
* @returns {Promise}
|
|
1259
|
-
*/
|
|
1260
|
-
async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: string, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: string): Promise<Models.AttributeRelationship> {
|
|
1261
|
-
if (typeof databaseId === 'undefined') {
|
|
1262
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
if (typeof collectionId === 'undefined') {
|
|
1266
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
if (typeof relatedCollectionId === 'undefined') {
|
|
1270
|
-
throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
if (typeof type === 'undefined') {
|
|
1274
|
-
throw new AppwriteException('Missing required parameter: "type"');
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1278
|
-
let payload: Payload = {};
|
|
1279
|
-
|
|
1280
|
-
if (typeof relatedCollectionId !== 'undefined') {
|
|
1281
|
-
payload['relatedCollectionId'] = relatedCollectionId;
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
if (typeof type !== 'undefined') {
|
|
1285
|
-
payload['type'] = type;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
if (typeof twoWay !== 'undefined') {
|
|
1289
|
-
payload['twoWay'] = twoWay;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
if (typeof key !== 'undefined') {
|
|
1293
|
-
payload['key'] = key;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
if (typeof twoWayKey !== 'undefined') {
|
|
1297
|
-
payload['twoWayKey'] = twoWayKey;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
if (typeof onDelete !== 'undefined') {
|
|
1301
|
-
payload['onDelete'] = onDelete;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1305
|
-
return await this.client.call('post', uri, {
|
|
1306
|
-
'content-type': 'application/json',
|
|
1307
|
-
}, payload);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* Create String Attribute
|
|
1312
|
-
*
|
|
1313
|
-
* Create a string attribute.
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* @param {string} databaseId
|
|
1317
|
-
* @param {string} collectionId
|
|
1318
|
-
* @param {string} key
|
|
1319
|
-
* @param {number} size
|
|
1320
|
-
* @param {boolean} required
|
|
1321
|
-
* @param {string} xdefault
|
|
1322
|
-
* @param {boolean} array
|
|
1323
|
-
* @throws {AppwriteException}
|
|
1324
|
-
* @returns {Promise}
|
|
1325
|
-
*/
|
|
1326
|
-
async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString> {
|
|
1327
|
-
if (typeof databaseId === 'undefined') {
|
|
1328
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
if (typeof collectionId === 'undefined') {
|
|
1332
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
if (typeof key === 'undefined') {
|
|
1336
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
if (typeof size === 'undefined') {
|
|
1340
|
-
throw new AppwriteException('Missing required parameter: "size"');
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
if (typeof required === 'undefined') {
|
|
1344
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1348
|
-
let payload: Payload = {};
|
|
1349
|
-
|
|
1350
|
-
if (typeof key !== 'undefined') {
|
|
1351
|
-
payload['key'] = key;
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
if (typeof size !== 'undefined') {
|
|
1355
|
-
payload['size'] = size;
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
if (typeof required !== 'undefined') {
|
|
1359
|
-
payload['required'] = required;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
if (typeof xdefault !== 'undefined') {
|
|
1363
|
-
payload['default'] = xdefault;
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
if (typeof array !== 'undefined') {
|
|
1367
|
-
payload['array'] = array;
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1371
|
-
return await this.client.call('post', uri, {
|
|
1372
|
-
'content-type': 'application/json',
|
|
1373
|
-
}, payload);
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
/**
|
|
1377
|
-
* Update String Attribute
|
|
1378
|
-
*
|
|
1379
|
-
* Update a string attribute. Changing the `default` value will not update
|
|
1380
|
-
* already existing documents.
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
* @param {string} databaseId
|
|
1384
|
-
* @param {string} collectionId
|
|
1385
|
-
* @param {string} key
|
|
1386
|
-
* @param {boolean} required
|
|
1387
|
-
* @param {string} xdefault
|
|
1388
|
-
* @throws {AppwriteException}
|
|
1389
|
-
* @returns {Promise}
|
|
1390
|
-
*/
|
|
1391
|
-
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString> {
|
|
1392
|
-
if (typeof databaseId === 'undefined') {
|
|
1393
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
if (typeof collectionId === 'undefined') {
|
|
1397
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
if (typeof key === 'undefined') {
|
|
1401
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
if (typeof required === 'undefined') {
|
|
1405
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
if (typeof xdefault === 'undefined') {
|
|
1409
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1413
|
-
let payload: Payload = {};
|
|
1414
|
-
|
|
1415
|
-
if (typeof required !== 'undefined') {
|
|
1416
|
-
payload['required'] = required;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
if (typeof xdefault !== 'undefined') {
|
|
1420
|
-
payload['default'] = xdefault;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1424
|
-
return await this.client.call('patch', uri, {
|
|
1425
|
-
'content-type': 'application/json',
|
|
1426
|
-
}, payload);
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
/**
|
|
1430
|
-
* Create URL Attribute
|
|
1431
|
-
*
|
|
1432
|
-
* Create a URL attribute.
|
|
1433
|
-
*
|
|
1434
|
-
*
|
|
1435
|
-
* @param {string} databaseId
|
|
1436
|
-
* @param {string} collectionId
|
|
1437
|
-
* @param {string} key
|
|
1438
|
-
* @param {boolean} required
|
|
1439
|
-
* @param {string} xdefault
|
|
1440
|
-
* @param {boolean} array
|
|
1441
|
-
* @throws {AppwriteException}
|
|
1442
|
-
* @returns {Promise}
|
|
1443
|
-
*/
|
|
1444
|
-
async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl> {
|
|
1445
|
-
if (typeof databaseId === 'undefined') {
|
|
1446
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
if (typeof collectionId === 'undefined') {
|
|
1450
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
if (typeof key === 'undefined') {
|
|
1454
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
if (typeof required === 'undefined') {
|
|
1458
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1462
|
-
let payload: Payload = {};
|
|
1463
|
-
|
|
1464
|
-
if (typeof key !== 'undefined') {
|
|
1465
|
-
payload['key'] = key;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
if (typeof required !== 'undefined') {
|
|
1469
|
-
payload['required'] = required;
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
if (typeof xdefault !== 'undefined') {
|
|
1473
|
-
payload['default'] = xdefault;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
if (typeof array !== 'undefined') {
|
|
1477
|
-
payload['array'] = array;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1481
|
-
return await this.client.call('post', uri, {
|
|
1482
|
-
'content-type': 'application/json',
|
|
1483
|
-
}, payload);
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* Update URL Attribute
|
|
1488
|
-
*
|
|
1489
|
-
* Update an url attribute. Changing the `default` value will not update
|
|
1490
|
-
* already existing documents.
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
* @param {string} databaseId
|
|
1494
|
-
* @param {string} collectionId
|
|
1495
|
-
* @param {string} key
|
|
1496
|
-
* @param {boolean} required
|
|
1497
|
-
* @param {string} xdefault
|
|
1498
|
-
* @throws {AppwriteException}
|
|
1499
|
-
* @returns {Promise}
|
|
1500
|
-
*/
|
|
1501
|
-
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl> {
|
|
1502
|
-
if (typeof databaseId === 'undefined') {
|
|
1503
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
if (typeof collectionId === 'undefined') {
|
|
1507
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
if (typeof key === 'undefined') {
|
|
1511
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
if (typeof required === 'undefined') {
|
|
1515
|
-
throw new AppwriteException('Missing required parameter: "required"');
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
if (typeof xdefault === 'undefined') {
|
|
1519
|
-
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1523
|
-
let payload: Payload = {};
|
|
1524
|
-
|
|
1525
|
-
if (typeof required !== 'undefined') {
|
|
1526
|
-
payload['required'] = required;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
if (typeof xdefault !== 'undefined') {
|
|
1530
|
-
payload['default'] = xdefault;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1534
|
-
return await this.client.call('patch', uri, {
|
|
1535
|
-
'content-type': 'application/json',
|
|
1536
|
-
}, payload);
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
/**
|
|
1540
|
-
* Get Attribute
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
* @param {string} databaseId
|
|
1544
|
-
* @param {string} collectionId
|
|
1545
|
-
* @param {string} key
|
|
1546
|
-
* @throws {AppwriteException}
|
|
1547
|
-
* @returns {Promise}
|
|
1548
|
-
*/
|
|
1549
|
-
async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
|
1550
|
-
if (typeof databaseId === 'undefined') {
|
|
1551
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
if (typeof collectionId === 'undefined') {
|
|
1555
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
if (typeof key === 'undefined') {
|
|
1559
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1563
|
-
let payload: Payload = {};
|
|
1564
|
-
|
|
1565
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1566
|
-
return await this.client.call('get', uri, {
|
|
1567
|
-
'content-type': 'application/json',
|
|
1568
|
-
}, payload);
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
/**
|
|
1572
|
-
* Delete Attribute
|
|
1573
|
-
*
|
|
1574
|
-
*
|
|
1575
|
-
* @param {string} databaseId
|
|
1576
|
-
* @param {string} collectionId
|
|
1577
|
-
* @param {string} key
|
|
1578
|
-
* @throws {AppwriteException}
|
|
1579
|
-
* @returns {Promise}
|
|
1580
|
-
*/
|
|
1581
|
-
async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
|
1582
|
-
if (typeof databaseId === 'undefined') {
|
|
1583
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
if (typeof collectionId === 'undefined') {
|
|
1587
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
if (typeof key === 'undefined') {
|
|
1591
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1595
|
-
let payload: Payload = {};
|
|
1596
|
-
|
|
1597
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1598
|
-
return await this.client.call('delete', uri, {
|
|
1599
|
-
'content-type': 'application/json',
|
|
1600
|
-
}, payload);
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
/**
|
|
1604
|
-
* Update Relationship Attribute
|
|
1605
|
-
*
|
|
1606
|
-
* Update relationship attribute. [Learn more about relationship
|
|
1607
|
-
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
* @param {string} databaseId
|
|
1611
|
-
* @param {string} collectionId
|
|
1612
|
-
* @param {string} key
|
|
1613
|
-
* @param {string} onDelete
|
|
1614
|
-
* @throws {AppwriteException}
|
|
1615
|
-
* @returns {Promise}
|
|
1616
|
-
*/
|
|
1617
|
-
async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: string): Promise<Models.AttributeRelationship> {
|
|
1618
|
-
if (typeof databaseId === 'undefined') {
|
|
1619
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
if (typeof collectionId === 'undefined') {
|
|
1623
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
if (typeof key === 'undefined') {
|
|
1627
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1631
|
-
let payload: Payload = {};
|
|
1632
|
-
|
|
1633
|
-
if (typeof onDelete !== 'undefined') {
|
|
1634
|
-
payload['onDelete'] = onDelete;
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1638
|
-
return await this.client.call('patch', uri, {
|
|
1639
|
-
'content-type': 'application/json',
|
|
1640
|
-
}, payload);
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
/**
|
|
1644
|
-
* List Documents
|
|
1645
|
-
*
|
|
1646
|
-
* Get a list of all the user's documents in a given collection. You can use
|
|
1647
|
-
* the query params to filter your results.
|
|
1648
|
-
*
|
|
1649
|
-
* @param {string} databaseId
|
|
1650
|
-
* @param {string} collectionId
|
|
1651
|
-
* @param {string[]} queries
|
|
1652
|
-
* @throws {AppwriteException}
|
|
1653
|
-
* @returns {Promise}
|
|
1654
|
-
*/
|
|
1655
|
-
async listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
|
|
1656
|
-
if (typeof databaseId === 'undefined') {
|
|
1657
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
if (typeof collectionId === 'undefined') {
|
|
1661
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1665
|
-
let payload: Payload = {};
|
|
1666
|
-
|
|
1667
|
-
if (typeof queries !== 'undefined') {
|
|
1668
|
-
payload['queries'] = queries;
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1672
|
-
return await this.client.call('get', uri, {
|
|
1673
|
-
'content-type': 'application/json',
|
|
1674
|
-
}, payload);
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
/**
|
|
1678
|
-
* Create Document
|
|
1679
|
-
*
|
|
1680
|
-
* Create a new Document. Before using this route, you should create a new
|
|
1681
|
-
* collection resource using either a [server
|
|
1682
|
-
* integration](/docs/server/databases#databasesCreateCollection) API or
|
|
1683
|
-
* directly from your database console.
|
|
1684
|
-
*
|
|
1685
|
-
* @param {string} databaseId
|
|
1686
|
-
* @param {string} collectionId
|
|
1687
|
-
* @param {string} documentId
|
|
1688
|
-
* @param {Omit<Document, keyof Models.Document>} data
|
|
1689
|
-
* @param {string[]} permissions
|
|
1690
|
-
* @throws {AppwriteException}
|
|
1691
|
-
* @returns {Promise}
|
|
1692
|
-
*/
|
|
1693
|
-
async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
|
|
1694
|
-
if (typeof databaseId === 'undefined') {
|
|
1695
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
if (typeof collectionId === 'undefined') {
|
|
1699
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
if (typeof documentId === 'undefined') {
|
|
1703
|
-
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
if (typeof data === 'undefined') {
|
|
1707
|
-
throw new AppwriteException('Missing required parameter: "data"');
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1711
|
-
let payload: Payload = {};
|
|
1712
|
-
|
|
1713
|
-
if (typeof documentId !== 'undefined') {
|
|
1714
|
-
payload['documentId'] = documentId;
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
if (typeof data !== 'undefined') {
|
|
1718
|
-
payload['data'] = data;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
if (typeof permissions !== 'undefined') {
|
|
1722
|
-
payload['permissions'] = permissions;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1726
|
-
return await this.client.call('post', uri, {
|
|
1727
|
-
'content-type': 'application/json',
|
|
1728
|
-
}, payload);
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
/**
|
|
1732
|
-
* Get Document
|
|
1733
|
-
*
|
|
1734
|
-
* Get a document by its unique ID. This endpoint response returns a JSON
|
|
1735
|
-
* object with the document data.
|
|
1736
|
-
*
|
|
1737
|
-
* @param {string} databaseId
|
|
1738
|
-
* @param {string} collectionId
|
|
1739
|
-
* @param {string} documentId
|
|
1740
|
-
* @param {string[]} queries
|
|
1741
|
-
* @throws {AppwriteException}
|
|
1742
|
-
* @returns {Promise}
|
|
1743
|
-
*/
|
|
1744
|
-
async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
|
|
1745
|
-
if (typeof databaseId === 'undefined') {
|
|
1746
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
if (typeof collectionId === 'undefined') {
|
|
1750
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
if (typeof documentId === 'undefined') {
|
|
1754
|
-
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1758
|
-
let payload: Payload = {};
|
|
1759
|
-
|
|
1760
|
-
if (typeof queries !== 'undefined') {
|
|
1761
|
-
payload['queries'] = queries;
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1765
|
-
return await this.client.call('get', uri, {
|
|
1766
|
-
'content-type': 'application/json',
|
|
1767
|
-
}, payload);
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
/**
|
|
1771
|
-
* Update Document
|
|
1772
|
-
*
|
|
1773
|
-
* Update a document by its unique ID. Using the patch method you can pass
|
|
1774
|
-
* only specific fields that will get updated.
|
|
1775
|
-
*
|
|
1776
|
-
* @param {string} databaseId
|
|
1777
|
-
* @param {string} collectionId
|
|
1778
|
-
* @param {string} documentId
|
|
1779
|
-
* @param {Partial<Omit<Document, keyof Models.Document>>} data
|
|
1780
|
-
* @param {string[]} permissions
|
|
1781
|
-
* @throws {AppwriteException}
|
|
1782
|
-
* @returns {Promise}
|
|
1783
|
-
*/
|
|
1784
|
-
async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
|
|
1785
|
-
if (typeof databaseId === 'undefined') {
|
|
1786
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
if (typeof collectionId === 'undefined') {
|
|
1790
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
if (typeof documentId === 'undefined') {
|
|
1794
|
-
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1798
|
-
let payload: Payload = {};
|
|
1799
|
-
|
|
1800
|
-
if (typeof data !== 'undefined') {
|
|
1801
|
-
payload['data'] = data;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
if (typeof permissions !== 'undefined') {
|
|
1805
|
-
payload['permissions'] = permissions;
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1809
|
-
return await this.client.call('patch', uri, {
|
|
1810
|
-
'content-type': 'application/json',
|
|
1811
|
-
}, payload);
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
/**
|
|
1815
|
-
* Delete Document
|
|
1816
|
-
*
|
|
1817
|
-
* Delete a document by its unique ID.
|
|
1818
|
-
*
|
|
1819
|
-
* @param {string} databaseId
|
|
1820
|
-
* @param {string} collectionId
|
|
1821
|
-
* @param {string} documentId
|
|
1822
|
-
* @throws {AppwriteException}
|
|
1823
|
-
* @returns {Promise}
|
|
1824
|
-
*/
|
|
1825
|
-
async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
|
|
1826
|
-
if (typeof databaseId === 'undefined') {
|
|
1827
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
if (typeof collectionId === 'undefined') {
|
|
1831
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
if (typeof documentId === 'undefined') {
|
|
1835
|
-
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1839
|
-
let payload: Payload = {};
|
|
1840
|
-
|
|
1841
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1842
|
-
return await this.client.call('delete', uri, {
|
|
1843
|
-
'content-type': 'application/json',
|
|
1844
|
-
}, payload);
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
/**
|
|
1848
|
-
* List Document Logs
|
|
1849
|
-
*
|
|
1850
|
-
* Get the document activity logs list by its unique ID.
|
|
1851
|
-
*
|
|
1852
|
-
* @param {string} databaseId
|
|
1853
|
-
* @param {string} collectionId
|
|
1854
|
-
* @param {string} documentId
|
|
1855
|
-
* @param {string[]} queries
|
|
1856
|
-
* @throws {AppwriteException}
|
|
1857
|
-
* @returns {Promise}
|
|
1858
|
-
*/
|
|
1859
|
-
async listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Models.LogList> {
|
|
1860
|
-
if (typeof databaseId === 'undefined') {
|
|
1861
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
if (typeof collectionId === 'undefined') {
|
|
1865
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
if (typeof documentId === 'undefined') {
|
|
1869
|
-
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1873
|
-
let payload: Payload = {};
|
|
1874
|
-
|
|
1875
|
-
if (typeof queries !== 'undefined') {
|
|
1876
|
-
payload['queries'] = queries;
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1880
|
-
return await this.client.call('get', uri, {
|
|
1881
|
-
'content-type': 'application/json',
|
|
1882
|
-
}, payload);
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
/**
|
|
1886
|
-
* List Indexes
|
|
1887
|
-
*
|
|
1888
|
-
*
|
|
1889
|
-
* @param {string} databaseId
|
|
1890
|
-
* @param {string} collectionId
|
|
1891
|
-
* @throws {AppwriteException}
|
|
1892
|
-
* @returns {Promise}
|
|
1893
|
-
*/
|
|
1894
|
-
async listIndexes(databaseId: string, collectionId: string): Promise<Models.IndexList> {
|
|
1895
|
-
if (typeof databaseId === 'undefined') {
|
|
1896
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
if (typeof collectionId === 'undefined') {
|
|
1900
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1904
|
-
let payload: Payload = {};
|
|
1905
|
-
|
|
1906
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1907
|
-
return await this.client.call('get', uri, {
|
|
1908
|
-
'content-type': 'application/json',
|
|
1909
|
-
}, payload);
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
/**
|
|
1913
|
-
* Create Index
|
|
1914
|
-
*
|
|
1915
|
-
*
|
|
1916
|
-
* @param {string} databaseId
|
|
1917
|
-
* @param {string} collectionId
|
|
1918
|
-
* @param {string} key
|
|
1919
|
-
* @param {string} type
|
|
1920
|
-
* @param {string[]} attributes
|
|
1921
|
-
* @param {string[]} orders
|
|
1922
|
-
* @throws {AppwriteException}
|
|
1923
|
-
* @returns {Promise}
|
|
1924
|
-
*/
|
|
1925
|
-
async createIndex(databaseId: string, collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise<Models.Index> {
|
|
1926
|
-
if (typeof databaseId === 'undefined') {
|
|
1927
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
if (typeof collectionId === 'undefined') {
|
|
1931
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
if (typeof key === 'undefined') {
|
|
1935
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
if (typeof type === 'undefined') {
|
|
1939
|
-
throw new AppwriteException('Missing required parameter: "type"');
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
if (typeof attributes === 'undefined') {
|
|
1943
|
-
throw new AppwriteException('Missing required parameter: "attributes"');
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1947
|
-
let payload: Payload = {};
|
|
1948
|
-
|
|
1949
|
-
if (typeof key !== 'undefined') {
|
|
1950
|
-
payload['key'] = key;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
if (typeof type !== 'undefined') {
|
|
1954
|
-
payload['type'] = type;
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
if (typeof attributes !== 'undefined') {
|
|
1958
|
-
payload['attributes'] = attributes;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
if (typeof orders !== 'undefined') {
|
|
1962
|
-
payload['orders'] = orders;
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1966
|
-
return await this.client.call('post', uri, {
|
|
1967
|
-
'content-type': 'application/json',
|
|
1968
|
-
}, payload);
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
/**
|
|
1972
|
-
* Get Index
|
|
1973
|
-
*
|
|
1974
|
-
*
|
|
1975
|
-
* @param {string} databaseId
|
|
1976
|
-
* @param {string} collectionId
|
|
1977
|
-
* @param {string} key
|
|
1978
|
-
* @throws {AppwriteException}
|
|
1979
|
-
* @returns {Promise}
|
|
1980
|
-
*/
|
|
1981
|
-
async getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index> {
|
|
1982
|
-
if (typeof databaseId === 'undefined') {
|
|
1983
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
if (typeof collectionId === 'undefined') {
|
|
1987
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
if (typeof key === 'undefined') {
|
|
1991
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1995
|
-
let payload: Payload = {};
|
|
1996
|
-
|
|
1997
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1998
|
-
return await this.client.call('get', uri, {
|
|
1999
|
-
'content-type': 'application/json',
|
|
2000
|
-
}, payload);
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
/**
|
|
2004
|
-
* Delete Index
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
* @param {string} databaseId
|
|
2008
|
-
* @param {string} collectionId
|
|
2009
|
-
* @param {string} key
|
|
2010
|
-
* @throws {AppwriteException}
|
|
2011
|
-
* @returns {Promise}
|
|
2012
|
-
*/
|
|
2013
|
-
async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
|
2014
|
-
if (typeof databaseId === 'undefined') {
|
|
2015
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
if (typeof collectionId === 'undefined') {
|
|
2019
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
if (typeof key === 'undefined') {
|
|
2023
|
-
throw new AppwriteException('Missing required parameter: "key"');
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
2027
|
-
let payload: Payload = {};
|
|
2028
|
-
|
|
2029
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
2030
|
-
return await this.client.call('delete', uri, {
|
|
2031
|
-
'content-type': 'application/json',
|
|
2032
|
-
}, payload);
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
/**
|
|
2036
|
-
* List Collection Logs
|
|
2037
|
-
*
|
|
2038
|
-
* Get the collection activity logs list by its unique ID.
|
|
2039
|
-
*
|
|
2040
|
-
* @param {string} databaseId
|
|
2041
|
-
* @param {string} collectionId
|
|
2042
|
-
* @param {string[]} queries
|
|
2043
|
-
* @throws {AppwriteException}
|
|
2044
|
-
* @returns {Promise}
|
|
2045
|
-
*/
|
|
2046
|
-
async listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.LogList> {
|
|
2047
|
-
if (typeof databaseId === 'undefined') {
|
|
2048
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
if (typeof collectionId === 'undefined') {
|
|
2052
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2056
|
-
let payload: Payload = {};
|
|
2057
|
-
|
|
2058
|
-
if (typeof queries !== 'undefined') {
|
|
2059
|
-
payload['queries'] = queries;
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
2063
|
-
return await this.client.call('get', uri, {
|
|
2064
|
-
'content-type': 'application/json',
|
|
2065
|
-
}, payload);
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
/**
|
|
2069
|
-
* Get usage stats for a collection
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
* @param {string} databaseId
|
|
2073
|
-
* @param {string} collectionId
|
|
2074
|
-
* @param {string} range
|
|
2075
|
-
* @throws {AppwriteException}
|
|
2076
|
-
* @returns {Promise}
|
|
2077
|
-
*/
|
|
2078
|
-
async getCollectionUsage(databaseId: string, collectionId: string, range?: string): Promise<Models.UsageCollection> {
|
|
2079
|
-
if (typeof databaseId === 'undefined') {
|
|
2080
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
if (typeof collectionId === 'undefined') {
|
|
2084
|
-
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
let path = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2088
|
-
let payload: Payload = {};
|
|
2089
|
-
|
|
2090
|
-
if (typeof range !== 'undefined') {
|
|
2091
|
-
payload['range'] = range;
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
2095
|
-
return await this.client.call('get', uri, {
|
|
2096
|
-
'content-type': 'application/json',
|
|
2097
|
-
}, payload);
|
|
2098
|
-
}
|
|
2099
|
-
|
|
2100
|
-
/**
|
|
2101
|
-
* List Database Logs
|
|
2102
|
-
*
|
|
2103
|
-
* Get the database activity logs list by its unique ID.
|
|
2104
|
-
*
|
|
2105
|
-
* @param {string} databaseId
|
|
2106
|
-
* @param {string[]} queries
|
|
2107
|
-
* @throws {AppwriteException}
|
|
2108
|
-
* @returns {Promise}
|
|
2109
|
-
*/
|
|
2110
|
-
async listLogs(databaseId: string, queries?: string[]): Promise<Models.LogList> {
|
|
2111
|
-
if (typeof databaseId === 'undefined') {
|
|
2112
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
|
-
let path = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
|
|
2116
|
-
let payload: Payload = {};
|
|
2117
|
-
|
|
2118
|
-
if (typeof queries !== 'undefined') {
|
|
2119
|
-
payload['queries'] = queries;
|
|
2120
|
-
}
|
|
2121
|
-
|
|
2122
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
2123
|
-
return await this.client.call('get', uri, {
|
|
2124
|
-
'content-type': 'application/json',
|
|
2125
|
-
}, payload);
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
/**
|
|
2129
|
-
* Get usage stats for the database
|
|
2130
|
-
*
|
|
2131
|
-
*
|
|
2132
|
-
* @param {string} databaseId
|
|
2133
|
-
* @param {string} range
|
|
2134
|
-
* @throws {AppwriteException}
|
|
2135
|
-
* @returns {Promise}
|
|
2136
|
-
*/
|
|
2137
|
-
async getDatabaseUsage(databaseId: string, range?: string): Promise<Models.UsageDatabase> {
|
|
2138
|
-
if (typeof databaseId === 'undefined') {
|
|
2139
|
-
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2140
|
-
}
|
|
2141
|
-
|
|
2142
|
-
let path = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
|
|
2143
|
-
let payload: Payload = {};
|
|
2144
|
-
|
|
2145
|
-
if (typeof range !== 'undefined') {
|
|
2146
|
-
payload['range'] = range;
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
2150
|
-
return await this.client.call('get', uri, {
|
|
2151
|
-
'content-type': 'application/json',
|
|
2152
|
-
}, payload);
|
|
13
|
+
/**
|
|
14
|
+
* List databases
|
|
15
|
+
*
|
|
16
|
+
* Get a list of all databases from the current Appwrite project. You can use
|
|
17
|
+
* the search parameter to filter your results.
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} queries
|
|
20
|
+
* @param {string} search
|
|
21
|
+
* @throws {AppwriteException}
|
|
22
|
+
* @returns {Promise}
|
|
23
|
+
*/
|
|
24
|
+
async list(queries?: string[], search?: string): Promise<Models.DatabaseList> {
|
|
25
|
+
const apiPath = '/databases';
|
|
26
|
+
const payload: Payload = {};
|
|
27
|
+
|
|
28
|
+
if (typeof queries !== 'undefined') {
|
|
29
|
+
payload['queries'] = queries;
|
|
2153
30
|
}
|
|
31
|
+
|
|
32
|
+
if (typeof search !== 'undefined') {
|
|
33
|
+
payload['search'] = search;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
37
|
+
return await this.client.call('get', uri, {
|
|
38
|
+
'content-type': 'application/json',
|
|
39
|
+
}, payload);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Create database
|
|
44
|
+
*
|
|
45
|
+
* Create a new Database.
|
|
46
|
+
*
|
|
47
|
+
*
|
|
48
|
+
* @param {string} databaseId
|
|
49
|
+
* @param {string} name
|
|
50
|
+
* @param {boolean} enabled
|
|
51
|
+
* @throws {AppwriteException}
|
|
52
|
+
* @returns {Promise}
|
|
53
|
+
*/
|
|
54
|
+
async create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database> {
|
|
55
|
+
if (typeof databaseId === 'undefined') {
|
|
56
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (typeof name === 'undefined') {
|
|
60
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const apiPath = '/databases';
|
|
64
|
+
const payload: Payload = {};
|
|
65
|
+
|
|
66
|
+
if (typeof databaseId !== 'undefined') {
|
|
67
|
+
payload['databaseId'] = databaseId;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeof name !== 'undefined') {
|
|
71
|
+
payload['name'] = name;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (typeof enabled !== 'undefined') {
|
|
75
|
+
payload['enabled'] = enabled;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
79
|
+
return await this.client.call('post', uri, {
|
|
80
|
+
'content-type': 'application/json',
|
|
81
|
+
}, payload);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get usage stats for the database
|
|
86
|
+
*
|
|
87
|
+
*
|
|
88
|
+
* @param {string} range
|
|
89
|
+
* @throws {AppwriteException}
|
|
90
|
+
* @returns {Promise}
|
|
91
|
+
*/
|
|
92
|
+
async getUsage(range?: string): Promise<Models.UsageDatabases> {
|
|
93
|
+
const apiPath = '/databases/usage';
|
|
94
|
+
const payload: Payload = {};
|
|
95
|
+
|
|
96
|
+
if (typeof range !== 'undefined') {
|
|
97
|
+
payload['range'] = range;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
101
|
+
return await this.client.call('get', uri, {
|
|
102
|
+
'content-type': 'application/json',
|
|
103
|
+
}, payload);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get database
|
|
108
|
+
*
|
|
109
|
+
* Get a database by its unique ID. This endpoint response returns a JSON
|
|
110
|
+
* object with the database metadata.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} databaseId
|
|
113
|
+
* @throws {AppwriteException}
|
|
114
|
+
* @returns {Promise}
|
|
115
|
+
*/
|
|
116
|
+
async get(databaseId: string): Promise<Models.Database> {
|
|
117
|
+
if (typeof databaseId === 'undefined') {
|
|
118
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
|
122
|
+
const payload: Payload = {};
|
|
123
|
+
|
|
124
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
125
|
+
return await this.client.call('get', uri, {
|
|
126
|
+
'content-type': 'application/json',
|
|
127
|
+
}, payload);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Update database
|
|
132
|
+
*
|
|
133
|
+
* Update a database by its unique ID.
|
|
134
|
+
*
|
|
135
|
+
* @param {string} databaseId
|
|
136
|
+
* @param {string} name
|
|
137
|
+
* @param {boolean} enabled
|
|
138
|
+
* @throws {AppwriteException}
|
|
139
|
+
* @returns {Promise}
|
|
140
|
+
*/
|
|
141
|
+
async update(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database> {
|
|
142
|
+
if (typeof databaseId === 'undefined') {
|
|
143
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (typeof name === 'undefined') {
|
|
147
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
|
151
|
+
const payload: Payload = {};
|
|
152
|
+
|
|
153
|
+
if (typeof name !== 'undefined') {
|
|
154
|
+
payload['name'] = name;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (typeof enabled !== 'undefined') {
|
|
158
|
+
payload['enabled'] = enabled;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
162
|
+
return await this.client.call('put', uri, {
|
|
163
|
+
'content-type': 'application/json',
|
|
164
|
+
}, payload);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Delete database
|
|
169
|
+
*
|
|
170
|
+
* Delete a database by its unique ID. Only API keys with with databases.write
|
|
171
|
+
* scope can delete a database.
|
|
172
|
+
*
|
|
173
|
+
* @param {string} databaseId
|
|
174
|
+
* @throws {AppwriteException}
|
|
175
|
+
* @returns {Promise}
|
|
176
|
+
*/
|
|
177
|
+
async delete(databaseId: string): Promise<{}> {
|
|
178
|
+
if (typeof databaseId === 'undefined') {
|
|
179
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
|
183
|
+
const payload: Payload = {};
|
|
184
|
+
|
|
185
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
186
|
+
return await this.client.call('delete', uri, {
|
|
187
|
+
'content-type': 'application/json',
|
|
188
|
+
}, payload);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* List collections
|
|
193
|
+
*
|
|
194
|
+
* Get a list of all collections that belong to the provided databaseId. You
|
|
195
|
+
* can use the search parameter to filter your results.
|
|
196
|
+
*
|
|
197
|
+
* @param {string} databaseId
|
|
198
|
+
* @param {string[]} queries
|
|
199
|
+
* @param {string} search
|
|
200
|
+
* @throws {AppwriteException}
|
|
201
|
+
* @returns {Promise}
|
|
202
|
+
*/
|
|
203
|
+
async listCollections(databaseId: string, queries?: string[], search?: string): Promise<Models.CollectionList> {
|
|
204
|
+
if (typeof databaseId === 'undefined') {
|
|
205
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
|
209
|
+
const payload: Payload = {};
|
|
210
|
+
|
|
211
|
+
if (typeof queries !== 'undefined') {
|
|
212
|
+
payload['queries'] = queries;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (typeof search !== 'undefined') {
|
|
216
|
+
payload['search'] = search;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
220
|
+
return await this.client.call('get', uri, {
|
|
221
|
+
'content-type': 'application/json',
|
|
222
|
+
}, payload);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Create collection
|
|
227
|
+
*
|
|
228
|
+
* Create a new Collection. Before using this route, you should create a new
|
|
229
|
+
* database resource using either a [server
|
|
230
|
+
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
|
|
231
|
+
* API or directly from your database console.
|
|
232
|
+
*
|
|
233
|
+
* @param {string} databaseId
|
|
234
|
+
* @param {string} collectionId
|
|
235
|
+
* @param {string} name
|
|
236
|
+
* @param {string[]} permissions
|
|
237
|
+
* @param {boolean} documentSecurity
|
|
238
|
+
* @param {boolean} enabled
|
|
239
|
+
* @throws {AppwriteException}
|
|
240
|
+
* @returns {Promise}
|
|
241
|
+
*/
|
|
242
|
+
async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
|
|
243
|
+
if (typeof databaseId === 'undefined') {
|
|
244
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (typeof collectionId === 'undefined') {
|
|
248
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (typeof name === 'undefined') {
|
|
252
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
|
256
|
+
const payload: Payload = {};
|
|
257
|
+
|
|
258
|
+
if (typeof collectionId !== 'undefined') {
|
|
259
|
+
payload['collectionId'] = collectionId;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (typeof name !== 'undefined') {
|
|
263
|
+
payload['name'] = name;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (typeof permissions !== 'undefined') {
|
|
267
|
+
payload['permissions'] = permissions;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (typeof documentSecurity !== 'undefined') {
|
|
271
|
+
payload['documentSecurity'] = documentSecurity;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (typeof enabled !== 'undefined') {
|
|
275
|
+
payload['enabled'] = enabled;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
279
|
+
return await this.client.call('post', uri, {
|
|
280
|
+
'content-type': 'application/json',
|
|
281
|
+
}, payload);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Get collection
|
|
286
|
+
*
|
|
287
|
+
* Get a collection by its unique ID. This endpoint response returns a JSON
|
|
288
|
+
* object with the collection metadata.
|
|
289
|
+
*
|
|
290
|
+
* @param {string} databaseId
|
|
291
|
+
* @param {string} collectionId
|
|
292
|
+
* @throws {AppwriteException}
|
|
293
|
+
* @returns {Promise}
|
|
294
|
+
*/
|
|
295
|
+
async getCollection(databaseId: string, collectionId: string): Promise<Models.Collection> {
|
|
296
|
+
if (typeof databaseId === 'undefined') {
|
|
297
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (typeof collectionId === 'undefined') {
|
|
301
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
305
|
+
const payload: Payload = {};
|
|
306
|
+
|
|
307
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
308
|
+
return await this.client.call('get', uri, {
|
|
309
|
+
'content-type': 'application/json',
|
|
310
|
+
}, payload);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Update collection
|
|
315
|
+
*
|
|
316
|
+
* Update a collection by its unique ID.
|
|
317
|
+
*
|
|
318
|
+
* @param {string} databaseId
|
|
319
|
+
* @param {string} collectionId
|
|
320
|
+
* @param {string} name
|
|
321
|
+
* @param {string[]} permissions
|
|
322
|
+
* @param {boolean} documentSecurity
|
|
323
|
+
* @param {boolean} enabled
|
|
324
|
+
* @throws {AppwriteException}
|
|
325
|
+
* @returns {Promise}
|
|
326
|
+
*/
|
|
327
|
+
async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
|
|
328
|
+
if (typeof databaseId === 'undefined') {
|
|
329
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (typeof collectionId === 'undefined') {
|
|
333
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (typeof name === 'undefined') {
|
|
337
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
341
|
+
const payload: Payload = {};
|
|
342
|
+
|
|
343
|
+
if (typeof name !== 'undefined') {
|
|
344
|
+
payload['name'] = name;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (typeof permissions !== 'undefined') {
|
|
348
|
+
payload['permissions'] = permissions;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (typeof documentSecurity !== 'undefined') {
|
|
352
|
+
payload['documentSecurity'] = documentSecurity;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (typeof enabled !== 'undefined') {
|
|
356
|
+
payload['enabled'] = enabled;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
360
|
+
return await this.client.call('put', uri, {
|
|
361
|
+
'content-type': 'application/json',
|
|
362
|
+
}, payload);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Delete collection
|
|
367
|
+
*
|
|
368
|
+
* Delete a collection by its unique ID. Only users with write permissions
|
|
369
|
+
* have access to delete this resource.
|
|
370
|
+
*
|
|
371
|
+
* @param {string} databaseId
|
|
372
|
+
* @param {string} collectionId
|
|
373
|
+
* @throws {AppwriteException}
|
|
374
|
+
* @returns {Promise}
|
|
375
|
+
*/
|
|
376
|
+
async deleteCollection(databaseId: string, collectionId: string): Promise<{}> {
|
|
377
|
+
if (typeof databaseId === 'undefined') {
|
|
378
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (typeof collectionId === 'undefined') {
|
|
382
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
386
|
+
const payload: Payload = {};
|
|
387
|
+
|
|
388
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
389
|
+
return await this.client.call('delete', uri, {
|
|
390
|
+
'content-type': 'application/json',
|
|
391
|
+
}, payload);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* List attributes
|
|
396
|
+
*
|
|
397
|
+
*
|
|
398
|
+
* @param {string} databaseId
|
|
399
|
+
* @param {string} collectionId
|
|
400
|
+
* @param {string[]} queries
|
|
401
|
+
* @throws {AppwriteException}
|
|
402
|
+
* @returns {Promise}
|
|
403
|
+
*/
|
|
404
|
+
async listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.AttributeList> {
|
|
405
|
+
if (typeof databaseId === 'undefined') {
|
|
406
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (typeof collectionId === 'undefined') {
|
|
410
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
414
|
+
const payload: Payload = {};
|
|
415
|
+
|
|
416
|
+
if (typeof queries !== 'undefined') {
|
|
417
|
+
payload['queries'] = queries;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
421
|
+
return await this.client.call('get', uri, {
|
|
422
|
+
'content-type': 'application/json',
|
|
423
|
+
}, payload);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Create boolean attribute
|
|
428
|
+
*
|
|
429
|
+
* Create a boolean attribute.
|
|
430
|
+
*
|
|
431
|
+
*
|
|
432
|
+
* @param {string} databaseId
|
|
433
|
+
* @param {string} collectionId
|
|
434
|
+
* @param {string} key
|
|
435
|
+
* @param {boolean} required
|
|
436
|
+
* @param {boolean} xdefault
|
|
437
|
+
* @param {boolean} array
|
|
438
|
+
* @throws {AppwriteException}
|
|
439
|
+
* @returns {Promise}
|
|
440
|
+
*/
|
|
441
|
+
async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean> {
|
|
442
|
+
if (typeof databaseId === 'undefined') {
|
|
443
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (typeof collectionId === 'undefined') {
|
|
447
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (typeof key === 'undefined') {
|
|
451
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (typeof required === 'undefined') {
|
|
455
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
459
|
+
const payload: Payload = {};
|
|
460
|
+
|
|
461
|
+
if (typeof key !== 'undefined') {
|
|
462
|
+
payload['key'] = key;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (typeof required !== 'undefined') {
|
|
466
|
+
payload['required'] = required;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (typeof xdefault !== 'undefined') {
|
|
470
|
+
payload['default'] = xdefault;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (typeof array !== 'undefined') {
|
|
474
|
+
payload['array'] = array;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
478
|
+
return await this.client.call('post', uri, {
|
|
479
|
+
'content-type': 'application/json',
|
|
480
|
+
}, payload);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Update boolean attribute
|
|
485
|
+
*
|
|
486
|
+
*
|
|
487
|
+
* @param {string} databaseId
|
|
488
|
+
* @param {string} collectionId
|
|
489
|
+
* @param {string} key
|
|
490
|
+
* @param {boolean} required
|
|
491
|
+
* @param {boolean} xdefault
|
|
492
|
+
* @throws {AppwriteException}
|
|
493
|
+
* @returns {Promise}
|
|
494
|
+
*/
|
|
495
|
+
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean> {
|
|
496
|
+
if (typeof databaseId === 'undefined') {
|
|
497
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (typeof collectionId === 'undefined') {
|
|
501
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (typeof key === 'undefined') {
|
|
505
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (typeof required === 'undefined') {
|
|
509
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (typeof xdefault === 'undefined') {
|
|
513
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
517
|
+
const payload: Payload = {};
|
|
518
|
+
|
|
519
|
+
if (typeof required !== 'undefined') {
|
|
520
|
+
payload['required'] = required;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (typeof xdefault !== 'undefined') {
|
|
524
|
+
payload['default'] = xdefault;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
528
|
+
return await this.client.call('patch', uri, {
|
|
529
|
+
'content-type': 'application/json',
|
|
530
|
+
}, payload);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Create datetime attribute
|
|
535
|
+
*
|
|
536
|
+
*
|
|
537
|
+
* @param {string} databaseId
|
|
538
|
+
* @param {string} collectionId
|
|
539
|
+
* @param {string} key
|
|
540
|
+
* @param {boolean} required
|
|
541
|
+
* @param {string} xdefault
|
|
542
|
+
* @param {boolean} array
|
|
543
|
+
* @throws {AppwriteException}
|
|
544
|
+
* @returns {Promise}
|
|
545
|
+
*/
|
|
546
|
+
async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime> {
|
|
547
|
+
if (typeof databaseId === 'undefined') {
|
|
548
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (typeof collectionId === 'undefined') {
|
|
552
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
if (typeof key === 'undefined') {
|
|
556
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (typeof required === 'undefined') {
|
|
560
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
564
|
+
const payload: Payload = {};
|
|
565
|
+
|
|
566
|
+
if (typeof key !== 'undefined') {
|
|
567
|
+
payload['key'] = key;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (typeof required !== 'undefined') {
|
|
571
|
+
payload['required'] = required;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (typeof xdefault !== 'undefined') {
|
|
575
|
+
payload['default'] = xdefault;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (typeof array !== 'undefined') {
|
|
579
|
+
payload['array'] = array;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
583
|
+
return await this.client.call('post', uri, {
|
|
584
|
+
'content-type': 'application/json',
|
|
585
|
+
}, payload);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Update dateTime attribute
|
|
590
|
+
*
|
|
591
|
+
*
|
|
592
|
+
* @param {string} databaseId
|
|
593
|
+
* @param {string} collectionId
|
|
594
|
+
* @param {string} key
|
|
595
|
+
* @param {boolean} required
|
|
596
|
+
* @param {string} xdefault
|
|
597
|
+
* @throws {AppwriteException}
|
|
598
|
+
* @returns {Promise}
|
|
599
|
+
*/
|
|
600
|
+
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime> {
|
|
601
|
+
if (typeof databaseId === 'undefined') {
|
|
602
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (typeof collectionId === 'undefined') {
|
|
606
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
if (typeof key === 'undefined') {
|
|
610
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (typeof required === 'undefined') {
|
|
614
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (typeof xdefault === 'undefined') {
|
|
618
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
622
|
+
const payload: Payload = {};
|
|
623
|
+
|
|
624
|
+
if (typeof required !== 'undefined') {
|
|
625
|
+
payload['required'] = required;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (typeof xdefault !== 'undefined') {
|
|
629
|
+
payload['default'] = xdefault;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
633
|
+
return await this.client.call('patch', uri, {
|
|
634
|
+
'content-type': 'application/json',
|
|
635
|
+
}, payload);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Create email attribute
|
|
640
|
+
*
|
|
641
|
+
* Create an email attribute.
|
|
642
|
+
*
|
|
643
|
+
*
|
|
644
|
+
* @param {string} databaseId
|
|
645
|
+
* @param {string} collectionId
|
|
646
|
+
* @param {string} key
|
|
647
|
+
* @param {boolean} required
|
|
648
|
+
* @param {string} xdefault
|
|
649
|
+
* @param {boolean} array
|
|
650
|
+
* @throws {AppwriteException}
|
|
651
|
+
* @returns {Promise}
|
|
652
|
+
*/
|
|
653
|
+
async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail> {
|
|
654
|
+
if (typeof databaseId === 'undefined') {
|
|
655
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
if (typeof collectionId === 'undefined') {
|
|
659
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (typeof key === 'undefined') {
|
|
663
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
if (typeof required === 'undefined') {
|
|
667
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
671
|
+
const payload: Payload = {};
|
|
672
|
+
|
|
673
|
+
if (typeof key !== 'undefined') {
|
|
674
|
+
payload['key'] = key;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (typeof required !== 'undefined') {
|
|
678
|
+
payload['required'] = required;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (typeof xdefault !== 'undefined') {
|
|
682
|
+
payload['default'] = xdefault;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
if (typeof array !== 'undefined') {
|
|
686
|
+
payload['array'] = array;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
690
|
+
return await this.client.call('post', uri, {
|
|
691
|
+
'content-type': 'application/json',
|
|
692
|
+
}, payload);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Update email attribute
|
|
697
|
+
*
|
|
698
|
+
* Update an email attribute. Changing the `default` value will not update
|
|
699
|
+
* already existing documents.
|
|
700
|
+
*
|
|
701
|
+
*
|
|
702
|
+
* @param {string} databaseId
|
|
703
|
+
* @param {string} collectionId
|
|
704
|
+
* @param {string} key
|
|
705
|
+
* @param {boolean} required
|
|
706
|
+
* @param {string} xdefault
|
|
707
|
+
* @throws {AppwriteException}
|
|
708
|
+
* @returns {Promise}
|
|
709
|
+
*/
|
|
710
|
+
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail> {
|
|
711
|
+
if (typeof databaseId === 'undefined') {
|
|
712
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
if (typeof collectionId === 'undefined') {
|
|
716
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if (typeof key === 'undefined') {
|
|
720
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
if (typeof required === 'undefined') {
|
|
724
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
if (typeof xdefault === 'undefined') {
|
|
728
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
732
|
+
const payload: Payload = {};
|
|
733
|
+
|
|
734
|
+
if (typeof required !== 'undefined') {
|
|
735
|
+
payload['required'] = required;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
if (typeof xdefault !== 'undefined') {
|
|
739
|
+
payload['default'] = xdefault;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
743
|
+
return await this.client.call('patch', uri, {
|
|
744
|
+
'content-type': 'application/json',
|
|
745
|
+
}, payload);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Create enum attribute
|
|
750
|
+
*
|
|
751
|
+
*
|
|
752
|
+
* @param {string} databaseId
|
|
753
|
+
* @param {string} collectionId
|
|
754
|
+
* @param {string} key
|
|
755
|
+
* @param {string[]} elements
|
|
756
|
+
* @param {boolean} required
|
|
757
|
+
* @param {string} xdefault
|
|
758
|
+
* @param {boolean} array
|
|
759
|
+
* @throws {AppwriteException}
|
|
760
|
+
* @returns {Promise}
|
|
761
|
+
*/
|
|
762
|
+
async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum> {
|
|
763
|
+
if (typeof databaseId === 'undefined') {
|
|
764
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (typeof collectionId === 'undefined') {
|
|
768
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
if (typeof key === 'undefined') {
|
|
772
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (typeof elements === 'undefined') {
|
|
776
|
+
throw new AppwriteException('Missing required parameter: "elements"');
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
if (typeof required === 'undefined') {
|
|
780
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
784
|
+
const payload: Payload = {};
|
|
785
|
+
|
|
786
|
+
if (typeof key !== 'undefined') {
|
|
787
|
+
payload['key'] = key;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
if (typeof elements !== 'undefined') {
|
|
791
|
+
payload['elements'] = elements;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
if (typeof required !== 'undefined') {
|
|
795
|
+
payload['required'] = required;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
if (typeof xdefault !== 'undefined') {
|
|
799
|
+
payload['default'] = xdefault;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if (typeof array !== 'undefined') {
|
|
803
|
+
payload['array'] = array;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
807
|
+
return await this.client.call('post', uri, {
|
|
808
|
+
'content-type': 'application/json',
|
|
809
|
+
}, payload);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Update enum attribute
|
|
814
|
+
*
|
|
815
|
+
* Update an enum attribute. Changing the `default` value will not update
|
|
816
|
+
* already existing documents.
|
|
817
|
+
*
|
|
818
|
+
*
|
|
819
|
+
* @param {string} databaseId
|
|
820
|
+
* @param {string} collectionId
|
|
821
|
+
* @param {string} key
|
|
822
|
+
* @param {string[]} elements
|
|
823
|
+
* @param {boolean} required
|
|
824
|
+
* @param {string} xdefault
|
|
825
|
+
* @throws {AppwriteException}
|
|
826
|
+
* @returns {Promise}
|
|
827
|
+
*/
|
|
828
|
+
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum> {
|
|
829
|
+
if (typeof databaseId === 'undefined') {
|
|
830
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
if (typeof collectionId === 'undefined') {
|
|
834
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
if (typeof key === 'undefined') {
|
|
838
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
if (typeof elements === 'undefined') {
|
|
842
|
+
throw new AppwriteException('Missing required parameter: "elements"');
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
if (typeof required === 'undefined') {
|
|
846
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
if (typeof xdefault === 'undefined') {
|
|
850
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
854
|
+
const payload: Payload = {};
|
|
855
|
+
|
|
856
|
+
if (typeof elements !== 'undefined') {
|
|
857
|
+
payload['elements'] = elements;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
if (typeof required !== 'undefined') {
|
|
861
|
+
payload['required'] = required;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (typeof xdefault !== 'undefined') {
|
|
865
|
+
payload['default'] = xdefault;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
869
|
+
return await this.client.call('patch', uri, {
|
|
870
|
+
'content-type': 'application/json',
|
|
871
|
+
}, payload);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Create float attribute
|
|
876
|
+
*
|
|
877
|
+
* Create a float attribute. Optionally, minimum and maximum values can be
|
|
878
|
+
* provided.
|
|
879
|
+
*
|
|
880
|
+
*
|
|
881
|
+
* @param {string} databaseId
|
|
882
|
+
* @param {string} collectionId
|
|
883
|
+
* @param {string} key
|
|
884
|
+
* @param {boolean} required
|
|
885
|
+
* @param {number} min
|
|
886
|
+
* @param {number} max
|
|
887
|
+
* @param {number} xdefault
|
|
888
|
+
* @param {boolean} array
|
|
889
|
+
* @throws {AppwriteException}
|
|
890
|
+
* @returns {Promise}
|
|
891
|
+
*/
|
|
892
|
+
async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat> {
|
|
893
|
+
if (typeof databaseId === 'undefined') {
|
|
894
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
if (typeof collectionId === 'undefined') {
|
|
898
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
if (typeof key === 'undefined') {
|
|
902
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
if (typeof required === 'undefined') {
|
|
906
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
910
|
+
const payload: Payload = {};
|
|
911
|
+
|
|
912
|
+
if (typeof key !== 'undefined') {
|
|
913
|
+
payload['key'] = key;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
if (typeof required !== 'undefined') {
|
|
917
|
+
payload['required'] = required;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (typeof min !== 'undefined') {
|
|
921
|
+
payload['min'] = min;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
if (typeof max !== 'undefined') {
|
|
925
|
+
payload['max'] = max;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
if (typeof xdefault !== 'undefined') {
|
|
929
|
+
payload['default'] = xdefault;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
if (typeof array !== 'undefined') {
|
|
933
|
+
payload['array'] = array;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
937
|
+
return await this.client.call('post', uri, {
|
|
938
|
+
'content-type': 'application/json',
|
|
939
|
+
}, payload);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Update float attribute
|
|
944
|
+
*
|
|
945
|
+
* Update a float attribute. Changing the `default` value will not update
|
|
946
|
+
* already existing documents.
|
|
947
|
+
*
|
|
948
|
+
*
|
|
949
|
+
* @param {string} databaseId
|
|
950
|
+
* @param {string} collectionId
|
|
951
|
+
* @param {string} key
|
|
952
|
+
* @param {boolean} required
|
|
953
|
+
* @param {number} min
|
|
954
|
+
* @param {number} max
|
|
955
|
+
* @param {number} xdefault
|
|
956
|
+
* @throws {AppwriteException}
|
|
957
|
+
* @returns {Promise}
|
|
958
|
+
*/
|
|
959
|
+
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat> {
|
|
960
|
+
if (typeof databaseId === 'undefined') {
|
|
961
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
if (typeof collectionId === 'undefined') {
|
|
965
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
if (typeof key === 'undefined') {
|
|
969
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
if (typeof required === 'undefined') {
|
|
973
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
if (typeof min === 'undefined') {
|
|
977
|
+
throw new AppwriteException('Missing required parameter: "min"');
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
if (typeof max === 'undefined') {
|
|
981
|
+
throw new AppwriteException('Missing required parameter: "max"');
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
if (typeof xdefault === 'undefined') {
|
|
985
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
989
|
+
const payload: Payload = {};
|
|
990
|
+
|
|
991
|
+
if (typeof required !== 'undefined') {
|
|
992
|
+
payload['required'] = required;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
if (typeof min !== 'undefined') {
|
|
996
|
+
payload['min'] = min;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
if (typeof max !== 'undefined') {
|
|
1000
|
+
payload['max'] = max;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
if (typeof xdefault !== 'undefined') {
|
|
1004
|
+
payload['default'] = xdefault;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1008
|
+
return await this.client.call('patch', uri, {
|
|
1009
|
+
'content-type': 'application/json',
|
|
1010
|
+
}, payload);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Create integer attribute
|
|
1015
|
+
*
|
|
1016
|
+
* Create an integer attribute. Optionally, minimum and maximum values can be
|
|
1017
|
+
* provided.
|
|
1018
|
+
*
|
|
1019
|
+
*
|
|
1020
|
+
* @param {string} databaseId
|
|
1021
|
+
* @param {string} collectionId
|
|
1022
|
+
* @param {string} key
|
|
1023
|
+
* @param {boolean} required
|
|
1024
|
+
* @param {number} min
|
|
1025
|
+
* @param {number} max
|
|
1026
|
+
* @param {number} xdefault
|
|
1027
|
+
* @param {boolean} array
|
|
1028
|
+
* @throws {AppwriteException}
|
|
1029
|
+
* @returns {Promise}
|
|
1030
|
+
*/
|
|
1031
|
+
async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger> {
|
|
1032
|
+
if (typeof databaseId === 'undefined') {
|
|
1033
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
if (typeof collectionId === 'undefined') {
|
|
1037
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
if (typeof key === 'undefined') {
|
|
1041
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
if (typeof required === 'undefined') {
|
|
1045
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1049
|
+
const payload: Payload = {};
|
|
1050
|
+
|
|
1051
|
+
if (typeof key !== 'undefined') {
|
|
1052
|
+
payload['key'] = key;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
if (typeof required !== 'undefined') {
|
|
1056
|
+
payload['required'] = required;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
if (typeof min !== 'undefined') {
|
|
1060
|
+
payload['min'] = min;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
if (typeof max !== 'undefined') {
|
|
1064
|
+
payload['max'] = max;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
if (typeof xdefault !== 'undefined') {
|
|
1068
|
+
payload['default'] = xdefault;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
if (typeof array !== 'undefined') {
|
|
1072
|
+
payload['array'] = array;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1076
|
+
return await this.client.call('post', uri, {
|
|
1077
|
+
'content-type': 'application/json',
|
|
1078
|
+
}, payload);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Update integer attribute
|
|
1083
|
+
*
|
|
1084
|
+
* Update an integer attribute. Changing the `default` value will not update
|
|
1085
|
+
* already existing documents.
|
|
1086
|
+
*
|
|
1087
|
+
*
|
|
1088
|
+
* @param {string} databaseId
|
|
1089
|
+
* @param {string} collectionId
|
|
1090
|
+
* @param {string} key
|
|
1091
|
+
* @param {boolean} required
|
|
1092
|
+
* @param {number} min
|
|
1093
|
+
* @param {number} max
|
|
1094
|
+
* @param {number} xdefault
|
|
1095
|
+
* @throws {AppwriteException}
|
|
1096
|
+
* @returns {Promise}
|
|
1097
|
+
*/
|
|
1098
|
+
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger> {
|
|
1099
|
+
if (typeof databaseId === 'undefined') {
|
|
1100
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
if (typeof collectionId === 'undefined') {
|
|
1104
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
if (typeof key === 'undefined') {
|
|
1108
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
if (typeof required === 'undefined') {
|
|
1112
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
if (typeof min === 'undefined') {
|
|
1116
|
+
throw new AppwriteException('Missing required parameter: "min"');
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
if (typeof max === 'undefined') {
|
|
1120
|
+
throw new AppwriteException('Missing required parameter: "max"');
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
if (typeof xdefault === 'undefined') {
|
|
1124
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1128
|
+
const payload: Payload = {};
|
|
1129
|
+
|
|
1130
|
+
if (typeof required !== 'undefined') {
|
|
1131
|
+
payload['required'] = required;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
if (typeof min !== 'undefined') {
|
|
1135
|
+
payload['min'] = min;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
if (typeof max !== 'undefined') {
|
|
1139
|
+
payload['max'] = max;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
if (typeof xdefault !== 'undefined') {
|
|
1143
|
+
payload['default'] = xdefault;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1147
|
+
return await this.client.call('patch', uri, {
|
|
1148
|
+
'content-type': 'application/json',
|
|
1149
|
+
}, payload);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Create IP address attribute
|
|
1154
|
+
*
|
|
1155
|
+
* Create IP address attribute.
|
|
1156
|
+
*
|
|
1157
|
+
*
|
|
1158
|
+
* @param {string} databaseId
|
|
1159
|
+
* @param {string} collectionId
|
|
1160
|
+
* @param {string} key
|
|
1161
|
+
* @param {boolean} required
|
|
1162
|
+
* @param {string} xdefault
|
|
1163
|
+
* @param {boolean} array
|
|
1164
|
+
* @throws {AppwriteException}
|
|
1165
|
+
* @returns {Promise}
|
|
1166
|
+
*/
|
|
1167
|
+
async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp> {
|
|
1168
|
+
if (typeof databaseId === 'undefined') {
|
|
1169
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
if (typeof collectionId === 'undefined') {
|
|
1173
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
if (typeof key === 'undefined') {
|
|
1177
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
if (typeof required === 'undefined') {
|
|
1181
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1185
|
+
const payload: Payload = {};
|
|
1186
|
+
|
|
1187
|
+
if (typeof key !== 'undefined') {
|
|
1188
|
+
payload['key'] = key;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
if (typeof required !== 'undefined') {
|
|
1192
|
+
payload['required'] = required;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
if (typeof xdefault !== 'undefined') {
|
|
1196
|
+
payload['default'] = xdefault;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
if (typeof array !== 'undefined') {
|
|
1200
|
+
payload['array'] = array;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1204
|
+
return await this.client.call('post', uri, {
|
|
1205
|
+
'content-type': 'application/json',
|
|
1206
|
+
}, payload);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Update IP address attribute
|
|
1211
|
+
*
|
|
1212
|
+
* Update an ip attribute. Changing the `default` value will not update
|
|
1213
|
+
* already existing documents.
|
|
1214
|
+
*
|
|
1215
|
+
*
|
|
1216
|
+
* @param {string} databaseId
|
|
1217
|
+
* @param {string} collectionId
|
|
1218
|
+
* @param {string} key
|
|
1219
|
+
* @param {boolean} required
|
|
1220
|
+
* @param {string} xdefault
|
|
1221
|
+
* @throws {AppwriteException}
|
|
1222
|
+
* @returns {Promise}
|
|
1223
|
+
*/
|
|
1224
|
+
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp> {
|
|
1225
|
+
if (typeof databaseId === 'undefined') {
|
|
1226
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
if (typeof collectionId === 'undefined') {
|
|
1230
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
if (typeof key === 'undefined') {
|
|
1234
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
if (typeof required === 'undefined') {
|
|
1238
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
if (typeof xdefault === 'undefined') {
|
|
1242
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1246
|
+
const payload: Payload = {};
|
|
1247
|
+
|
|
1248
|
+
if (typeof required !== 'undefined') {
|
|
1249
|
+
payload['required'] = required;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
if (typeof xdefault !== 'undefined') {
|
|
1253
|
+
payload['default'] = xdefault;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1257
|
+
return await this.client.call('patch', uri, {
|
|
1258
|
+
'content-type': 'application/json',
|
|
1259
|
+
}, payload);
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* Create relationship attribute
|
|
1264
|
+
*
|
|
1265
|
+
* Create relationship attribute. [Learn more about relationship
|
|
1266
|
+
* attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
|
|
1267
|
+
*
|
|
1268
|
+
*
|
|
1269
|
+
* @param {string} databaseId
|
|
1270
|
+
* @param {string} collectionId
|
|
1271
|
+
* @param {string} relatedCollectionId
|
|
1272
|
+
* @param {string} type
|
|
1273
|
+
* @param {boolean} twoWay
|
|
1274
|
+
* @param {string} key
|
|
1275
|
+
* @param {string} twoWayKey
|
|
1276
|
+
* @param {string} onDelete
|
|
1277
|
+
* @throws {AppwriteException}
|
|
1278
|
+
* @returns {Promise}
|
|
1279
|
+
*/
|
|
1280
|
+
async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: string, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: string): Promise<Models.AttributeRelationship> {
|
|
1281
|
+
if (typeof databaseId === 'undefined') {
|
|
1282
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
if (typeof collectionId === 'undefined') {
|
|
1286
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
if (typeof relatedCollectionId === 'undefined') {
|
|
1290
|
+
throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
if (typeof type === 'undefined') {
|
|
1294
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1298
|
+
const payload: Payload = {};
|
|
1299
|
+
|
|
1300
|
+
if (typeof relatedCollectionId !== 'undefined') {
|
|
1301
|
+
payload['relatedCollectionId'] = relatedCollectionId;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
if (typeof type !== 'undefined') {
|
|
1305
|
+
payload['type'] = type;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
if (typeof twoWay !== 'undefined') {
|
|
1309
|
+
payload['twoWay'] = twoWay;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
if (typeof key !== 'undefined') {
|
|
1313
|
+
payload['key'] = key;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
if (typeof twoWayKey !== 'undefined') {
|
|
1317
|
+
payload['twoWayKey'] = twoWayKey;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
if (typeof onDelete !== 'undefined') {
|
|
1321
|
+
payload['onDelete'] = onDelete;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1325
|
+
return await this.client.call('post', uri, {
|
|
1326
|
+
'content-type': 'application/json',
|
|
1327
|
+
}, payload);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Create string attribute
|
|
1332
|
+
*
|
|
1333
|
+
* Create a string attribute.
|
|
1334
|
+
*
|
|
1335
|
+
*
|
|
1336
|
+
* @param {string} databaseId
|
|
1337
|
+
* @param {string} collectionId
|
|
1338
|
+
* @param {string} key
|
|
1339
|
+
* @param {number} size
|
|
1340
|
+
* @param {boolean} required
|
|
1341
|
+
* @param {string} xdefault
|
|
1342
|
+
* @param {boolean} array
|
|
1343
|
+
* @param {boolean} encrypt
|
|
1344
|
+
* @throws {AppwriteException}
|
|
1345
|
+
* @returns {Promise}
|
|
1346
|
+
*/
|
|
1347
|
+
async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString> {
|
|
1348
|
+
if (typeof databaseId === 'undefined') {
|
|
1349
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
if (typeof collectionId === 'undefined') {
|
|
1353
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
if (typeof key === 'undefined') {
|
|
1357
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
if (typeof size === 'undefined') {
|
|
1361
|
+
throw new AppwriteException('Missing required parameter: "size"');
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
if (typeof required === 'undefined') {
|
|
1365
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1369
|
+
const payload: Payload = {};
|
|
1370
|
+
|
|
1371
|
+
if (typeof key !== 'undefined') {
|
|
1372
|
+
payload['key'] = key;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
if (typeof size !== 'undefined') {
|
|
1376
|
+
payload['size'] = size;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
if (typeof required !== 'undefined') {
|
|
1380
|
+
payload['required'] = required;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
if (typeof xdefault !== 'undefined') {
|
|
1384
|
+
payload['default'] = xdefault;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
if (typeof array !== 'undefined') {
|
|
1388
|
+
payload['array'] = array;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
if (typeof encrypt !== 'undefined') {
|
|
1392
|
+
payload['encrypt'] = encrypt;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1396
|
+
return await this.client.call('post', uri, {
|
|
1397
|
+
'content-type': 'application/json',
|
|
1398
|
+
}, payload);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* Update string attribute
|
|
1403
|
+
*
|
|
1404
|
+
* Update a string attribute. Changing the `default` value will not update
|
|
1405
|
+
* already existing documents.
|
|
1406
|
+
*
|
|
1407
|
+
*
|
|
1408
|
+
* @param {string} databaseId
|
|
1409
|
+
* @param {string} collectionId
|
|
1410
|
+
* @param {string} key
|
|
1411
|
+
* @param {boolean} required
|
|
1412
|
+
* @param {string} xdefault
|
|
1413
|
+
* @throws {AppwriteException}
|
|
1414
|
+
* @returns {Promise}
|
|
1415
|
+
*/
|
|
1416
|
+
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString> {
|
|
1417
|
+
if (typeof databaseId === 'undefined') {
|
|
1418
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
if (typeof collectionId === 'undefined') {
|
|
1422
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
if (typeof key === 'undefined') {
|
|
1426
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
if (typeof required === 'undefined') {
|
|
1430
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
if (typeof xdefault === 'undefined') {
|
|
1434
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1438
|
+
const payload: Payload = {};
|
|
1439
|
+
|
|
1440
|
+
if (typeof required !== 'undefined') {
|
|
1441
|
+
payload['required'] = required;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
if (typeof xdefault !== 'undefined') {
|
|
1445
|
+
payload['default'] = xdefault;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1449
|
+
return await this.client.call('patch', uri, {
|
|
1450
|
+
'content-type': 'application/json',
|
|
1451
|
+
}, payload);
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Create URL attribute
|
|
1456
|
+
*
|
|
1457
|
+
* Create a URL attribute.
|
|
1458
|
+
*
|
|
1459
|
+
*
|
|
1460
|
+
* @param {string} databaseId
|
|
1461
|
+
* @param {string} collectionId
|
|
1462
|
+
* @param {string} key
|
|
1463
|
+
* @param {boolean} required
|
|
1464
|
+
* @param {string} xdefault
|
|
1465
|
+
* @param {boolean} array
|
|
1466
|
+
* @throws {AppwriteException}
|
|
1467
|
+
* @returns {Promise}
|
|
1468
|
+
*/
|
|
1469
|
+
async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl> {
|
|
1470
|
+
if (typeof databaseId === 'undefined') {
|
|
1471
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
if (typeof collectionId === 'undefined') {
|
|
1475
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
if (typeof key === 'undefined') {
|
|
1479
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
if (typeof required === 'undefined') {
|
|
1483
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1487
|
+
const payload: Payload = {};
|
|
1488
|
+
|
|
1489
|
+
if (typeof key !== 'undefined') {
|
|
1490
|
+
payload['key'] = key;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
if (typeof required !== 'undefined') {
|
|
1494
|
+
payload['required'] = required;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
if (typeof xdefault !== 'undefined') {
|
|
1498
|
+
payload['default'] = xdefault;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
if (typeof array !== 'undefined') {
|
|
1502
|
+
payload['array'] = array;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1506
|
+
return await this.client.call('post', uri, {
|
|
1507
|
+
'content-type': 'application/json',
|
|
1508
|
+
}, payload);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Update URL attribute
|
|
1513
|
+
*
|
|
1514
|
+
* Update an url attribute. Changing the `default` value will not update
|
|
1515
|
+
* already existing documents.
|
|
1516
|
+
*
|
|
1517
|
+
*
|
|
1518
|
+
* @param {string} databaseId
|
|
1519
|
+
* @param {string} collectionId
|
|
1520
|
+
* @param {string} key
|
|
1521
|
+
* @param {boolean} required
|
|
1522
|
+
* @param {string} xdefault
|
|
1523
|
+
* @throws {AppwriteException}
|
|
1524
|
+
* @returns {Promise}
|
|
1525
|
+
*/
|
|
1526
|
+
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl> {
|
|
1527
|
+
if (typeof databaseId === 'undefined') {
|
|
1528
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
if (typeof collectionId === 'undefined') {
|
|
1532
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
if (typeof key === 'undefined') {
|
|
1536
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
if (typeof required === 'undefined') {
|
|
1540
|
+
throw new AppwriteException('Missing required parameter: "required"');
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
if (typeof xdefault === 'undefined') {
|
|
1544
|
+
throw new AppwriteException('Missing required parameter: "xdefault"');
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1548
|
+
const payload: Payload = {};
|
|
1549
|
+
|
|
1550
|
+
if (typeof required !== 'undefined') {
|
|
1551
|
+
payload['required'] = required;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
if (typeof xdefault !== 'undefined') {
|
|
1555
|
+
payload['default'] = xdefault;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1559
|
+
return await this.client.call('patch', uri, {
|
|
1560
|
+
'content-type': 'application/json',
|
|
1561
|
+
}, payload);
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Get attribute
|
|
1566
|
+
*
|
|
1567
|
+
*
|
|
1568
|
+
* @param {string} databaseId
|
|
1569
|
+
* @param {string} collectionId
|
|
1570
|
+
* @param {string} key
|
|
1571
|
+
* @throws {AppwriteException}
|
|
1572
|
+
* @returns {Promise}
|
|
1573
|
+
*/
|
|
1574
|
+
async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
|
1575
|
+
if (typeof databaseId === 'undefined') {
|
|
1576
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
if (typeof collectionId === 'undefined') {
|
|
1580
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
if (typeof key === 'undefined') {
|
|
1584
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1588
|
+
const payload: Payload = {};
|
|
1589
|
+
|
|
1590
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1591
|
+
return await this.client.call('get', uri, {
|
|
1592
|
+
'content-type': 'application/json',
|
|
1593
|
+
}, payload);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* Delete attribute
|
|
1598
|
+
*
|
|
1599
|
+
*
|
|
1600
|
+
* @param {string} databaseId
|
|
1601
|
+
* @param {string} collectionId
|
|
1602
|
+
* @param {string} key
|
|
1603
|
+
* @throws {AppwriteException}
|
|
1604
|
+
* @returns {Promise}
|
|
1605
|
+
*/
|
|
1606
|
+
async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
|
1607
|
+
if (typeof databaseId === 'undefined') {
|
|
1608
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
if (typeof collectionId === 'undefined') {
|
|
1612
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
if (typeof key === 'undefined') {
|
|
1616
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1620
|
+
const payload: Payload = {};
|
|
1621
|
+
|
|
1622
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1623
|
+
return await this.client.call('delete', uri, {
|
|
1624
|
+
'content-type': 'application/json',
|
|
1625
|
+
}, payload);
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* Update relationship attribute
|
|
1630
|
+
*
|
|
1631
|
+
* Update relationship attribute. [Learn more about relationship
|
|
1632
|
+
* attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
|
|
1633
|
+
*
|
|
1634
|
+
*
|
|
1635
|
+
* @param {string} databaseId
|
|
1636
|
+
* @param {string} collectionId
|
|
1637
|
+
* @param {string} key
|
|
1638
|
+
* @param {string} onDelete
|
|
1639
|
+
* @throws {AppwriteException}
|
|
1640
|
+
* @returns {Promise}
|
|
1641
|
+
*/
|
|
1642
|
+
async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: string): Promise<Models.AttributeRelationship> {
|
|
1643
|
+
if (typeof databaseId === 'undefined') {
|
|
1644
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
if (typeof collectionId === 'undefined') {
|
|
1648
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
if (typeof key === 'undefined') {
|
|
1652
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1656
|
+
const payload: Payload = {};
|
|
1657
|
+
|
|
1658
|
+
if (typeof onDelete !== 'undefined') {
|
|
1659
|
+
payload['onDelete'] = onDelete;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1663
|
+
return await this.client.call('patch', uri, {
|
|
1664
|
+
'content-type': 'application/json',
|
|
1665
|
+
}, payload);
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* List documents
|
|
1670
|
+
*
|
|
1671
|
+
* Get a list of all the user's documents in a given collection. You can use
|
|
1672
|
+
* the query params to filter your results.
|
|
1673
|
+
*
|
|
1674
|
+
* @param {string} databaseId
|
|
1675
|
+
* @param {string} collectionId
|
|
1676
|
+
* @param {string[]} queries
|
|
1677
|
+
* @throws {AppwriteException}
|
|
1678
|
+
* @returns {Promise}
|
|
1679
|
+
*/
|
|
1680
|
+
async listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
|
|
1681
|
+
if (typeof databaseId === 'undefined') {
|
|
1682
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
if (typeof collectionId === 'undefined') {
|
|
1686
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1690
|
+
const payload: Payload = {};
|
|
1691
|
+
|
|
1692
|
+
if (typeof queries !== 'undefined') {
|
|
1693
|
+
payload['queries'] = queries;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1697
|
+
return await this.client.call('get', uri, {
|
|
1698
|
+
'content-type': 'application/json',
|
|
1699
|
+
}, payload);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* Create document
|
|
1704
|
+
*
|
|
1705
|
+
* Create a new Document. Before using this route, you should create a new
|
|
1706
|
+
* collection resource using either a [server
|
|
1707
|
+
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
|
|
1708
|
+
* API or directly from your database console.
|
|
1709
|
+
*
|
|
1710
|
+
* @param {string} databaseId
|
|
1711
|
+
* @param {string} collectionId
|
|
1712
|
+
* @param {string} documentId
|
|
1713
|
+
* @param {Omit<Document, keyof Models.Document>} data
|
|
1714
|
+
* @param {string[]} permissions
|
|
1715
|
+
* @throws {AppwriteException}
|
|
1716
|
+
* @returns {Promise}
|
|
1717
|
+
*/
|
|
1718
|
+
async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
|
|
1719
|
+
if (typeof databaseId === 'undefined') {
|
|
1720
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
if (typeof collectionId === 'undefined') {
|
|
1724
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
if (typeof documentId === 'undefined') {
|
|
1728
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
if (typeof data === 'undefined') {
|
|
1732
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1736
|
+
const payload: Payload = {};
|
|
1737
|
+
|
|
1738
|
+
if (typeof documentId !== 'undefined') {
|
|
1739
|
+
payload['documentId'] = documentId;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
if (typeof data !== 'undefined') {
|
|
1743
|
+
payload['data'] = data;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
if (typeof permissions !== 'undefined') {
|
|
1747
|
+
payload['permissions'] = permissions;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1751
|
+
return await this.client.call('post', uri, {
|
|
1752
|
+
'content-type': 'application/json',
|
|
1753
|
+
}, payload);
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* Get document
|
|
1758
|
+
*
|
|
1759
|
+
* Get a document by its unique ID. This endpoint response returns a JSON
|
|
1760
|
+
* object with the document data.
|
|
1761
|
+
*
|
|
1762
|
+
* @param {string} databaseId
|
|
1763
|
+
* @param {string} collectionId
|
|
1764
|
+
* @param {string} documentId
|
|
1765
|
+
* @param {string[]} queries
|
|
1766
|
+
* @throws {AppwriteException}
|
|
1767
|
+
* @returns {Promise}
|
|
1768
|
+
*/
|
|
1769
|
+
async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
|
|
1770
|
+
if (typeof databaseId === 'undefined') {
|
|
1771
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
if (typeof collectionId === 'undefined') {
|
|
1775
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
if (typeof documentId === 'undefined') {
|
|
1779
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1783
|
+
const payload: Payload = {};
|
|
1784
|
+
|
|
1785
|
+
if (typeof queries !== 'undefined') {
|
|
1786
|
+
payload['queries'] = queries;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1790
|
+
return await this.client.call('get', uri, {
|
|
1791
|
+
'content-type': 'application/json',
|
|
1792
|
+
}, payload);
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* Update document
|
|
1797
|
+
*
|
|
1798
|
+
* Update a document by its unique ID. Using the patch method you can pass
|
|
1799
|
+
* only specific fields that will get updated.
|
|
1800
|
+
*
|
|
1801
|
+
* @param {string} databaseId
|
|
1802
|
+
* @param {string} collectionId
|
|
1803
|
+
* @param {string} documentId
|
|
1804
|
+
* @param {Partial<Omit<Document, keyof Models.Document>>} data
|
|
1805
|
+
* @param {string[]} permissions
|
|
1806
|
+
* @throws {AppwriteException}
|
|
1807
|
+
* @returns {Promise}
|
|
1808
|
+
*/
|
|
1809
|
+
async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
|
|
1810
|
+
if (typeof databaseId === 'undefined') {
|
|
1811
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
if (typeof collectionId === 'undefined') {
|
|
1815
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
if (typeof documentId === 'undefined') {
|
|
1819
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1823
|
+
const payload: Payload = {};
|
|
1824
|
+
|
|
1825
|
+
if (typeof data !== 'undefined') {
|
|
1826
|
+
payload['data'] = data;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
if (typeof permissions !== 'undefined') {
|
|
1830
|
+
payload['permissions'] = permissions;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1834
|
+
return await this.client.call('patch', uri, {
|
|
1835
|
+
'content-type': 'application/json',
|
|
1836
|
+
}, payload);
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Delete document
|
|
1841
|
+
*
|
|
1842
|
+
* Delete a document by its unique ID.
|
|
1843
|
+
*
|
|
1844
|
+
* @param {string} databaseId
|
|
1845
|
+
* @param {string} collectionId
|
|
1846
|
+
* @param {string} documentId
|
|
1847
|
+
* @throws {AppwriteException}
|
|
1848
|
+
* @returns {Promise}
|
|
1849
|
+
*/
|
|
1850
|
+
async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
|
|
1851
|
+
if (typeof databaseId === 'undefined') {
|
|
1852
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
if (typeof collectionId === 'undefined') {
|
|
1856
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
if (typeof documentId === 'undefined') {
|
|
1860
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1864
|
+
const payload: Payload = {};
|
|
1865
|
+
|
|
1866
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1867
|
+
return await this.client.call('delete', uri, {
|
|
1868
|
+
'content-type': 'application/json',
|
|
1869
|
+
}, payload);
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* List document logs
|
|
1874
|
+
*
|
|
1875
|
+
* Get the document activity logs list by its unique ID.
|
|
1876
|
+
*
|
|
1877
|
+
* @param {string} databaseId
|
|
1878
|
+
* @param {string} collectionId
|
|
1879
|
+
* @param {string} documentId
|
|
1880
|
+
* @param {string[]} queries
|
|
1881
|
+
* @throws {AppwriteException}
|
|
1882
|
+
* @returns {Promise}
|
|
1883
|
+
*/
|
|
1884
|
+
async listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Models.LogList> {
|
|
1885
|
+
if (typeof databaseId === 'undefined') {
|
|
1886
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
if (typeof collectionId === 'undefined') {
|
|
1890
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
if (typeof documentId === 'undefined') {
|
|
1894
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1898
|
+
const payload: Payload = {};
|
|
1899
|
+
|
|
1900
|
+
if (typeof queries !== 'undefined') {
|
|
1901
|
+
payload['queries'] = queries;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1905
|
+
return await this.client.call('get', uri, {
|
|
1906
|
+
'content-type': 'application/json',
|
|
1907
|
+
}, payload);
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
/**
|
|
1911
|
+
* List indexes
|
|
1912
|
+
*
|
|
1913
|
+
*
|
|
1914
|
+
* @param {string} databaseId
|
|
1915
|
+
* @param {string} collectionId
|
|
1916
|
+
* @param {string[]} queries
|
|
1917
|
+
* @throws {AppwriteException}
|
|
1918
|
+
* @returns {Promise}
|
|
1919
|
+
*/
|
|
1920
|
+
async listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.IndexList> {
|
|
1921
|
+
if (typeof databaseId === 'undefined') {
|
|
1922
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
if (typeof collectionId === 'undefined') {
|
|
1926
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1930
|
+
const payload: Payload = {};
|
|
1931
|
+
|
|
1932
|
+
if (typeof queries !== 'undefined') {
|
|
1933
|
+
payload['queries'] = queries;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1937
|
+
return await this.client.call('get', uri, {
|
|
1938
|
+
'content-type': 'application/json',
|
|
1939
|
+
}, payload);
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Create index
|
|
1944
|
+
*
|
|
1945
|
+
*
|
|
1946
|
+
* @param {string} databaseId
|
|
1947
|
+
* @param {string} collectionId
|
|
1948
|
+
* @param {string} key
|
|
1949
|
+
* @param {string} type
|
|
1950
|
+
* @param {string[]} attributes
|
|
1951
|
+
* @param {string[]} orders
|
|
1952
|
+
* @throws {AppwriteException}
|
|
1953
|
+
* @returns {Promise}
|
|
1954
|
+
*/
|
|
1955
|
+
async createIndex(databaseId: string, collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise<Models.Index> {
|
|
1956
|
+
if (typeof databaseId === 'undefined') {
|
|
1957
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
if (typeof collectionId === 'undefined') {
|
|
1961
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
if (typeof key === 'undefined') {
|
|
1965
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
if (typeof type === 'undefined') {
|
|
1969
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
if (typeof attributes === 'undefined') {
|
|
1973
|
+
throw new AppwriteException('Missing required parameter: "attributes"');
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1977
|
+
const payload: Payload = {};
|
|
1978
|
+
|
|
1979
|
+
if (typeof key !== 'undefined') {
|
|
1980
|
+
payload['key'] = key;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
if (typeof type !== 'undefined') {
|
|
1984
|
+
payload['type'] = type;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
if (typeof attributes !== 'undefined') {
|
|
1988
|
+
payload['attributes'] = attributes;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
if (typeof orders !== 'undefined') {
|
|
1992
|
+
payload['orders'] = orders;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1996
|
+
return await this.client.call('post', uri, {
|
|
1997
|
+
'content-type': 'application/json',
|
|
1998
|
+
}, payload);
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* Get index
|
|
2003
|
+
*
|
|
2004
|
+
*
|
|
2005
|
+
* @param {string} databaseId
|
|
2006
|
+
* @param {string} collectionId
|
|
2007
|
+
* @param {string} key
|
|
2008
|
+
* @throws {AppwriteException}
|
|
2009
|
+
* @returns {Promise}
|
|
2010
|
+
*/
|
|
2011
|
+
async getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index> {
|
|
2012
|
+
if (typeof databaseId === 'undefined') {
|
|
2013
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
if (typeof collectionId === 'undefined') {
|
|
2017
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
if (typeof key === 'undefined') {
|
|
2021
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
2025
|
+
const payload: Payload = {};
|
|
2026
|
+
|
|
2027
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2028
|
+
return await this.client.call('get', uri, {
|
|
2029
|
+
'content-type': 'application/json',
|
|
2030
|
+
}, payload);
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* Delete index
|
|
2035
|
+
*
|
|
2036
|
+
*
|
|
2037
|
+
* @param {string} databaseId
|
|
2038
|
+
* @param {string} collectionId
|
|
2039
|
+
* @param {string} key
|
|
2040
|
+
* @throws {AppwriteException}
|
|
2041
|
+
* @returns {Promise}
|
|
2042
|
+
*/
|
|
2043
|
+
async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
|
2044
|
+
if (typeof databaseId === 'undefined') {
|
|
2045
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
if (typeof collectionId === 'undefined') {
|
|
2049
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
if (typeof key === 'undefined') {
|
|
2053
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
2057
|
+
const payload: Payload = {};
|
|
2058
|
+
|
|
2059
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2060
|
+
return await this.client.call('delete', uri, {
|
|
2061
|
+
'content-type': 'application/json',
|
|
2062
|
+
}, payload);
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
/**
|
|
2066
|
+
* List collection logs
|
|
2067
|
+
*
|
|
2068
|
+
* Get the collection activity logs list by its unique ID.
|
|
2069
|
+
*
|
|
2070
|
+
* @param {string} databaseId
|
|
2071
|
+
* @param {string} collectionId
|
|
2072
|
+
* @param {string[]} queries
|
|
2073
|
+
* @throws {AppwriteException}
|
|
2074
|
+
* @returns {Promise}
|
|
2075
|
+
*/
|
|
2076
|
+
async listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.LogList> {
|
|
2077
|
+
if (typeof databaseId === 'undefined') {
|
|
2078
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
if (typeof collectionId === 'undefined') {
|
|
2082
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2086
|
+
const payload: Payload = {};
|
|
2087
|
+
|
|
2088
|
+
if (typeof queries !== 'undefined') {
|
|
2089
|
+
payload['queries'] = queries;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2093
|
+
return await this.client.call('get', uri, {
|
|
2094
|
+
'content-type': 'application/json',
|
|
2095
|
+
}, payload);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
/**
|
|
2099
|
+
* Get usage stats for a collection
|
|
2100
|
+
*
|
|
2101
|
+
*
|
|
2102
|
+
* @param {string} databaseId
|
|
2103
|
+
* @param {string} collectionId
|
|
2104
|
+
* @param {string} range
|
|
2105
|
+
* @throws {AppwriteException}
|
|
2106
|
+
* @returns {Promise}
|
|
2107
|
+
*/
|
|
2108
|
+
async getCollectionUsage(databaseId: string, collectionId: string, range?: string): Promise<Models.UsageCollection> {
|
|
2109
|
+
if (typeof databaseId === 'undefined') {
|
|
2110
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
if (typeof collectionId === 'undefined') {
|
|
2114
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2118
|
+
const payload: Payload = {};
|
|
2119
|
+
|
|
2120
|
+
if (typeof range !== 'undefined') {
|
|
2121
|
+
payload['range'] = range;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2125
|
+
return await this.client.call('get', uri, {
|
|
2126
|
+
'content-type': 'application/json',
|
|
2127
|
+
}, payload);
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* List database logs
|
|
2132
|
+
*
|
|
2133
|
+
* Get the database activity logs list by its unique ID.
|
|
2134
|
+
*
|
|
2135
|
+
* @param {string} databaseId
|
|
2136
|
+
* @param {string[]} queries
|
|
2137
|
+
* @throws {AppwriteException}
|
|
2138
|
+
* @returns {Promise}
|
|
2139
|
+
*/
|
|
2140
|
+
async listLogs(databaseId: string, queries?: string[]): Promise<Models.LogList> {
|
|
2141
|
+
if (typeof databaseId === 'undefined') {
|
|
2142
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
const apiPath = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
|
|
2146
|
+
const payload: Payload = {};
|
|
2147
|
+
|
|
2148
|
+
if (typeof queries !== 'undefined') {
|
|
2149
|
+
payload['queries'] = queries;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2153
|
+
return await this.client.call('get', uri, {
|
|
2154
|
+
'content-type': 'application/json',
|
|
2155
|
+
}, payload);
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
/**
|
|
2159
|
+
* Get usage stats for the database
|
|
2160
|
+
*
|
|
2161
|
+
*
|
|
2162
|
+
* @param {string} databaseId
|
|
2163
|
+
* @param {string} range
|
|
2164
|
+
* @throws {AppwriteException}
|
|
2165
|
+
* @returns {Promise}
|
|
2166
|
+
*/
|
|
2167
|
+
async getDatabaseUsage(databaseId: string, range?: string): Promise<Models.UsageDatabase> {
|
|
2168
|
+
if (typeof databaseId === 'undefined') {
|
|
2169
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
const apiPath = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
|
|
2173
|
+
const payload: Payload = {};
|
|
2174
|
+
|
|
2175
|
+
if (typeof range !== 'undefined') {
|
|
2176
|
+
payload['range'] = range;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2180
|
+
return await this.client.call('get', uri, {
|
|
2181
|
+
'content-type': 'application/json',
|
|
2182
|
+
}, payload);
|
|
2183
|
+
}
|
|
2154
2184
|
};
|