diff --git a/CHANGELOG.md b/CHANGELOG.md
index 202c22d2..0f5eae0c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,40 @@
# Change Log
+## 19.0.0
+
+* Breaking: SDK now targets Appwrite 2.4 (`X-Appwrite-Response-Format: 2.4.0`)
+* Breaking: removed `Assistant` service and `_APP_ASSISTANT_ENABLED` from `ConsoleVariables`
+* Breaking: positional `Teams.createMembership` takes `membershipId` third, before `email`
+* Breaking: `resource` is `string[]` on `OAuth2.authorize`, `authorizePost`, `createDeviceAuthorization`, `createPAR`, `createToken`
+* Breaking: `conditions` is `string[]` on every `WAF.create*Rule` and `WAF.update*Rule` method
+* Breaking: removed `WafRule` model; `WafRuleList.rules` is a union of the typed rule models
+* Breaking: `BackupRestoration.options` is now an `object` instead of a `string`
+* Breaking: removed `deno-1.21`, `deno-1.24` and `deno-1.35` from `Runtime` and `BuildRuntime` enums
+* Breaking: billing, backup and dedicated database model fields that may be absent are now optional
+* Added: `Account` passkey methods: `createPasskey`, `updatePasskeyVerification`, `listPasskeys`, `getPasskey`, `updatePasskey`, `deletePasskey`
+* Added: `Account.createPasskeyToken` and `Account.updatePasskeyToken` for passkey sign-in
+* Added: `Users.listPasskeys`, `getPasskey`, `updatePasskey` and `deletePasskey`
+* Added: `Project.updatePasskeyPolicy`, `ProjectPolicyId.Passkey` and `ProjectAuthMethodId.Passkey`
+* Added: `Passkey`, `PasskeyList`, `PasskeyChallenge`, `PolicyPasskey` and `TokenSecret` models
+* Added: optional `fingerprints` on `Project.createAndroidPlatform`/`updateAndroidPlatform` and `PlatformAndroid.fingerprints`
+* Added: optional `membershipId` on `Teams.createMembership`
+* Added: optional `state` on `Account.createOAuth2Session` and `Account.createOAuth2Token`
+* Added: `Admin` service with threat methods (`listThreats`, `createThreat`, `getThreat`, `updateThreatStatus`, `deleteThreat`)
+* Added: `Admin` cache methods `deletePlatformCache`, `deletePlatformResourceCache`, `deleteProjectCache`, `deleteProjectResourceCache`
+* Added: `Threat`, `ThreatList` models and `ThreatStatus`, `ThreatResourceType`, `PlatformResourceType`, `ProjectResourceType` enums
+* Added: `Analytics` service with property CRUD, `createEvent` and `listMetrics`
+* Added: `Tracking` helper for auto pageviews, outbound links, downloads, scroll depth and engagement
+* Added: `AnalyticsProperty`, `AnalyticsPropertyList`, `AnalyticsMetric`, `AnalyticsMetricList` models; `AnalyticsInterval`, `AnalyticsDimension` enums
+* Added: `ProjectKeyScopes.AnalyticsRead` and `ProjectKeyScopes.AnalyticsWrite`
+* Added: analytics values on `UsageEventMetric`, `UsageGaugeMetric` and `QuerySuggestionResource`
+* Added: `ProxyRuleDeploymentResourceType.DedicatedDatabase`
+* Added: `avatarsStorageTotal` on `UsageOrganization`
+* Added: `Push.onNotificationOpened` and `Push.getInitialNotification` with `PushNotificationOpened` type
+* Added: `Project.updatePasswordRotationPolicy` and the `PolicyPasswordRotation` model
+* Fixed: response models fill missing fields from spec defaults instead of throwing
+* Fixed: `Push` falls back to the signed-in `cookieFallback` session when none is set
+* Fixed: `Push` posts one background notification per title, preferring the server-sent title
+
## 18.3.0
* Added: optional `interval` parameter on `Functions.create`, `Functions.update` and `Projects.createSchedule`
diff --git a/README.md b/README.md
index e0c0064a..bc005f5e 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
# Appwrite Console SDK

-
+
[](https://travis-ci.com/appwrite/sdk-generator)
[](https://twitter.com/appwrite)
[](https://appwrite.io/discord)
-**This SDK targets Appwrite server version latest as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-console/releases) when APIs differ.
+**This SDK targets Appwrite server version 2.4.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-console/releases) when APIs differ.
Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
@@ -33,7 +33,7 @@ import { Client, Account } from '@appwrite.io/console';
To install with a CDN (content delivery network) add the following scripts to the bottom of your
tag, but before you use any Appwrite services:
```html
-
+
```
## Getting Started
diff --git a/docs/examples/account/create-o-auth-2-session.md b/docs/examples/account/create-o-auth-2-session.md
index 735fd2ea..621103a2 100644
--- a/docs/examples/account/create-o-auth-2-session.md
+++ b/docs/examples/account/create-o-auth-2-session.md
@@ -12,5 +12,6 @@ account.createOAuth2Session({
success: 'https://example.com', // optional
failure: 'https://example.com', // optional
scopes: [], // optional
+ state: '', // optional
});
```
diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md
index cf961db6..1cb8437c 100644
--- a/docs/examples/account/create-o-auth-2-token.md
+++ b/docs/examples/account/create-o-auth-2-token.md
@@ -12,5 +12,6 @@ account.createOAuth2Token({
success: 'https://example.com', // optional
failure: 'https://example.com', // optional
scopes: [], // optional
+ state: '', // optional
});
```
diff --git a/docs/examples/account/create-passkey-token.md b/docs/examples/account/create-passkey-token.md
new file mode 100644
index 00000000..b31e8ea1
--- /dev/null
+++ b/docs/examples/account/create-passkey-token.md
@@ -0,0 +1,13 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.createPasskeyToken();
+
+console.log(result);
+```
diff --git a/docs/examples/account/create-passkey.md b/docs/examples/account/create-passkey.md
new file mode 100644
index 00000000..435f86a0
--- /dev/null
+++ b/docs/examples/account/create-passkey.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.createPasskey({
+ passkeyId: '', // optional
+ name: '', // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/account/delete-passkey.md b/docs/examples/account/delete-passkey.md
new file mode 100644
index 00000000..33723386
--- /dev/null
+++ b/docs/examples/account/delete-passkey.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.deletePasskey({
+ passkeyId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/account/get-passkey.md b/docs/examples/account/get-passkey.md
new file mode 100644
index 00000000..103bff12
--- /dev/null
+++ b/docs/examples/account/get-passkey.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.getPasskey({
+ passkeyId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/account/list-passkeys.md b/docs/examples/account/list-passkeys.md
new file mode 100644
index 00000000..5cfa36cf
--- /dev/null
+++ b/docs/examples/account/list-passkeys.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.listPasskeys({
+ queries: [], // optional
+ total: false, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/account/update-passkey-token.md b/docs/examples/account/update-passkey-token.md
new file mode 100644
index 00000000..2d2c13db
--- /dev/null
+++ b/docs/examples/account/update-passkey-token.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.updatePasskeyToken({
+ challengeId: '',
+ credential: {},
+});
+
+console.log(result);
+```
diff --git a/docs/examples/account/update-passkey-verification.md b/docs/examples/account/update-passkey-verification.md
new file mode 100644
index 00000000..2d0e2855
--- /dev/null
+++ b/docs/examples/account/update-passkey-verification.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.updatePasskeyVerification({
+ passkeyId: '',
+ credential: {},
+});
+
+console.log(result);
+```
diff --git a/docs/examples/account/update-passkey.md b/docs/examples/account/update-passkey.md
new file mode 100644
index 00000000..39b9769f
--- /dev/null
+++ b/docs/examples/account/update-passkey.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Account } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const account = new Account(client);
+
+const result = await account.updatePasskey({
+ passkeyId: '',
+ name: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/admin/create-threat.md b/docs/examples/admin/create-threat.md
new file mode 100644
index 00000000..f42321a5
--- /dev/null
+++ b/docs/examples/admin/create-threat.md
@@ -0,0 +1,24 @@
+```javascript
+import {
+ Client,
+ Admin,
+ ThreatResourceType,
+ ThreatStatus,
+} from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.createThreat({
+ projectId: '',
+ resourceType: ThreatResourceType.Projects,
+ resourceId: '',
+ description: '', // optional
+ status: ThreatStatus.Open, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/admin/delete-platform-cache.md b/docs/examples/admin/delete-platform-cache.md
new file mode 100644
index 00000000..7e31802e
--- /dev/null
+++ b/docs/examples/admin/delete-platform-cache.md
@@ -0,0 +1,13 @@
+```javascript
+import { Client, Admin } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.deletePlatformCache();
+
+console.log(result);
+```
diff --git a/docs/examples/admin/delete-platform-resource-cache.md b/docs/examples/admin/delete-platform-resource-cache.md
new file mode 100644
index 00000000..52b684d6
--- /dev/null
+++ b/docs/examples/admin/delete-platform-resource-cache.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Admin, PlatformResourceType } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.deletePlatformResourceCache({
+ resourceType: PlatformResourceType.Projects,
+ resourceId: '', // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/admin/delete-project-cache.md b/docs/examples/admin/delete-project-cache.md
new file mode 100644
index 00000000..fb7e0dda
--- /dev/null
+++ b/docs/examples/admin/delete-project-cache.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Admin } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.deleteProjectCache({
+ projectId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/admin/delete-project-resource-cache.md b/docs/examples/admin/delete-project-resource-cache.md
new file mode 100644
index 00000000..728f3a74
--- /dev/null
+++ b/docs/examples/admin/delete-project-resource-cache.md
@@ -0,0 +1,17 @@
+```javascript
+import { Client, Admin, ProjectResourceType } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.deleteProjectResourceCache({
+ projectId: '',
+ resourceType: ProjectResourceType.Users,
+ resourceId: '', // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/assistant/chat.md b/docs/examples/admin/delete-threat.md
similarity index 56%
rename from docs/examples/assistant/chat.md
rename to docs/examples/admin/delete-threat.md
index 2131548d..254d2086 100644
--- a/docs/examples/assistant/chat.md
+++ b/docs/examples/admin/delete-threat.md
@@ -1,14 +1,14 @@
```javascript
-import { Client, Assistant } from '@appwrite.io/console';
+import { Client, Admin } from '@appwrite.io/console';
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
.setProject(''); // Your project ID
-const assistant = new Assistant(client);
+const admin = new Admin(client);
-const result = await assistant.chat({
- prompt: '',
+const result = await admin.deleteThreat({
+ threatId: '',
});
console.log(result);
diff --git a/docs/examples/admin/get-threat.md b/docs/examples/admin/get-threat.md
new file mode 100644
index 00000000..c8f3df79
--- /dev/null
+++ b/docs/examples/admin/get-threat.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Admin } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.getThreat({
+ threatId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/admin/list-threats.md b/docs/examples/admin/list-threats.md
new file mode 100644
index 00000000..71368d31
--- /dev/null
+++ b/docs/examples/admin/list-threats.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Admin } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.listThreats({
+ queries: [], // optional
+ total: false, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/admin/update-threat-status.md b/docs/examples/admin/update-threat-status.md
new file mode 100644
index 00000000..e359ad94
--- /dev/null
+++ b/docs/examples/admin/update-threat-status.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Admin, ThreatStatus } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const admin = new Admin(client);
+
+const result = await admin.updateThreatStatus({
+ threatId: '',
+ status: ThreatStatus.Open,
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/create-event.md b/docs/examples/analytics/create-event.md
new file mode 100644
index 00000000..b5201362
--- /dev/null
+++ b/docs/examples/analytics/create-event.md
@@ -0,0 +1,27 @@
+```javascript
+import { Client, Analytics } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.createEvent({
+ propertyId: '',
+ name: '',
+ url: 'https://example.com',
+ domain: '', // optional
+ referrer: '', // optional
+ screenWidth: null, // optional
+ sessionHash: '', // optional
+ scrollDepth: 0, // optional
+ engagementTime: 0, // optional
+ props: [], // optional
+ userId: '', // optional
+ ip: '', // optional
+ userAgent: '', // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/create-property.md b/docs/examples/analytics/create-property.md
new file mode 100644
index 00000000..e268f869
--- /dev/null
+++ b/docs/examples/analytics/create-property.md
@@ -0,0 +1,20 @@
+```javascript
+import { Client, Analytics } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.createProperty({
+ propertyId: '',
+ name: '',
+ domain: '', // optional
+ enabled: false, // optional
+ xpublic: false, // optional
+ allowedOrigins: [], // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/delete-property.md b/docs/examples/analytics/delete-property.md
new file mode 100644
index 00000000..390ec323
--- /dev/null
+++ b/docs/examples/analytics/delete-property.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Analytics } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.deleteProperty({
+ propertyId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/get-property.md b/docs/examples/analytics/get-property.md
new file mode 100644
index 00000000..9605b522
--- /dev/null
+++ b/docs/examples/analytics/get-property.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Analytics } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.getProperty({
+ propertyId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/list-metrics.md b/docs/examples/analytics/list-metrics.md
new file mode 100644
index 00000000..675da6f1
--- /dev/null
+++ b/docs/examples/analytics/list-metrics.md
@@ -0,0 +1,27 @@
+```javascript
+import {
+ Client,
+ Analytics,
+ AnalyticsInterval,
+ AnalyticsDimension,
+} from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.listMetrics({
+ propertyId: '',
+ queries: [], // optional
+ interval: AnalyticsInterval.OneHour, // optional
+ dimensions: [AnalyticsDimension.Country], // optional
+ dateRange: '', // optional
+ startAt: '2020-10-15T06:38:00.000+00:00', // optional
+ endAt: '2020-10-15T06:38:00.000+00:00', // optional
+ limit: 1, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/list-properties.md b/docs/examples/analytics/list-properties.md
new file mode 100644
index 00000000..d543a7d5
--- /dev/null
+++ b/docs/examples/analytics/list-properties.md
@@ -0,0 +1,17 @@
+```javascript
+import { Client, Analytics } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.listProperties({
+ queries: [], // optional
+ search: '', // optional
+ total: false, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/analytics/update-property.md b/docs/examples/analytics/update-property.md
new file mode 100644
index 00000000..e1dac9d2
--- /dev/null
+++ b/docs/examples/analytics/update-property.md
@@ -0,0 +1,20 @@
+```javascript
+import { Client, Analytics } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const analytics = new Analytics(client);
+
+const result = await analytics.updateProperty({
+ propertyId: '',
+ name: '', // optional
+ domain: '', // optional
+ enabled: false, // optional
+ xpublic: false, // optional
+ allowedOrigins: [], // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/oauth2/authorize-post.md b/docs/examples/oauth2/authorize-post.md
index acb7116d..551709b9 100644
--- a/docs/examples/oauth2/authorize-post.md
+++ b/docs/examples/oauth2/authorize-post.md
@@ -19,7 +19,7 @@ const result = await oauth2.authorizePost({
prompt: '', // optional
maxAge: 0, // optional
authorizationDetails: '', // optional
- resource: '', // optional
+ resource: [], // optional
audience: '', // optional
requestUri: '', // optional
});
diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md
index 0a02731b..87be841a 100644
--- a/docs/examples/oauth2/authorize.md
+++ b/docs/examples/oauth2/authorize.md
@@ -19,7 +19,7 @@ const result = await oauth2.authorize({
prompt: '', // optional
maxAge: 0, // optional
authorizationDetails: '', // optional
- resource: '', // optional
+ resource: [], // optional
audience: '', // optional
requestUri: '', // optional
});
diff --git a/docs/examples/oauth2/create-device-authorization.md b/docs/examples/oauth2/create-device-authorization.md
index 3203b84d..7ab83a56 100644
--- a/docs/examples/oauth2/create-device-authorization.md
+++ b/docs/examples/oauth2/create-device-authorization.md
@@ -11,7 +11,7 @@ const result = await oauth2.createDeviceAuthorization({
clientId: '', // optional
scope: '', // optional
authorizationDetails: '', // optional
- resource: '', // optional
+ resource: [], // optional
audience: '', // optional
});
diff --git a/docs/examples/oauth2/create-par.md b/docs/examples/oauth2/create-par.md
index 3c503287..3e5f0415 100644
--- a/docs/examples/oauth2/create-par.md
+++ b/docs/examples/oauth2/create-par.md
@@ -19,7 +19,7 @@ const result = await oauth2.createPAR({
prompt: '', // optional
maxAge: 0, // optional
authorizationDetails: '', // optional
- resource: '', // optional
+ resource: [], // optional
audience: '', // optional
});
diff --git a/docs/examples/oauth2/create-token.md b/docs/examples/oauth2/create-token.md
index 900352e9..512346b4 100644
--- a/docs/examples/oauth2/create-token.md
+++ b/docs/examples/oauth2/create-token.md
@@ -16,7 +16,7 @@ const result = await oauth2.createToken({
clientSecret: '', // optional
codeVerifier: '', // optional
redirectUri: 'https://example.com', // optional
- resource: '', // optional
+ resource: [], // optional
audience: '', // optional
});
diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md
index df927932..a5cb57a2 100644
--- a/docs/examples/project/create-android-platform.md
+++ b/docs/examples/project/create-android-platform.md
@@ -11,6 +11,7 @@ const result = await project.createAndroidPlatform({
platformId: '',
name: '',
applicationId: '',
+ fingerprints: [], // optional
});
console.log(result);
diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md
index e736fb56..7a9650f7 100644
--- a/docs/examples/project/update-android-platform.md
+++ b/docs/examples/project/update-android-platform.md
@@ -11,6 +11,7 @@ const result = await project.updateAndroidPlatform({
platformId: '',
name: '',
applicationId: '',
+ fingerprints: [], // optional
});
console.log(result);
diff --git a/docs/examples/project/update-passkey-policy.md b/docs/examples/project/update-passkey-policy.md
new file mode 100644
index 00000000..9f9835e0
--- /dev/null
+++ b/docs/examples/project/update-passkey-policy.md
@@ -0,0 +1,15 @@
+```javascript
+import { Client, Project } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const project = new Project(client);
+
+const result = await project.updatePasskeyPolicy({
+ rpId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/project/update-password-rotation-policy.md b/docs/examples/project/update-password-rotation-policy.md
new file mode 100644
index 00000000..903ad282
--- /dev/null
+++ b/docs/examples/project/update-password-rotation-policy.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Project } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const project = new Project(client);
+
+const result = await project.updatePasswordRotationPolicy({
+ enabled: false, // optional
+ maxAge: 86400, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md
index d06d4894..4ac5b8c3 100644
--- a/docs/examples/teams/create-membership.md
+++ b/docs/examples/teams/create-membership.md
@@ -10,6 +10,7 @@ const teams = new Teams(client);
const result = await teams.createMembership({
teamId: '',
roles: ['editor'],
+ membershipId: '', // optional
email: 'email@example.com', // optional
userId: '', // optional
phone: '+12065550100', // optional
diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md
index 30b8d975..fe672527 100644
--- a/docs/examples/usage/list-events.md
+++ b/docs/examples/usage/list-events.md
@@ -16,7 +16,7 @@ const client = new Client()
const usage = new Usage(client);
const result = await usage.listEvents({
- metrics: [UsageEventMetric.NetworkRequests],
+ metrics: [UsageEventMetric.AnalyticsEvents],
queries: [], // optional
interval: UsageInterval.OneMinute, // optional
dimensions: [UsageEventDimension.Path], // optional
diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md
index 745ecf94..3cc965dc 100644
--- a/docs/examples/usage/list-gauges.md
+++ b/docs/examples/usage/list-gauges.md
@@ -16,7 +16,7 @@ const client = new Client()
const usage = new Usage(client);
const result = await usage.listGauges({
- metrics: [UsageGaugeMetric.Teams],
+ metrics: [UsageGaugeMetric.AnalyticsProperties],
queries: [], // optional
interval: UsageInterval.OneMinute, // optional
dimensions: [UsageGaugeDimension.ResourceId], // optional
diff --git a/docs/examples/users/delete-passkey.md b/docs/examples/users/delete-passkey.md
new file mode 100644
index 00000000..3d9c7bca
--- /dev/null
+++ b/docs/examples/users/delete-passkey.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Users } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const users = new Users(client);
+
+const result = await users.deletePasskey({
+ userId: '',
+ passkeyId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/users/get-passkey.md b/docs/examples/users/get-passkey.md
new file mode 100644
index 00000000..0edc9e79
--- /dev/null
+++ b/docs/examples/users/get-passkey.md
@@ -0,0 +1,16 @@
+```javascript
+import { Client, Users } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const users = new Users(client);
+
+const result = await users.getPasskey({
+ userId: '',
+ passkeyId: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/users/list-passkeys.md b/docs/examples/users/list-passkeys.md
new file mode 100644
index 00000000..2afd4c9e
--- /dev/null
+++ b/docs/examples/users/list-passkeys.md
@@ -0,0 +1,17 @@
+```javascript
+import { Client, Users } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const users = new Users(client);
+
+const result = await users.listPasskeys({
+ userId: '',
+ queries: [], // optional
+ total: false, // optional
+});
+
+console.log(result);
+```
diff --git a/docs/examples/users/update-passkey.md b/docs/examples/users/update-passkey.md
new file mode 100644
index 00000000..d435d4af
--- /dev/null
+++ b/docs/examples/users/update-passkey.md
@@ -0,0 +1,17 @@
+```javascript
+import { Client, Users } from '@appwrite.io/console';
+
+const client = new Client()
+ .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject(''); // Your project ID
+
+const users = new Users(client);
+
+const result = await users.updatePasskey({
+ userId: '',
+ passkeyId: '',
+ name: '',
+});
+
+console.log(result);
+```
diff --git a/docs/examples/waf/create-bypass-rule.md b/docs/examples/waf/create-bypass-rule.md
index 9c494768..d5db7c0f 100644
--- a/docs/examples/waf/create-bypass-rule.md
+++ b/docs/examples/waf/create-bypass-rule.md
@@ -15,7 +15,7 @@ const result = await waf.createBypassRule({
description: '', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/create-challenge-rule.md b/docs/examples/waf/create-challenge-rule.md
index 5b1689f8..a93d6acc 100644
--- a/docs/examples/waf/create-challenge-rule.md
+++ b/docs/examples/waf/create-challenge-rule.md
@@ -16,7 +16,7 @@ const result = await waf.createChallengeRule({
challengeType: 'compute', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
difficulty: 1, // optional
ttl: 900, // optional
});
diff --git a/docs/examples/waf/create-deny-rule.md b/docs/examples/waf/create-deny-rule.md
index 87bfdbec..b6d9488c 100644
--- a/docs/examples/waf/create-deny-rule.md
+++ b/docs/examples/waf/create-deny-rule.md
@@ -15,7 +15,7 @@ const result = await waf.createDenyRule({
description: '', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/create-rate-limit-rule.md b/docs/examples/waf/create-rate-limit-rule.md
index bb1d683f..12cb9baa 100644
--- a/docs/examples/waf/create-rate-limit-rule.md
+++ b/docs/examples/waf/create-rate-limit-rule.md
@@ -20,7 +20,7 @@ const result = await waf.createRateLimitRule({
maxBucketSize: 1, // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/create-redirect-rule.md b/docs/examples/waf/create-redirect-rule.md
index 37d9ed8f..650e8b9f 100644
--- a/docs/examples/waf/create-redirect-rule.md
+++ b/docs/examples/waf/create-redirect-rule.md
@@ -17,7 +17,7 @@ const result = await waf.createRedirectRule({
description: '', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/update-bypass-rule.md b/docs/examples/waf/update-bypass-rule.md
index d0987aa2..a82f8190 100644
--- a/docs/examples/waf/update-bypass-rule.md
+++ b/docs/examples/waf/update-bypass-rule.md
@@ -15,7 +15,7 @@ const result = await waf.updateBypassRule({
description: '', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/update-challenge-rule.md b/docs/examples/waf/update-challenge-rule.md
index 210200fc..d2d18336 100644
--- a/docs/examples/waf/update-challenge-rule.md
+++ b/docs/examples/waf/update-challenge-rule.md
@@ -16,7 +16,7 @@ const result = await waf.updateChallengeRule({
challengeType: 'compute', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
difficulty: 1, // optional
ttl: 900, // optional
});
diff --git a/docs/examples/waf/update-deny-rule.md b/docs/examples/waf/update-deny-rule.md
index a46d5680..608bb7c1 100644
--- a/docs/examples/waf/update-deny-rule.md
+++ b/docs/examples/waf/update-deny-rule.md
@@ -15,7 +15,7 @@ const result = await waf.updateDenyRule({
description: '', // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/update-rate-limit-rule.md b/docs/examples/waf/update-rate-limit-rule.md
index 24dfd934..1b30b99e 100644
--- a/docs/examples/waf/update-rate-limit-rule.md
+++ b/docs/examples/waf/update-rate-limit-rule.md
@@ -19,7 +19,7 @@ const result = await waf.updateRateLimitRule({
maxBucketSize: 1, // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/docs/examples/waf/update-redirect-rule.md b/docs/examples/waf/update-redirect-rule.md
index 00e5c3ef..05612edc 100644
--- a/docs/examples/waf/update-redirect-rule.md
+++ b/docs/examples/waf/update-redirect-rule.md
@@ -17,7 +17,7 @@ const result = await waf.updateRedirectRule({
statusCode: 300, // optional
priority: -100000, // optional
enabled: false, // optional
- conditions: '', // optional
+ conditions: [], // optional
});
console.log(result);
diff --git a/package-lock.json b/package-lock.json
index 7b58eeaf..db4c0ce0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@appwrite.io/console",
- "version": "18.3.0",
+ "version": "19.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@appwrite.io/console",
- "version": "18.3.0",
+ "version": "19.0.0",
"license": "BSD-3-Clause",
"dependencies": {
"buffer": "6.0.3",
diff --git a/package.json b/package.json
index 8d979f4a..88a5eb8e 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "@appwrite.io/console",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
- "version": "18.3.0",
+ "version": "19.0.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
diff --git a/src/client.ts b/src/client.ts
index 532c86a3..8047cbfc 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -45,6 +45,50 @@ export const JSONbig = {
stringify: JSONbigSerializer.stringify,
};
+type DefaultsShape = string | { items: DefaultsShape };
+
+type DefaultsModel = {
+ defaults?: Record;
+ properties?: Record;
+};
+
+type Defaults = {
+ root: DefaultsShape;
+ models: Record;
+};
+
+export function applyDefaults(value: T, tree: Defaults): T {
+ return fillDefaults(value, tree.root, tree.models) as T;
+}
+
+function fillDefaults(
+ value: unknown,
+ shape: DefaultsShape,
+ models: Record,
+): unknown {
+ if (typeof shape !== 'string') {
+ if (!Array.isArray(value)) {
+ return value;
+ }
+ const items = shape.items;
+ return value.map((item) => fillDefaults(item, items, models));
+ }
+ const model = models[shape];
+ if (!model || typeof value !== 'object' || value === null) {
+ return value;
+ }
+ if (Array.isArray(value)) {
+ return value;
+ }
+ const result: Record = { ...model.defaults, ...value };
+ for (const [key, child] of Object.entries(model.properties ?? {})) {
+ if (key in result) {
+ result[key] = fillDefaults(result[key], child, models);
+ }
+ }
+ return result;
+}
+
/**
* Payload type representing a key-value pair with string keys and any values.
*/
@@ -413,8 +457,8 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
- 'x-sdk-version': '18.3.0',
- 'X-Appwrite-Response-Format': '2.3.0',
+ 'x-sdk-version': '19.0.0',
+ 'X-Appwrite-Response-Format': '2.4.0',
};
/**
diff --git a/src/enums/analytics-dimension.ts b/src/enums/analytics-dimension.ts
new file mode 100644
index 00000000..db552069
--- /dev/null
+++ b/src/enums/analytics-dimension.ts
@@ -0,0 +1,24 @@
+export enum AnalyticsDimension {
+ Country = 'country',
+ Region = 'region',
+ City = 'city',
+ Browser = 'browser',
+ OperatingSystem = 'operatingSystem',
+ Device = 'device',
+ ScreenSize = 'screenSize',
+ ReferrerSource = 'referrerSource',
+ Channel = 'channel',
+ UtmSource = 'utmSource',
+ UtmMedium = 'utmMedium',
+ UtmCampaign = 'utmCampaign',
+ UtmContent = 'utmContent',
+ UtmTerm = 'utmTerm',
+ Page = 'page',
+ Hostname = 'hostname',
+ EntryPage = 'entryPage',
+ ExitPage = 'exitPage',
+ TrafficType = 'trafficType',
+ BotName = 'botName',
+ BotCategory = 'botCategory',
+ EventName = 'eventName',
+}
diff --git a/src/enums/analytics-interval.ts b/src/enums/analytics-interval.ts
new file mode 100644
index 00000000..344f58e2
--- /dev/null
+++ b/src/enums/analytics-interval.ts
@@ -0,0 +1,6 @@
+export enum AnalyticsInterval {
+ OneHour = '1h',
+ OneDay = '1d',
+ OneWeek = '1w',
+ OneMonth = '1m',
+}
diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts
index 01558318..2dfd9c61 100644
--- a/src/enums/build-runtime.ts
+++ b/src/enums/build-runtime.ts
@@ -31,9 +31,6 @@ export enum BuildRuntime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
- Deno121 = 'deno-1.21',
- Deno124 = 'deno-1.24',
- Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
diff --git a/src/enums/platform-resource-type.ts b/src/enums/platform-resource-type.ts
new file mode 100644
index 00000000..66dcef4a
--- /dev/null
+++ b/src/enums/platform-resource-type.ts
@@ -0,0 +1,11 @@
+export enum PlatformResourceType {
+ Projects = 'projects',
+ Organizations = 'organizations',
+ Users = 'users',
+ Memberships = 'memberships',
+ Rules = 'rules',
+ Keys = 'keys',
+ Platforms = 'platforms',
+ Webhooks = 'webhooks',
+ Certificates = 'certificates',
+}
diff --git a/src/enums/project-auth-method-id.ts b/src/enums/project-auth-method-id.ts
index 367ed141..34504b46 100644
--- a/src/enums/project-auth-method-id.ts
+++ b/src/enums/project-auth-method-id.ts
@@ -6,4 +6,5 @@ export enum ProjectAuthMethodId {
Invites = 'invites',
Jwt = 'jwt',
Phone = 'phone',
+ Passkey = 'passkey',
}
diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts
index 48ab459e..3cb8cc4f 100644
--- a/src/enums/project-key-scopes.ts
+++ b/src/enums/project-key-scopes.ts
@@ -122,4 +122,6 @@ export enum ProjectKeyScopes {
Oauth2Read = 'oauth2.read',
Oauth2Write = 'oauth2.write',
Oauth2Introspect = 'oauth2.introspect',
+ AnalyticsRead = 'analytics.read',
+ AnalyticsWrite = 'analytics.write',
}
diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts
index d323094f..67fc5fe3 100644
--- a/src/enums/project-policy-id.ts
+++ b/src/enums/project-policy-id.ts
@@ -4,6 +4,7 @@ export enum ProjectPolicyId {
Passwordstrength = 'password-strength',
Passwordpersonaldata = 'password-personal-data',
Passwordpwned = 'password-pwned',
+ Passwordrotation = 'password-rotation',
Sessionalert = 'session-alert',
Sessionduration = 'session-duration',
Sessioninvalidation = 'session-invalidation',
@@ -15,4 +16,5 @@ export enum ProjectPolicyId {
Denydisposableemail = 'deny-disposable-email',
Denyfreeemail = 'deny-free-email',
Denycorporateemail = 'deny-corporate-email',
+ Passkey = 'passkey',
}
diff --git a/src/enums/project-resource-type.ts b/src/enums/project-resource-type.ts
new file mode 100644
index 00000000..f1ee2f77
--- /dev/null
+++ b/src/enums/project-resource-type.ts
@@ -0,0 +1,13 @@
+export enum ProjectResourceType {
+ Users = 'users',
+ Teams = 'teams',
+ Memberships = 'memberships',
+ Databases = 'databases',
+ Buckets = 'buckets',
+ Functions = 'functions',
+ Sites = 'sites',
+ Deployments = 'deployments',
+ Topics = 'topics',
+ Providers = 'providers',
+ Messages = 'messages',
+}
diff --git a/src/enums/proxy-rule-deployment-resource-type.ts b/src/enums/proxy-rule-deployment-resource-type.ts
index ef695072..2b1c942c 100644
--- a/src/enums/proxy-rule-deployment-resource-type.ts
+++ b/src/enums/proxy-rule-deployment-resource-type.ts
@@ -1,4 +1,5 @@
export enum ProxyRuleDeploymentResourceType {
Function = 'function',
Site = 'site',
+ DedicatedDatabase = 'dedicatedDatabase',
}
diff --git a/src/enums/query-suggestion-resource.ts b/src/enums/query-suggestion-resource.ts
index 272418af..f9f354ed 100644
--- a/src/enums/query-suggestion-resource.ts
+++ b/src/enums/query-suggestion-resource.ts
@@ -88,6 +88,7 @@ export enum QuerySuggestionResource {
ResourceTokens = 'resourcetokens',
Transactions = 'transactions',
TransactionLogs = 'transactionlogs',
+ AnalyticsProperties = 'analyticsproperties',
DedicatedDatabases = 'dedicateddatabases',
DedicatedDatabaseConfigs = 'dedicateddatabaseconfigs',
DedicatedDatabaseRuntimes = 'dedicateddatabaseruntimes',
diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts
index 1f3d4823..7bbcbb6f 100644
--- a/src/enums/runtime.ts
+++ b/src/enums/runtime.ts
@@ -31,9 +31,6 @@ export enum Runtime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
- Deno121 = 'deno-1.21',
- Deno124 = 'deno-1.24',
- Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
diff --git a/src/enums/threat-resource-type.ts b/src/enums/threat-resource-type.ts
new file mode 100644
index 00000000..ff33b2b8
--- /dev/null
+++ b/src/enums/threat-resource-type.ts
@@ -0,0 +1,12 @@
+export enum ThreatResourceType {
+ Projects = 'projects',
+ Functions = 'functions',
+ Sites = 'sites',
+ Deployments = 'deployments',
+ Databases = 'databases',
+ Buckets = 'buckets',
+ Files = 'files',
+ Users = 'users',
+ Mails = 'mails',
+ Platforms = 'platforms',
+}
diff --git a/src/enums/threat-status.ts b/src/enums/threat-status.ts
new file mode 100644
index 00000000..a34ce809
--- /dev/null
+++ b/src/enums/threat-status.ts
@@ -0,0 +1,5 @@
+export enum ThreatStatus {
+ Open = 'open',
+ Resolved = 'resolved',
+ Dismissed = 'dismissed',
+}
diff --git a/src/enums/usage-event-metric.ts b/src/enums/usage-event-metric.ts
index d71732d5..5e3c39da 100644
--- a/src/enums/usage-event-metric.ts
+++ b/src/enums/usage-event-metric.ts
@@ -1,4 +1,7 @@
export enum UsageEventMetric {
+ AnalyticsEvents = 'analytics.events',
+ AnalyticsPageviews = 'analytics.pageviews',
+ AnalyticsBotsEvents = 'analytics.bots.events',
NetworkRequests = 'network.requests',
NetworkInbound = 'network.inbound',
NetworkOutbound = 'network.outbound',
diff --git a/src/enums/usage-gauge-metric.ts b/src/enums/usage-gauge-metric.ts
index 5de2cb5c..bad68bfa 100644
--- a/src/enums/usage-gauge-metric.ts
+++ b/src/enums/usage-gauge-metric.ts
@@ -1,4 +1,5 @@
export enum UsageGaugeMetric {
+ AnalyticsProperties = 'analytics.properties',
Teams = 'teams',
Users = 'users',
Messages = 'messages',
diff --git a/src/index.ts b/src/index.ts
index 4d501ac5..145126ec 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,7 +1,7 @@
/**
* Appwrite Console SDK
*
- * This SDK targets Appwrite server version 2.3.x as shipped on Appwrite Cloud.
+ * This SDK targets Appwrite server version 2.4.x as shipped on Appwrite Cloud.
* Self-hosted releases can lag behind Cloud — if you run an older self-hosted
* build, use a matching older SDK from
* [previous releases](https://github.com/appwrite/sdk-for-console/releases)
@@ -10,11 +10,12 @@
export { Client, Query, AppwriteException } from './client';
export { Account } from './services/account';
export { Activities } from './services/activities';
+export { Admin } from './services/admin';
export { Affiliates } from './services/affiliates';
+export { Analytics } from './services/analytics';
export { Apps } from './services/apps';
export { Avatars } from './services/avatars';
export { Backups } from './services/backups';
-export { Assistant } from './services/assistant';
export { Console } from './services/console';
export { Databases } from './services/databases';
export { DocumentsDB } from './services/documents-db';
@@ -52,6 +53,7 @@ export { Waf } from './services/waf';
export { Webhooks } from './services/webhooks';
export { Realtime } from './services/realtime';
export { Push } from './services/push';
+export { Tracking } from './services/analytics-tracking';
export type {
Models,
Payload,
@@ -61,10 +63,17 @@ export type {
export type { RealtimeSubscription } from './services/realtime';
export type {
PushMessage,
+ PushNotificationOpened,
PushSubscription,
SubscribeOptions,
MessageCallback,
} from './services/push';
+export type {
+ DownloadTrackingOptions,
+ OutboundTrackingOptions,
+ TrackingEventOptions,
+ TrackingOptions,
+} from './services/analytics-tracking';
export type { QueryTypes, QueryTypesList } from './query';
export { Permission } from './permission';
export { Role } from './role';
@@ -77,6 +86,12 @@ export { AuthenticatorType } from './enums/authenticator-type';
export { AuthenticationFactor } from './enums/authentication-factor';
export { IdTokenProvider } from './enums/id-token-provider';
export { OAuthProvider } from './enums/o-auth-provider';
+export { PlatformResourceType } from './enums/platform-resource-type';
+export { ProjectResourceType } from './enums/project-resource-type';
+export { ThreatResourceType } from './enums/threat-resource-type';
+export { ThreatStatus } from './enums/threat-status';
+export { AnalyticsInterval } from './enums/analytics-interval';
+export { AnalyticsDimension } from './enums/analytics-dimension';
export { Browser } from './enums/browser';
export { CreditCard } from './enums/credit-card';
export { Flag } from './enums/flag';
diff --git a/src/models.ts b/src/models.ts
index c101a716..d975a464 100644
--- a/src/models.ts
+++ b/src/models.ts
@@ -653,6 +653,7 @@ export namespace Models {
| Models.PolicyPasswordStrength
| Models.PolicyPasswordPersonalData
| Models.PolicyPasswordPwned
+ | Models.PolicyPasswordRotation
| Models.PolicySessionAlert
| Models.PolicySessionDuration
| Models.PolicySessionInvalidation
@@ -664,6 +665,7 @@ export namespace Models {
| Models.PolicyDenyDisposableEmail
| Models.PolicyDenyFreeEmail
| Models.PolicyDenyCorporateEmail
+ | Models.PolicyPasskey
)[];
};
@@ -7035,6 +7037,24 @@ export namespace Models {
users: boolean;
};
+ /**
+ * Policy Password Rotation
+ */
+ export type PolicyPasswordRotation = {
+ /**
+ * Policy ID.
+ */
+ $id: string;
+ /**
+ * Whether expired passwords require a reset before email/password sign-in.
+ */
+ enabled: boolean;
+ /**
+ * Maximum password age in seconds.
+ */
+ maxAge: number;
+ };
+
/**
* Policy Session Alert
*/
@@ -7165,6 +7185,24 @@ export namespace Models {
custom: boolean;
};
+ /**
+ * Policy Passkey
+ */
+ export type PolicyPasskey = {
+ /**
+ * Policy ID.
+ */
+ $id: string;
+ /**
+ * Relying party ID passkeys are bound to. Empty until configured.
+ */
+ rpId: string;
+ /**
+ * Web origins passkeys work on, from the project's platforms on the relying party ID and a localhost web platform. Read-only.
+ */
+ origins: string[];
+ };
+
/**
* Policy Deny Aliased Email
*/
@@ -7309,6 +7347,10 @@ export namespace Models {
* Android application ID.
*/
applicationId: string;
+ /**
+ * SHA-256 fingerprints of the certificates the app is signed with. Passkeys created in the app are accepted when its signature matches one.
+ */
+ fingerprints: string[];
};
/**
@@ -7862,7 +7904,7 @@ export namespace Models {
*/
deploymentId: string;
/**
- * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment".
+ * Type of deployment resource: function, site, or dedicatedDatabase.
*/
deploymentResourceType?: ProxyRuleDeploymentResourceType;
/**
@@ -8061,10 +8103,6 @@ export namespace Models {
* Defines if main domain is configured. If so, custom domains can be created.
*/
_APP_DOMAIN_ENABLED: boolean;
- /**
- * Defines if AI assistant is enabled.
- */
- _APP_ASSISTANT_ENABLED: boolean;
/**
* A comma separated list of domains to use for site URLs.
*/
@@ -8265,6 +8303,102 @@ export namespace Models {
code: string;
};
+ /**
+ * Token Secret
+ */
+ export type TokenSecret = {
+ /**
+ * Token ID.
+ */
+ $id: string;
+ /**
+ * Token creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * User ID.
+ */
+ userId: string;
+ /**
+ * Token secret key. Exchange it for a session with the create session endpoint.
+ */
+ secret: string;
+ /**
+ * Token expiration date in ISO 8601 format.
+ */
+ expire: string;
+ /**
+ * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email.
+ */
+ phrase: string;
+ };
+
+ /**
+ * Passkey
+ */
+ export type Passkey = {
+ /**
+ * Passkey ID.
+ */
+ $id: string;
+ /**
+ * Passkey creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Passkey update date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * Passkey name.
+ */
+ name: string;
+ /**
+ * Most recent sign-in with this passkey in ISO 8601 format. Empty until the passkey is used to sign in.
+ */
+ accessedAt: string;
+ };
+
+ /**
+ * Passkey Challenge
+ */
+ export type PasskeyChallenge = {
+ /**
+ * Challenge ID. When signing in, pass it back with the credential to receive a token.
+ */
+ $id: string;
+ /**
+ * Challenge creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * ID of the passkey being registered. Empty for sign-in challenges.
+ */
+ passkeyId: string;
+ /**
+ * Challenge expiration date in ISO 8601 format.
+ */
+ expire: string;
+ /**
+ * WebAuthn options in JSON form. Pass them to `PublicKeyCredential.parseCreationOptionsFromJSON()` when registering, or `PublicKeyCredential.parseRequestOptionsFromJSON()` when signing in.
+ */
+ publicKey: object;
+ };
+
+ /**
+ * Passkeys List
+ */
+ export type PasskeyList = {
+ /**
+ * Total number of passkeys that matched your query.
+ */
+ total: number;
+ /**
+ * List of passkeys.
+ */
+ passkeys: Passkey[];
+ };
+
/**
* MFA Recovery Codes
*/
@@ -9359,6 +9493,120 @@ export namespace Models {
resources: UsageResources[];
};
+ /**
+ * AnalyticsMetric
+ */
+ export type AnalyticsMetric = {
+ /**
+ * Dimension value this row covers. Null when no dimension was requested, empty when the dimension could not be derived for those events.
+ */
+ value?: string;
+ /**
+ * Start of the time bucket this row covers, in ISO 8601. Null when no interval was requested.
+ */
+ date?: string;
+ /**
+ * Unique visitors in the requested range.
+ */
+ visitors: number;
+ /**
+ * Unique sessions in the requested range.
+ */
+ sessions: number;
+ /**
+ * Total pageview events (events with name="pageview") in the requested range. Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ pageviews?: number;
+ /**
+ * Total events in the requested range.
+ */
+ events: number;
+ /**
+ * Total sessions with activity in the requested range. Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ visits?: number;
+ /**
+ * Share of single-event sessions, as a percentage. Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ bounceRate?: number;
+ /**
+ * Average session length in seconds, measured first event to last event. Single-event sessions count as 0. Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ visitDuration?: number;
+ /**
+ * Average pageviews per session (pageviews divided by visits). Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ viewsPerVisit?: number;
+ /**
+ * Average scroll depth across events, as a percentage. Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ scrollDepth?: number;
+ /**
+ * Average engaged time per session in seconds, counting only foreground time. Sessions that reported no engagement are excluded. Only the flat aggregate computes it; null on breakdown and time-series rows.
+ */
+ engagementTime?: number;
+ };
+
+ /**
+ * AnalyticsMetricList
+ */
+ export type AnalyticsMetricList = {
+ /**
+ * Total number of metric rows returned.
+ */
+ total: number;
+ /**
+ * Metric rows: one per time bucket, one per dimension value, or a single row for the flat aggregate.
+ */
+ metrics: AnalyticsMetric[];
+ };
+
+ /**
+ * AnalyticsProperty
+ */
+ export type AnalyticsProperty = {
+ /**
+ * Analytics property ID.
+ */
+ $id: string;
+ /**
+ * Property creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Property update date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * Human-readable name of the tracked website or application.
+ */
+ name: string;
+ /**
+ * Primary domain being tracked (e.g. example.com). May be empty for native apps.
+ */
+ domain: string;
+ /**
+ * Whether tracking is currently active.
+ */
+ enabled: boolean;
+ /**
+ * Whether stats for this property are publicly viewable.
+ */
+ public: boolean;
+ /**
+ * List of origins allowed to send tracking events. Use ["*"] to allow all.
+ */
+ allowedOrigins: string[];
+ /**
+ * Most recent event date in ISO 8601 format. This attribute is only updated again after 24 hours.
+ */
+ accessedAt: string;
+ /**
+ * First event date in ISO 8601 format. Empty until the property receives its first event.
+ */
+ firstAccessedAt: string;
+ };
+
/**
* Team
*/
@@ -9510,17 +9758,17 @@ export namespace Models {
*/
policyId: string;
/**
- * Archive size in bytes.
+ * Archive size in bytes. Null until the size is known.
*/
- size: number;
+ size?: number;
/**
* The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped.
*/
status: string;
/**
- * The backup start time.
+ * The backup start time. Null until the backup starts.
*/
- startedAt: string;
+ startedAt?: string;
/**
* Migration ID.
*/
@@ -9676,7 +9924,7 @@ export namespace Models {
/**
* Address line 2
*/
- addressLine2: string;
+ addressLine2?: string;
/**
* Address country
*/
@@ -9688,11 +9936,11 @@ export namespace Models {
/**
* state
*/
- state: string;
+ state?: string;
/**
* postal code
*/
- postalCode: string;
+ postalCode?: string;
};
/**
@@ -9898,9 +10146,9 @@ export namespace Models {
*/
alertLimit: number;
/**
- * Additional resources
+ * Additional resources. Null when the plan does not support usage billing.
*/
- usage: UsageBillingPlan;
+ usage?: UsageBillingPlan;
/**
* Addons
*/
@@ -10254,7 +10502,7 @@ export namespace Models {
/**
* Branch port. Null until the backing reports one.
*/
- port: number;
+ port?: number;
/**
* Advertised catalog the client connects to. MySQL/MariaDB use default; Postgres uses the routing label.
*/
@@ -10566,11 +10814,11 @@ export namespace Models {
/**
* Product API that owns this database: tablesdb, documentsdb, vectorsdb, mysql, postgresql, or mongodb.
*/
- api: string;
+ api?: string;
/**
* Database engine: postgresql, mysql, or mongodb. Null until the backing reports one.
*/
- engine: string;
+ engine?: string;
/**
* Database engine version.
*/
@@ -10590,7 +10838,7 @@ export namespace Models {
/**
* Database port for connections. Derived from the engine when the backing has not reported one yet.
*/
- connectionPort: number;
+ connectionPort?: number;
/**
* Database username for connections.
*/
@@ -10602,7 +10850,7 @@ export namespace Models {
/**
* Committed generation of the primary connection credentials. Null until the rotation contract has been initialized.
*/
- credentialGeneration: number;
+ credentialGeneration?: number;
/**
* Full database connection string (URI format).
*/
@@ -10816,7 +11064,7 @@ export namespace Models {
/**
* Source database ID when restoring a backup into another database.
*/
- sourceDatabaseId: string;
+ sourceDatabaseId?: string;
/**
* Project ID.
*/
@@ -10824,7 +11072,7 @@ export namespace Models {
/**
* Backup ID used for restoration (null for PITR).
*/
- backupId: string;
+ backupId?: string;
/**
* Restoration type. Possible values: backup (restore from a specific backup snapshot), pitr (point-in-time recovery to a specific timestamp).
*/
@@ -10836,15 +11084,15 @@ export namespace Models {
/**
* Target time for PITR restoration in ISO 8601 format.
*/
- targetTime: string;
+ targetTime?: string;
/**
* Restoration start time in ISO 8601 format.
*/
- startedAt: string;
+ startedAt?: string;
/**
* Restoration completion time in ISO 8601 format.
*/
- completedAt: string;
+ completedAt?: string;
/**
* Error message if restoration failed.
*/
@@ -10876,9 +11124,9 @@ export namespace Models {
*/
uptime: number;
/**
- * Connection statistics.
+ * Connection statistics. Null when the database has not been probed.
*/
- connections: DatabaseStatusConnections;
+ connections?: DatabaseStatusConnections;
/**
* Requested replication sync mode. Possible values: async, sync, quorum. Compare with effectiveSyncMode for what the primary is enforcing.
*/
@@ -11220,7 +11468,7 @@ export namespace Models {
/**
* Discount amount
*/
- discount: number;
+ discount?: number;
/**
* Credits amount
*/
@@ -11308,7 +11556,7 @@ export namespace Models {
/**
* Discount amount
*/
- discount: number;
+ discount?: number;
/**
* Credits amount
*/
@@ -11592,7 +11840,7 @@ export namespace Models {
/**
* Client secret for processing failed payments in front-end
*/
- clientSecret: string;
+ clientSecret?: string;
/**
* Invoice status
*/
@@ -11604,7 +11852,7 @@ export namespace Models {
/**
* Last payment error associated with the invoice
*/
- lastError: string;
+ lastError?: string;
/**
* Invoice due date.
*/
@@ -11683,6 +11931,96 @@ export namespace Models {
blocks: ManagerBlock[];
};
+ /**
+ * Threat
+ */
+ export type Threat = {
+ /**
+ * Threat ID.
+ */
+ $id: string;
+ /**
+ * Threat creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Threat update date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * ID of the project the resource belongs to.
+ */
+ projectId: string;
+ /**
+ * ID of the organization that owns the project.
+ */
+ teamId: string;
+ /**
+ * ID of the user the threat is attributed to. Not set yet.
+ */
+ userId: string;
+ /**
+ * Region of the project.
+ */
+ region: string;
+ /**
+ * Type of the flagged resource.
+ */
+ resourceType: string;
+ /**
+ * ID of the flagged resource.
+ */
+ resourceId: string;
+ /**
+ * Creation date of the flagged resource in ISO 8601 format. Empty for a manual threat, which names the resource without looking it up.
+ */
+ resourceCreatedAt: string;
+ /**
+ * How the threat was found. Possible values are `hash` (a file matched a known-bad signature), `analysis` (source analysis flagged a deployment), `scan` (the URL scanner flagged a hostname) or `manual` (recorded by an operator through the admin API).
+ */
+ type: string;
+ /**
+ * Triage status. Possible values are `open`, `resolved` or `dismissed`.
+ */
+ status: string;
+ /**
+ * What was found: the detector's summary, or the operator's words for a manual threat.
+ */
+ description: string;
+ /**
+ * ID of the console user who recorded the threat. Empty when a detector did.
+ */
+ createdBy: string;
+ /**
+ * The signature that matched. Used if type is `hash`.
+ */
+ hashSignature: string;
+ /**
+ * The analyser's classification of the finding, in snake case. Used if type is `analysis`.
+ */
+ analysisVerdict: string;
+ /**
+ * Paths of the files the finding is in. Used if type is `analysis`.
+ */
+ analysisFiles: string[];
+ /**
+ * Hostname the URL scanner flagged. Used if type is `scan`.
+ */
+ scanDomain: string;
+ /**
+ * The URL scanner's verdict. Possible values are `malicious` or `phishing`. Used if type is `scan`.
+ */
+ scanVerdict: string;
+ /**
+ * The URL scanner's severity. Possible values are `high` or `medium`. Used if type is `scan`.
+ */
+ scanSeverity: string;
+ /**
+ * ID of the URL scanner's report. Used if type is `scan`.
+ */
+ scanReportId: string;
+ };
+
/**
* Organization
*/
@@ -11740,15 +12078,15 @@ export namespace Models {
/**
* Billing cycle start date.
*/
- billingStartDate: string;
+ billingStartDate?: string;
/**
* Current invoice cycle start date.
*/
- billingCurrentInvoiceDate: string;
+ billingCurrentInvoiceDate?: string;
/**
* Next invoice cycle start date.
*/
- billingNextInvoiceDate: string;
+ billingNextInvoiceDate?: string;
/**
* Start date of trial.
*/
@@ -11756,19 +12094,19 @@ export namespace Models {
/**
* Number of trial days.
*/
- billingTrialDays: number;
+ billingTrialDays?: number;
/**
* Current active aggregation id.
*/
- billingAggregationId: string;
+ billingAggregationId?: string;
/**
* Current active aggregation id.
*/
- billingInvoiceId: string;
+ billingInvoiceId?: string;
/**
* Default payment method.
*/
- paymentMethodId: string;
+ paymentMethodId?: string;
/**
* Default payment method.
*/
@@ -11900,39 +12238,39 @@ export namespace Models {
/**
* Expiry month of the payment method.
*/
- expiryMonth: number;
+ expiryMonth?: number;
/**
* Expiry year of the payment method.
*/
- expiryYear: number;
+ expiryYear?: number;
/**
* Last 4 digit of the payment method
*/
- last4: string;
+ last4?: string;
/**
* Payment method brand
*/
- brand: string;
+ brand?: string;
/**
* Name of the owner
*/
- name: string;
+ name?: string;
/**
* Mandate ID of the payment method
*/
- mandateId: string;
+ mandateId?: string;
/**
* Country of the payment method
*/
- country: string;
+ country?: string;
/**
* State of the payment method
*/
- state: string;
+ state?: string;
/**
* Last payment error associated with the payment method.
*/
- lastError: string;
+ lastError?: string;
/**
* True when it's the default payment method.
*/
@@ -12316,9 +12654,9 @@ export namespace Models {
*/
status: string;
/**
- * The backup start time.
+ * The restoration start time. Null until the restoration starts.
*/
- startedAt: string;
+ startedAt?: string;
/**
* Migration ID.
*/
@@ -12332,9 +12670,9 @@ export namespace Models {
*/
resources: string[];
/**
- * Optional data in key-value object.
+ * Restoration options as a key-value object.
*/
- options: string;
+ options: object;
};
/**
@@ -12528,11 +12866,11 @@ export namespace Models {
/**
* Bandwidth additional resources
*/
- bandwidth: AdditionalResource;
+ bandwidth?: AdditionalResource;
/**
* Executions additional resources
*/
- executions: AdditionalResource;
+ executions?: AdditionalResource;
/**
* Member additional resources
*/
@@ -12540,11 +12878,11 @@ export namespace Models {
/**
* Realtime additional resources
*/
- realtime: AdditionalResource;
+ realtime?: AdditionalResource;
/**
* Realtime messages additional resources
*/
- realtimeMessages: AdditionalResource;
+ realtimeMessages?: AdditionalResource;
/**
* Realtime bandwidth additional resources
*/
@@ -12552,19 +12890,19 @@ export namespace Models {
/**
* Storage additional resources
*/
- storage: AdditionalResource;
+ storage?: AdditionalResource;
/**
* User additional resources
*/
- users: AdditionalResource;
+ users?: AdditionalResource;
/**
* GBHour additional resources
*/
- GBHours: AdditionalResource;
+ GBHours?: AdditionalResource;
/**
* Image transformation additional resources
*/
- imageTransformations: AdditionalResource;
+ imageTransformations?: AdditionalResource;
/**
* Credits additional resources
*/
@@ -12655,6 +12993,10 @@ export namespace Models {
* Aggregated stats for total backups storage.
*/
backupsStorageTotal: number;
+ /**
+ * Aggregated stats for total custom user photos storage.
+ */
+ avatarsStorageTotal: number;
/**
* Aggregated stats for total storage.
*/
@@ -13391,68 +13733,6 @@ export namespace Models {
expire: string;
};
- /**
- * WafRule
- */
- export type WafRule = {
- /**
- * Rule ID.
- */
- $id: string;
- /**
- * WAF rule creation time in ISO 8601 format.
- */
- $createdAt: string;
- /**
- * WAF rule last update time in ISO 8601 format.
- */
- $updatedAt: string;
- /**
- * Human friendly rule name.
- */
- name: string;
- /**
- * Optional description for the rule.
- */
- description: string;
- /**
- * Team ID.
- */
- teamId: string;
- /**
- * Project ID.
- */
- projectId: string;
- /**
- * Resource type the rule is scoped to.
- */
- resourceType: string;
- /**
- * Resource identifier. Empty for API-wide rules.
- */
- resourceId: string;
- /**
- * Action performed when the rule matches.
- */
- action: WafRuleAction;
- /**
- * Evaluation priority. Lower values execute earlier.
- */
- priority: number;
- /**
- * Whether the rule is active.
- */
- enabled: boolean;
- /**
- * List of conditions evaluated for this rule.
- */
- conditions: Record[];
- /**
- * Action specific configuration.
- */
- config: object;
- };
-
/**
* WafRuleBypass
*/
@@ -13814,7 +14094,13 @@ export namespace Models {
/**
* List of rules.
*/
- rules: WafRule[];
+ rules: (
+ | Models.WafRuleBypass
+ | Models.WafRuleDeny
+ | Models.WafRuleChallenge
+ | Models.WafRuleRateLimit
+ | Models.WafRuleRedirect
+ )[];
};
/**
@@ -13929,6 +14215,20 @@ export namespace Models {
addons: Addon[];
};
+ /**
+ * Analytics properties list
+ */
+ export type AnalyticsPropertyList = {
+ /**
+ * Total number of properties that matched your query.
+ */
+ total: number;
+ /**
+ * List of properties.
+ */
+ properties: AnalyticsProperty[];
+ };
+
/**
* Aggregation team list
*/
@@ -14041,6 +14341,20 @@ export namespace Models {
blocks: ManagerBlock[];
};
+ /**
+ * Threats list
+ */
+ export type ThreatList = {
+ /**
+ * Total number of threats that matched your query.
+ */
+ total: number;
+ /**
+ * List of threats.
+ */
+ threats: Threat[];
+ };
+
/**
* Database Migrations List
*/
diff --git a/src/service.ts b/src/service.ts
deleted file mode 100644
index f6020344..00000000
--- a/src/service.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Client } from './client';
-import type { Payload } from './client';
-
-export class Service {
- /**
- * The size for chunked uploads in bytes.
- */
- static CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
-
- client: Client;
-
- constructor(client: Client) {
- this.client = client;
- }
-
- static flatten(data: Payload, prefix = ''): Payload {
- let output: Payload = {};
-
- for (const [key, value] of Object.entries(data)) {
- const finalKey = prefix ? prefix + '[' + key + ']' : key;
- if (Array.isArray(value)) {
- output = { ...output, ...Service.flatten(value, finalKey) };
- } else {
- output[finalKey] = value;
- }
- }
-
- return output;
- }
-}
diff --git a/src/services/account.ts b/src/services/account.ts
index b931f045..09386127 100644
--- a/src/services/account.ts
+++ b/src/services/account.ts
@@ -1,5 +1,9 @@
-import { Service } from '../service';
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { AccountKeyScopes } from '../enums/account-key-scopes';
@@ -32,7 +36,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -141,7 +187,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -217,7 +305,33 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'billingAddressList',
+ models: {
+ billingAddressList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ billingAddresses: {
+ items: 'billingAddress',
+ },
+ },
+ },
+ billingAddress: {
+ defaults: {
+ $id: '',
+ userId: '',
+ streetAddress: '',
+ country: '',
+ city: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -355,7 +469,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'billingAddress',
+ models: {
+ billingAddress: {
+ defaults: {
+ $id: '',
+ userId: '',
+ streetAddress: '',
+ country: '',
+ city: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -416,7 +546,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'billingAddress',
+ models: {
+ billingAddress: {
+ defaults: {
+ $id: '',
+ userId: '',
+ streetAddress: '',
+ country: '',
+ city: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -574,7 +720,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'billingAddress',
+ models: {
+ billingAddress: {
+ defaults: {
+ $id: '',
+ userId: '',
+ streetAddress: '',
+ country: '',
+ city: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -703,7 +865,38 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2ConsentList',
+ models: {
+ oauth2ConsentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ consents: {
+ items: 'oauth2Consent',
+ },
+ },
+ },
+ oauth2Consent: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ appId: '',
+ cimdUrl: '',
+ scopes: [],
+ resources: [],
+ authorizationDetails: '[]',
+ expire: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -759,7 +952,28 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2Consent',
+ models: {
+ oauth2Consent: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ appId: '',
+ cimdUrl: '',
+ scopes: [],
+ resources: [],
+ authorizationDetails: '[]',
+ expire: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -898,7 +1112,39 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2ConsentTokenList',
+ models: {
+ oauth2ConsentTokenList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ tokens: {
+ items: 'oauth2ConsentToken',
+ },
+ },
+ },
+ oauth2ConsentToken: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ consentId: '',
+ userId: '',
+ appId: '',
+ cimdUrl: '',
+ scopes: [],
+ resources: [],
+ authorizationDetails: '[]',
+ expire: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -972,7 +1218,29 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2ConsentToken',
+ models: {
+ oauth2ConsentToken: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ consentId: '',
+ userId: '',
+ appId: '',
+ cimdUrl: '',
+ scopes: [],
+ resources: [],
+ authorizationDetails: '[]',
+ expire: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1100,7 +1368,25 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'coupon',
+ models: {
+ coupon: {
+ defaults: {
+ $id: '',
+ code: '',
+ credits: 0,
+ expiration: '',
+ campaign: '',
+ status: '',
+ onlyNewOrgs: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1184,7 +1470,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1253,7 +1581,39 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'identityList',
+ models: {
+ identityList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ identities: {
+ items: 'identity',
+ },
+ },
+ },
+ identity: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ provider: '',
+ providerUid: '',
+ providerEmail: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ providerIdToken: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1362,7 +1722,64 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'invoiceList',
+ models: {
+ invoiceList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ invoices: {
+ items: 'invoice',
+ },
+ },
+ },
+ invoice: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ teamId: '',
+ aggregationId: '',
+ plan: 'tier-0',
+ amount: 0,
+ tax: 0,
+ taxAmount: 0,
+ vat: 0,
+ vatAmount: 0,
+ grossAmount: 0,
+ creditsUsed: 0,
+ currency: 'USD',
+ status: '',
+ type: 'subscription',
+ from: '',
+ to: '',
+ },
+ properties: {
+ usage: {
+ items: 'usageResources',
+ },
+ },
+ },
+ usageResources: {
+ defaults: {
+ name: '',
+ value: 0,
+ amount: 0,
+ rate: 0,
+ desc: '',
+ resourceId: '',
+ type: '',
+ specification: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1415,7 +1832,19 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'jwt',
+ models: {
+ jwt: {
+ defaults: {
+ jwt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1467,7 +1896,36 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'keyList',
+ models: {
+ keyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ keys: {
+ items: 'key',
+ },
+ },
+ },
+ key: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ expire: '',
+ scopes: [],
+ secret: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1558,7 +2016,26 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'key',
+ models: {
+ key: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ expire: '',
+ scopes: [],
+ secret: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1610,7 +2087,26 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'key',
+ models: {
+ key: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ expire: '',
+ scopes: [],
+ secret: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1720,7 +2216,26 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'key',
+ models: {
+ key: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ expire: '',
+ scopes: [],
+ secret: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1834,7 +2349,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1893,7 +2450,20 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaType',
+ models: {
+ mfaType: {
+ defaults: {
+ secret: '',
+ uri: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1951,7 +2521,20 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaType',
+ models: {
+ mfaType: {
+ defaults: {
+ secret: '',
+ uri: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2032,7 +2615,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2112,7 +2737,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2286,7 +2953,22 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaChallenge',
+ models: {
+ mfaChallenge: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ expire: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2346,7 +3028,22 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaChallenge',
+ models: {
+ mfaChallenge: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ expire: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2424,7 +3121,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2501,7 +3238,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2521,7 +3298,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaFactors',
+ models: {
+ mfaFactors: {
+ defaults: {
+ totp: false,
+ phone: false,
+ email: false,
+ recoveryCode: false,
+ custom: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2540,7 +3333,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaFactors',
+ models: {
+ mfaFactors: {
+ defaults: {
+ totp: false,
+ phone: false,
+ email: false,
+ recoveryCode: false,
+ custom: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2560,7 +3369,19 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaRecoveryCodes',
+ models: {
+ mfaRecoveryCodes: {
+ defaults: {
+ recoveryCodes: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2579,7 +3400,19 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaRecoveryCodes',
+ models: {
+ mfaRecoveryCodes: {
+ defaults: {
+ recoveryCodes: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2600,7 +3433,19 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaRecoveryCodes',
+ models: {
+ mfaRecoveryCodes: {
+ defaults: {
+ recoveryCodes: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2620,38 +3465,575 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaRecoveryCodes',
+ models: {
+ mfaRecoveryCodes: {
+ defaults: {
+ recoveryCodes: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
+ */
+ updateMfaRecoveryCodes(): Promise {
+ const apiPath = '/account/mfa/recovery-codes';
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaRecoveryCodes',
+ models: {
+ mfaRecoveryCodes: {
+ defaults: {
+ recoveryCodes: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ updateMFARecoveryCodes(): Promise {
+ const apiPath = '/account/mfa/recovery-codes';
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'mfaRecoveryCodes',
+ models: {
+ mfaRecoveryCodes: {
+ defaults: {
+ recoveryCodes: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Update currently logged in user account name.
+ *
+ * @param {string} params.name - User name. Max length: 128 chars.
+ * @throws {AppwriteException}
+ * @returns {Promise>}
+ */
+ updateName<
+ Preferences extends Models.Preferences = Models.DefaultPreferences,
+ >(params: { name: string }): Promise>;
+ /**
+ * Update currently logged in user account name.
+ *
+ * @param {string} name - User name. Max length: 128 chars.
+ * @throws {AppwriteException}
+ * @returns {Promise>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ updateName<
+ Preferences extends Models.Preferences = Models.DefaultPreferences,
+ >(name: string): Promise>;
+ updateName<
+ Preferences extends Models.Preferences = Models.DefaultPreferences,
+ >(
+ paramsOrFirst: { name: string } | string,
+ ): Promise> {
+ let params: { name: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { name: string };
+ } else {
+ params = {
+ name: paramsOrFirst as string,
+ };
+ }
+
+ const name = params.name;
+
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+ const apiPath = '/account/name';
+ const apiPayload: Payload = {};
+ if (typeof name !== 'undefined') {
+ apiPayload['name'] = name;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Get the list of verified passkeys registered by the currently logged in user.
+ *
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter and order on the following attributes: $id, $createdAt, $updatedAt, name, accessedAt
+ * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ listPasskeys(params?: {
+ queries?: string[];
+ total?: boolean;
+ }): Promise;
+ /**
+ * Get the list of verified passkeys registered by the currently logged in user.
+ *
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter and order on the following attributes: $id, $createdAt, $updatedAt, name, accessedAt
+ * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ listPasskeys(
+ queries?: string[],
+ total?: boolean,
+ ): Promise;
+ listPasskeys(
+ paramsOrFirst?: { queries?: string[]; total?: boolean } | string[],
+ ...rest: [boolean?]
+ ): Promise {
+ let params: { queries?: string[]; total?: boolean };
+
+ if (
+ (typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
+ (paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst))
+ ) {
+ params = (paramsOrFirst || {}) as {
+ queries?: string[];
+ total?: boolean;
+ };
+ } else {
+ params = {
+ queries: paramsOrFirst as string[],
+ total: rest[0] as boolean,
+ };
+ }
+
+ const queries = params.queries;
+ const total = params.total;
+
+ const apiPath = '/account/passkeys';
+ const apiPayload: Payload = {};
+ if (typeof queries !== 'undefined') {
+ apiPayload['queries'] = queries;
+ }
+ if (typeof total !== 'undefined') {
+ apiPayload['total'] = total;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'passkeyList',
+ models: {
+ passkeyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ passkeys: {
+ items: 'passkey',
+ },
+ },
+ },
+ passkey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Start registering a passkey for the currently logged in user. The session must have signed in or completed an MFA challenge within the last 10 minutes. Pass the returned `publicKey` options to `navigator.credentials.create()`, then complete the registration with [Update passkey verification](/docs/references/cloud/client-web/account#updatePasskeyVerification). The passkey stays pending until verified, and the challenge expires after 5 minutes.
+ *
+ * @param {string} params.passkeyId - Passkey ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+ * @param {string} params.name - Passkey name, shown when listing passkeys. Max length: 128 chars.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ createPasskey(params?: {
+ passkeyId?: string;
+ name?: string;
+ }): Promise;
+ /**
+ * Start registering a passkey for the currently logged in user. The session must have signed in or completed an MFA challenge within the last 10 minutes. Pass the returned `publicKey` options to `navigator.credentials.create()`, then complete the registration with [Update passkey verification](/docs/references/cloud/client-web/account#updatePasskeyVerification). The passkey stays pending until verified, and the challenge expires after 5 minutes.
+ *
+ * @param {string} passkeyId - Passkey ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+ * @param {string} name - Passkey name, shown when listing passkeys. Max length: 128 chars.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ createPasskey(
+ passkeyId?: string,
+ name?: string,
+ ): Promise;
+ createPasskey(
+ paramsOrFirst?: { passkeyId?: string; name?: string } | string,
+ ...rest: [string?]
+ ): Promise {
+ let params: { passkeyId?: string; name?: string };
+
+ if (
+ (typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
+ (paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst))
+ ) {
+ params = (paramsOrFirst || {}) as {
+ passkeyId?: string;
+ name?: string;
+ };
+ } else {
+ params = {
+ passkeyId: paramsOrFirst as string,
+ name: rest[0] as string,
+ };
+ }
+
+ const passkeyId = params.passkeyId;
+ const name = params.name;
+
+ const apiPath = '/account/passkeys';
+ const apiPayload: Payload = {};
+ if (typeof passkeyId !== 'undefined') {
+ apiPayload['passkeyId'] = passkeyId;
+ }
+ if (typeof name !== 'undefined') {
+ apiPayload['name'] = name;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'passkeyChallenge',
+ models: {
+ passkeyChallenge: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ passkeyId: '',
+ expire: '',
+ publicKey: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Get a verified passkey of the currently logged in user by its unique ID.
+ *
+ * @param {string} params.passkeyId - Passkey ID.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ getPasskey(params: { passkeyId: string }): Promise;
+ /**
+ * Get a verified passkey of the currently logged in user by its unique ID.
+ *
+ * @param {string} passkeyId - Passkey ID.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ getPasskey(passkeyId: string): Promise;
+ getPasskey(
+ paramsOrFirst: { passkeyId: string } | string,
+ ): Promise {
+ let params: { passkeyId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { passkeyId: string };
+ } else {
+ params = {
+ passkeyId: paramsOrFirst as string,
+ };
+ }
+
+ const passkeyId = params.passkeyId;
+
+ if (typeof passkeyId === 'undefined' || passkeyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "passkeyId"',
+ );
+ }
+ const apiPath = '/account/passkeys/{passkeyId}'.replace(
+ '{passkeyId}',
+ encodeURIComponent(String(passkeyId)),
+ );
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'passkey',
+ models: {
+ passkey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Rename a passkey of the currently logged in user.
+ *
+ * @param {string} params.passkeyId - Passkey ID.
+ * @param {string} params.name - Passkey name. Max length: 128 chars.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ updatePasskey(params: {
+ passkeyId: string;
+ name: string;
+ }): Promise;
+ /**
+ * Rename a passkey of the currently logged in user.
+ *
+ * @param {string} passkeyId - Passkey ID.
+ * @param {string} name - Passkey name. Max length: 128 chars.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ updatePasskey(passkeyId: string, name: string): Promise;
+ updatePasskey(
+ paramsOrFirst: { passkeyId: string; name: string } | string,
+ ...rest: [string?]
+ ): Promise {
+ let params: { passkeyId: string; name: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ passkeyId: string;
+ name: string;
+ };
+ } else {
+ params = {
+ passkeyId: paramsOrFirst as string,
+ name: rest[0] as string,
+ };
+ }
+
+ const passkeyId = params.passkeyId;
+ const name = params.name;
+
+ if (typeof passkeyId === 'undefined' || passkeyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "passkeyId"',
+ );
+ }
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+ const apiPath = '/account/passkeys/{passkeyId}'.replace(
+ '{passkeyId}',
+ encodeURIComponent(String(passkeyId)),
+ );
+ const apiPayload: Payload = {};
+ if (typeof name !== 'undefined') {
+ apiPayload['name'] = name;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'passkey',
+ models: {
+ passkey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
- * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
+ * Delete a passkey from the currently logged in user. The passkey can no longer be used to sign in, although it may remain stored on the user's device. The session must have signed in or completed an MFA challenge within the last 10 minutes.
*
+ * @param {string} params.passkeyId - Passkey ID.
* @throws {AppwriteException}
- * @returns {Promise}
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
+ * @returns {Promise<{}>}
*/
- updateMfaRecoveryCodes(): Promise {
- const apiPath = '/account/mfa/recovery-codes';
- const apiPayload: Payload = {};
- const uri = new URL(this.client.config.endpoint + apiPath);
-
- const apiHeaders: { [header: string]: string } = {
- 'X-Appwrite-Project': this.client.config.project,
- 'content-type': 'application/json',
- accept: 'application/json',
- };
-
- return this.client.call('patch', uri, apiHeaders, apiPayload);
- }
-
+ deletePasskey(params: { passkeyId: string }): Promise<{}>;
/**
- * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
+ * Delete a passkey from the currently logged in user. The passkey can no longer be used to sign in, although it may remain stored on the user's device. The session must have signed in or completed an MFA challenge within the last 10 minutes.
*
+ * @param {string} passkeyId - Passkey ID.
* @throws {AppwriteException}
- * @returns {Promise}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
*/
- updateMFARecoveryCodes(): Promise {
- const apiPath = '/account/mfa/recovery-codes';
+ deletePasskey(passkeyId: string): Promise<{}>;
+ deletePasskey(paramsOrFirst: { passkeyId: string } | string): Promise<{}> {
+ let params: { passkeyId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { passkeyId: string };
+ } else {
+ params = {
+ passkeyId: paramsOrFirst as string,
+ };
+ }
+
+ const passkeyId = params.passkeyId;
+
+ if (typeof passkeyId === 'undefined' || passkeyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "passkeyId"',
+ );
+ }
+ const apiPath = '/account/passkeys/{passkeyId}'.replace(
+ '{passkeyId}',
+ encodeURIComponent(String(passkeyId)),
+ );
const apiPayload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
@@ -2661,58 +4043,76 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
}
/**
- * Update currently logged in user account name.
+ * Complete a passkey registration started with [Create passkey](/docs/references/cloud/client-web/account#createPasskey). Pass the JSON form of the credential returned by `navigator.credentials.create()`, for example `credential.toJSON()`. Each registration can be verified once; a failed attempt requires starting it again.
*
- * @param {string} params.name - User name. Max length: 128 chars.
+ * @param {string} params.passkeyId - Passkey ID.
+ * @param {object} params.credential - Registration credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`.
* @throws {AppwriteException}
- * @returns {Promise>}
+ * @returns {Promise}
*/
- updateName<
- Preferences extends Models.Preferences = Models.DefaultPreferences,
- >(params: { name: string }): Promise>;
+ updatePasskeyVerification(params: {
+ passkeyId: string;
+ credential: object;
+ }): Promise;
/**
- * Update currently logged in user account name.
+ * Complete a passkey registration started with [Create passkey](/docs/references/cloud/client-web/account#createPasskey). Pass the JSON form of the credential returned by `navigator.credentials.create()`, for example `credential.toJSON()`. Each registration can be verified once; a failed attempt requires starting it again.
*
- * @param {string} name - User name. Max length: 128 chars.
+ * @param {string} passkeyId - Passkey ID.
+ * @param {object} credential - Registration credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`.
* @throws {AppwriteException}
- * @returns {Promise>}
+ * @returns {Promise}
* @deprecated Use the object parameter style method for a better developer experience.
*/
- updateName<
- Preferences extends Models.Preferences = Models.DefaultPreferences,
- >(name: string): Promise>;
- updateName<
- Preferences extends Models.Preferences = Models.DefaultPreferences,
- >(
- paramsOrFirst: { name: string } | string,
- ): Promise> {
- let params: { name: string };
+ updatePasskeyVerification(
+ passkeyId: string,
+ credential: object,
+ ): Promise;
+ updatePasskeyVerification(
+ paramsOrFirst: { passkeyId: string; credential: object } | string,
+ ...rest: [object?]
+ ): Promise {
+ let params: { passkeyId: string; credential: object };
if (
paramsOrFirst &&
typeof paramsOrFirst === 'object' &&
!Array.isArray(paramsOrFirst)
) {
- params = (paramsOrFirst || {}) as { name: string };
+ params = (paramsOrFirst || {}) as {
+ passkeyId: string;
+ credential: object;
+ };
} else {
params = {
- name: paramsOrFirst as string,
+ passkeyId: paramsOrFirst as string,
+ credential: rest[0] as object,
};
}
- const name = params.name;
+ const passkeyId = params.passkeyId;
+ const credential = params.credential;
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
+ if (typeof passkeyId === 'undefined' || passkeyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "passkeyId"',
+ );
}
- const apiPath = '/account/name';
+ if (typeof credential === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "credential"',
+ );
+ }
+ const apiPath = '/account/passkeys/{passkeyId}/verification'.replace(
+ '{passkeyId}',
+ encodeURIComponent(String(passkeyId)),
+ );
const apiPayload: Payload = {};
- if (typeof name !== 'undefined') {
- apiPayload['name'] = name;
+ if (typeof credential !== 'undefined') {
+ apiPayload['credential'] = credential;
}
const uri = new URL(this.client.config.endpoint + apiPath);
@@ -2722,7 +4122,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'passkey',
+ models: {
+ passkey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ accessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2802,7 +4218,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2856,7 +4314,37 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'paymentMethodList',
+ models: {
+ paymentMethodList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ paymentMethods: {
+ items: 'paymentMethod',
+ },
+ },
+ },
+ paymentMethod: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ providerMethodId: '',
+ clientSecret: '',
+ providerUserId: '',
+ userId: '',
+ default: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2876,7 +4364,27 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'paymentMethod',
+ models: {
+ paymentMethod: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ providerMethodId: '',
+ clientSecret: '',
+ providerUserId: '',
+ userId: '',
+ default: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2934,7 +4442,27 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'paymentMethod',
+ models: {
+ paymentMethod: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ providerMethodId: '',
+ clientSecret: '',
+ providerUserId: '',
+ userId: '',
+ default: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3050,7 +4578,27 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'paymentMethod',
+ models: {
+ paymentMethod: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ providerMethodId: '',
+ clientSecret: '',
+ providerUserId: '',
+ userId: '',
+ default: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3222,7 +4770,27 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'paymentMethod',
+ models: {
+ paymentMethod: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ providerMethodId: '',
+ clientSecret: '',
+ providerUserId: '',
+ userId: '',
+ default: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3284,7 +4852,27 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'paymentMethod',
+ models: {
+ paymentMethod: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ $permissions: [],
+ providerMethodId: '',
+ clientSecret: '',
+ providerUserId: '',
+ userId: '',
+ default: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3364,7 +4952,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3449,7 +5079,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3518,7 +5190,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3613,7 +5302,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3688,7 +5394,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3781,7 +5504,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3833,7 +5573,57 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'sessionList',
+ models: {
+ sessionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ sessions: {
+ items: 'session',
+ },
+ },
+ },
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3906,7 +5696,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3998,7 +5828,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4161,7 +6031,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4237,7 +6147,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4252,6 +6202,7 @@ export class Account {
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
+ * @param {string} params.state - An opaque value your app generates and keeps, for example in a cookie. It is returned unchanged as the `state` query parameter on the success and failure URLs, so your app can check that the sign-in it receives is one it started. Printable ASCII only (RFC 6749 Appendix A.5). Max length: 256 chars.
* @throws {AppwriteException}
* @returns {void | string}
*/
@@ -4260,6 +6211,7 @@ export class Account {
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
}): void | string;
/**
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
@@ -4273,6 +6225,7 @@ export class Account {
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
+ * @param {string} state - An opaque value your app generates and keeps, for example in a cookie. It is returned unchanged as the `state` query parameter on the success and failure URLs, so your app can check that the sign-in it receives is one it started. Printable ASCII only (RFC 6749 Appendix A.5). Max length: 256 chars.
* @throws {AppwriteException}
* @returns {void | string}
* @deprecated Use the object parameter style method for a better developer experience.
@@ -4282,6 +6235,7 @@ export class Account {
success?: string,
failure?: string,
scopes?: string[],
+ state?: string,
): void | string;
createOAuth2Session(
paramsOrFirst:
@@ -4290,15 +6244,17 @@ export class Account {
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
}
| OAuthProvider,
- ...rest: [string?, string?, string[]?]
+ ...rest: [string?, string?, string[]?, string?]
): void | string {
let params: {
provider: OAuthProvider;
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
};
if (
@@ -4308,13 +6264,15 @@ export class Account {
('provider' in paramsOrFirst ||
'success' in paramsOrFirst ||
'failure' in paramsOrFirst ||
- 'scopes' in paramsOrFirst)
+ 'scopes' in paramsOrFirst ||
+ 'state' in paramsOrFirst)
) {
params = (paramsOrFirst || {}) as {
provider: OAuthProvider;
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
};
} else {
params = {
@@ -4322,6 +6280,7 @@ export class Account {
success: rest[0] as string,
failure: rest[1] as string,
scopes: rest[2] as string[],
+ state: rest[3] as string,
};
}
@@ -4329,6 +6288,7 @@ export class Account {
const success = params.success;
const failure = params.failure;
const scopes = params.scopes;
+ const state = params.state;
if (typeof provider === 'undefined') {
throw new AppwriteException(
@@ -4349,13 +6309,14 @@ export class Account {
if (typeof scopes !== 'undefined') {
apiPayload['scopes'] = scopes;
}
+ if (typeof state !== 'undefined') {
+ apiPayload['state'] = state;
+ }
const uri = new URL(this.client.config.endpoint + apiPath);
apiPayload['project'] = this.client.config.project;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -4437,7 +6398,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4509,7 +6510,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4565,7 +6606,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4622,7 +6703,47 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'session',
+ models: {
+ session: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ expire: '',
+ provider: '',
+ providerUid: '',
+ providerAccessToken: '',
+ providerAccessTokenExpiry: '',
+ providerRefreshToken: '',
+ ip: '',
+ osCode: '',
+ osName: '',
+ osVersion: '',
+ clientType: '',
+ clientCode: '',
+ clientName: '',
+ clientVersion: '',
+ clientEngine: '',
+ clientEngineVersion: '',
+ deviceName: '',
+ deviceBrand: '',
+ deviceModel: '',
+ countryCode: '',
+ countryName: '',
+ current: false,
+ factors: [],
+ secret: '',
+ mfaUpdatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4699,7 +6820,49 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4794,7 +6957,26 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'target',
+ models: {
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4873,7 +7055,26 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'target',
+ models: {
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5022,7 +7223,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5130,7 +7348,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5146,6 +7381,7 @@ export class Account {
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
+ * @param {string} params.state - An opaque value your app generates and keeps, for example in a cookie. It is returned unchanged as the `state` query parameter on the success and failure URLs, so your app can check that the sign-in it receives is one it started. Printable ASCII only (RFC 6749 Appendix A.5). Max length: 256 chars.
* @throws {AppwriteException}
* @returns {void | string}
*/
@@ -5154,6 +7390,7 @@ export class Account {
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
}): void | string;
/**
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
@@ -5168,6 +7405,7 @@ export class Account {
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
+ * @param {string} state - An opaque value your app generates and keeps, for example in a cookie. It is returned unchanged as the `state` query parameter on the success and failure URLs, so your app can check that the sign-in it receives is one it started. Printable ASCII only (RFC 6749 Appendix A.5). Max length: 256 chars.
* @throws {AppwriteException}
* @returns {void | string}
* @deprecated Use the object parameter style method for a better developer experience.
@@ -5177,6 +7415,7 @@ export class Account {
success?: string,
failure?: string,
scopes?: string[],
+ state?: string,
): void | string;
createOAuth2Token(
paramsOrFirst:
@@ -5185,15 +7424,17 @@ export class Account {
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
}
| OAuthProvider,
- ...rest: [string?, string?, string[]?]
+ ...rest: [string?, string?, string[]?, string?]
): void | string {
let params: {
provider: OAuthProvider;
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
};
if (
@@ -5203,13 +7444,15 @@ export class Account {
('provider' in paramsOrFirst ||
'success' in paramsOrFirst ||
'failure' in paramsOrFirst ||
- 'scopes' in paramsOrFirst)
+ 'scopes' in paramsOrFirst ||
+ 'state' in paramsOrFirst)
) {
params = (paramsOrFirst || {}) as {
provider: OAuthProvider;
success?: string;
failure?: string;
scopes?: string[];
+ state?: string;
};
} else {
params = {
@@ -5217,6 +7460,7 @@ export class Account {
success: rest[0] as string,
failure: rest[1] as string,
scopes: rest[2] as string[],
+ state: rest[3] as string,
};
}
@@ -5224,6 +7468,7 @@ export class Account {
const success = params.success;
const failure = params.failure;
const scopes = params.scopes;
+ const state = params.state;
if (typeof provider === 'undefined') {
throw new AppwriteException(
@@ -5244,13 +7489,14 @@ export class Account {
if (typeof scopes !== 'undefined') {
apiPayload['scopes'] = scopes;
}
+ if (typeof state !== 'undefined') {
+ apiPayload['state'] = state;
+ }
const uri = new URL(this.client.config.endpoint + apiPath);
apiPayload['project'] = this.client.config.project;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -5262,6 +7508,138 @@ export class Account {
}
}
+ /**
+ * Start signing in with a passkey. No email or user ID is needed: pass the returned `publicKey` options to `navigator.credentials.get()` and the user picks one of their passkeys. Then call [Update passkey token](/docs/references/cloud/client-web/account#updatePasskeyToken) with the credential to receive a token, and exchange it with [Create session](/docs/references/cloud/client-web/account#createSession). The challenge expires after 5 minutes.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ createPasskeyToken(): Promise {
+ const apiPath = '/account/tokens/passkey';
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'passkeyChallenge',
+ models: {
+ passkeyChallenge: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ passkeyId: '',
+ expire: '',
+ publicKey: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Complete a passkey sign-in started with [Create passkey token](/docs/references/cloud/client-web/account#createPasskeyToken). Pass the challenge ID and the JSON form of the credential returned by `navigator.credentials.get()`, for example `credential.toJSON()`. The returned token includes its secret and expires after 1 minute: exchange it for a session with [Create session](/docs/references/cloud/client-web/account#createSession). Passkeys require user verification, so the session also satisfies MFA. Each challenge can only be used once.
+ *
+ * @param {string} params.challengeId - Challenge ID returned by createPasskeyToken.
+ * @param {object} params.credential - Authentication credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ updatePasskeyToken(params: {
+ challengeId: string;
+ credential: object;
+ }): Promise;
+ /**
+ * Complete a passkey sign-in started with [Create passkey token](/docs/references/cloud/client-web/account#createPasskeyToken). Pass the challenge ID and the JSON form of the credential returned by `navigator.credentials.get()`, for example `credential.toJSON()`. The returned token includes its secret and expires after 1 minute: exchange it for a session with [Create session](/docs/references/cloud/client-web/account#createSession). Passkeys require user verification, so the session also satisfies MFA. Each challenge can only be used once.
+ *
+ * @param {string} challengeId - Challenge ID returned by createPasskeyToken.
+ * @param {object} credential - Authentication credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ updatePasskeyToken(
+ challengeId: string,
+ credential: object,
+ ): Promise;
+ updatePasskeyToken(
+ paramsOrFirst: { challengeId: string; credential: object } | string,
+ ...rest: [object?]
+ ): Promise {
+ let params: { challengeId: string; credential: object };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ challengeId: string;
+ credential: object;
+ };
+ } else {
+ params = {
+ challengeId: paramsOrFirst as string,
+ credential: rest[0] as object,
+ };
+ }
+
+ const challengeId = params.challengeId;
+ const credential = params.credential;
+
+ if (typeof challengeId === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "challengeId"',
+ );
+ }
+ if (typeof credential === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "credential"',
+ );
+ }
+ const apiPath = '/account/tokens/passkey';
+ const apiPayload: Payload = {};
+ if (typeof challengeId !== 'undefined') {
+ apiPayload['challengeId'] = challengeId;
+ }
+ if (typeof credential !== 'undefined') {
+ apiPayload['credential'] = credential;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'tokenSecret',
+ models: {
+ tokenSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
/**
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
*
@@ -5332,7 +7710,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5393,7 +7788,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5455,7 +7867,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5530,7 +7959,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5603,7 +8049,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5664,7 +8127,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5741,7 +8221,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5761,7 +8258,24 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5836,6 +8350,23 @@ export class Account {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'token',
+ models: {
+ token: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ userId: '',
+ secret: '',
+ expire: '',
+ phrase: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/activities.ts b/src/services/activities.ts
index 9c9ca8bd..f075fd9e 100644
--- a/src/services/activities.ts
+++ b/src/services/activities.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Activities {
@@ -59,7 +64,57 @@ export class Activities {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'activityEventList',
+ models: {
+ activityEventList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ events: {
+ items: 'activityEvent',
+ },
+ },
+ },
+ activityEvent: {
+ defaults: {
+ $id: '',
+ actorType: '',
+ actorId: '',
+ actorEmail: '',
+ actorName: '',
+ resourceParent: '',
+ resourceType: '',
+ resourceId: '',
+ resource: '',
+ event: '',
+ userAgent: '',
+ ip: '',
+ mode: '',
+ country: '',
+ continentCode: '',
+ city: '',
+ subdivisions: '',
+ isp: '',
+ autonomousSystemNumber: '',
+ autonomousSystemOrganization: '',
+ connectionType: '',
+ connectionUsageType: '',
+ connectionOrganization: '',
+ time: '',
+ projectId: '',
+ teamId: '',
+ hostname: '',
+ sdk: '',
+ sdkVersion: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -117,6 +172,46 @@ export class Activities {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'activityEvent',
+ models: {
+ activityEvent: {
+ defaults: {
+ $id: '',
+ actorType: '',
+ actorId: '',
+ actorEmail: '',
+ actorName: '',
+ resourceParent: '',
+ resourceType: '',
+ resourceId: '',
+ resource: '',
+ event: '',
+ userAgent: '',
+ ip: '',
+ mode: '',
+ country: '',
+ continentCode: '',
+ city: '',
+ subdivisions: '',
+ isp: '',
+ autonomousSystemNumber: '',
+ autonomousSystemOrganization: '',
+ connectionType: '',
+ connectionUsageType: '',
+ connectionOrganization: '',
+ time: '',
+ projectId: '',
+ teamId: '',
+ hostname: '',
+ sdk: '',
+ sdkVersion: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/admin.ts b/src/services/admin.ts
new file mode 100644
index 00000000..cce40e91
--- /dev/null
+++ b/src/services/admin.ts
@@ -0,0 +1,795 @@
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
+import type { Models } from '../models';
+
+import { PlatformResourceType } from '../enums/platform-resource-type';
+import { ProjectResourceType } from '../enums/project-resource-type';
+import { ThreatResourceType } from '../enums/threat-resource-type';
+import { ThreatStatus } from '../enums/threat-status';
+export class Admin {
+ client: Client;
+
+ constructor(client: Client) {
+ this.client = client;
+ }
+
+ /**
+ * Delete everything cached from the platform database in the region serving the request.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ deletePlatformCache(): Promise<{}> {
+ const apiPath = '/admin/cache/platform';
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * Delete the cache of one platform resource, or of every resource of a type, in the region serving the request.
+ *
+ * @param {PlatformResourceType} params.resourceType - Resource type.
+ * @param {string} params.resourceId - Resource ID. Leave empty to delete the cache of every resource of this type.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ deletePlatformResourceCache(params: {
+ resourceType: PlatformResourceType;
+ resourceId?: string;
+ }): Promise<{}>;
+ /**
+ * Delete the cache of one platform resource, or of every resource of a type, in the region serving the request.
+ *
+ * @param {PlatformResourceType} resourceType - Resource type.
+ * @param {string} resourceId - Resource ID. Leave empty to delete the cache of every resource of this type.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ deletePlatformResourceCache(
+ resourceType: PlatformResourceType,
+ resourceId?: string,
+ ): Promise<{}>;
+ deletePlatformResourceCache(
+ paramsOrFirst:
+ | { resourceType: PlatformResourceType; resourceId?: string }
+ | PlatformResourceType,
+ ...rest: [string?]
+ ): Promise<{}> {
+ let params: { resourceType: PlatformResourceType; resourceId?: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst) &&
+ ('resourceType' in paramsOrFirst || 'resourceId' in paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ resourceType: PlatformResourceType;
+ resourceId?: string;
+ };
+ } else {
+ params = {
+ resourceType: paramsOrFirst as PlatformResourceType,
+ resourceId: rest[0] as string,
+ };
+ }
+
+ const resourceType = params.resourceType;
+ const resourceId = params.resourceId;
+
+ if (typeof resourceType === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "resourceType"',
+ );
+ }
+ const apiPath = '/admin/cache/platform/resources';
+ const apiPayload: Payload = {};
+ if (typeof resourceType !== 'undefined') {
+ apiPayload['resourceType'] = resourceType;
+ }
+ if (typeof resourceId !== 'undefined') {
+ apiPayload['resourceId'] = resourceId;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * Delete everything cached for a project. Send the request to the project's region.
+ *
+ * @param {string} params.projectId - Project ID.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ deleteProjectCache(params: { projectId: string }): Promise<{}>;
+ /**
+ * Delete everything cached for a project. Send the request to the project's region.
+ *
+ * @param {string} projectId - Project ID.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ deleteProjectCache(projectId: string): Promise<{}>;
+ deleteProjectCache(
+ paramsOrFirst: { projectId: string } | string,
+ ): Promise<{}> {
+ let params: { projectId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { projectId: string };
+ } else {
+ params = {
+ projectId: paramsOrFirst as string,
+ };
+ }
+
+ const projectId = params.projectId;
+
+ if (typeof projectId === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "projectId"',
+ );
+ }
+ const apiPath = '/admin/cache/project';
+ const apiPayload: Payload = {};
+ if (typeof projectId !== 'undefined') {
+ apiPayload['projectId'] = projectId;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * Delete the cache of one project resource, or of every resource of a type. Send the request to the project's region.
+ *
+ * @param {string} params.projectId - Project ID.
+ * @param {ProjectResourceType} params.resourceType - Resource type.
+ * @param {string} params.resourceId - Resource ID. Leave empty to delete the cache of every resource of this type.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ deleteProjectResourceCache(params: {
+ projectId: string;
+ resourceType: ProjectResourceType;
+ resourceId?: string;
+ }): Promise<{}>;
+ /**
+ * Delete the cache of one project resource, or of every resource of a type. Send the request to the project's region.
+ *
+ * @param {string} projectId - Project ID.
+ * @param {ProjectResourceType} resourceType - Resource type.
+ * @param {string} resourceId - Resource ID. Leave empty to delete the cache of every resource of this type.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ deleteProjectResourceCache(
+ projectId: string,
+ resourceType: ProjectResourceType,
+ resourceId?: string,
+ ): Promise<{}>;
+ deleteProjectResourceCache(
+ paramsOrFirst:
+ | {
+ projectId: string;
+ resourceType: ProjectResourceType;
+ resourceId?: string;
+ }
+ | string,
+ ...rest: [ProjectResourceType?, string?]
+ ): Promise<{}> {
+ let params: {
+ projectId: string;
+ resourceType: ProjectResourceType;
+ resourceId?: string;
+ };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ projectId: string;
+ resourceType: ProjectResourceType;
+ resourceId?: string;
+ };
+ } else {
+ params = {
+ projectId: paramsOrFirst as string,
+ resourceType: rest[0] as ProjectResourceType,
+ resourceId: rest[1] as string,
+ };
+ }
+
+ const projectId = params.projectId;
+ const resourceType = params.resourceType;
+ const resourceId = params.resourceId;
+
+ if (typeof projectId === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "projectId"',
+ );
+ }
+ if (typeof resourceType === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "resourceType"',
+ );
+ }
+ const apiPath = '/admin/cache/project/resources';
+ const apiPayload: Payload = {};
+ if (typeof projectId !== 'undefined') {
+ apiPayload['projectId'] = projectId;
+ }
+ if (typeof resourceType !== 'undefined') {
+ apiPayload['resourceType'] = resourceType;
+ }
+ if (typeof resourceId !== 'undefined') {
+ apiPayload['resourceId'] = resourceId;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * List threats recorded across the platform. Use queries to narrow the list to a project, a resource type, a threat type or a triage status.
+ *
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: projectId, teamId, region, resourceType, resourceId, type, status
+ * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ listThreats(params?: {
+ queries?: string[];
+ total?: boolean;
+ }): Promise;
+ /**
+ * List threats recorded across the platform. Use queries to narrow the list to a project, a resource type, a threat type or a triage status.
+ *
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: projectId, teamId, region, resourceType, resourceId, type, status
+ * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ listThreats(
+ queries?: string[],
+ total?: boolean,
+ ): Promise;
+ listThreats(
+ paramsOrFirst?: { queries?: string[]; total?: boolean } | string[],
+ ...rest: [boolean?]
+ ): Promise {
+ let params: { queries?: string[]; total?: boolean };
+
+ if (
+ (typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
+ (paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst))
+ ) {
+ params = (paramsOrFirst || {}) as {
+ queries?: string[];
+ total?: boolean;
+ };
+ } else {
+ params = {
+ queries: paramsOrFirst as string[],
+ total: rest[0] as boolean,
+ };
+ }
+
+ const queries = params.queries;
+ const total = params.total;
+
+ const apiPath = '/admin/threats';
+ const apiPayload: Payload = {};
+ if (typeof queries !== 'undefined') {
+ apiPayload['queries'] = queries;
+ }
+ if (typeof total !== 'undefined') {
+ apiPayload['total'] = total;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'threatList',
+ models: {
+ threatList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ threats: {
+ items: 'threat',
+ },
+ },
+ },
+ threat: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ teamId: '',
+ userId: '',
+ region: '',
+ resourceType: '',
+ resourceId: '',
+ resourceCreatedAt: '',
+ type: '',
+ status: 'open',
+ description: '',
+ createdBy: '',
+ hashSignature: '',
+ analysisVerdict: '',
+ analysisFiles: [],
+ scanDomain: '',
+ scanVerdict: '',
+ scanSeverity: '',
+ scanReportId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Record a threat an operator found on a project resource. The record is of type `manual`; the other types are written by the threats worker's detectors.
+ *
+ * @param {string} params.projectId - Project ID.
+ * @param {ThreatResourceType} params.resourceType - Type of the flagged resource.
+ * @param {string} params.resourceId - ID of the flagged resource.
+ * @param {string} params.description - What was found, in the operator's words.
+ * @param {ThreatStatus} params.status - Triage status to record the threat with. `open` by default; `resolved` or `dismissed` for a threat already dealt with.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ createThreat(params: {
+ projectId: string;
+ resourceType: ThreatResourceType;
+ resourceId: string;
+ description?: string;
+ status?: ThreatStatus;
+ }): Promise;
+ /**
+ * Record a threat an operator found on a project resource. The record is of type `manual`; the other types are written by the threats worker's detectors.
+ *
+ * @param {string} projectId - Project ID.
+ * @param {ThreatResourceType} resourceType - Type of the flagged resource.
+ * @param {string} resourceId - ID of the flagged resource.
+ * @param {string} description - What was found, in the operator's words.
+ * @param {ThreatStatus} status - Triage status to record the threat with. `open` by default; `resolved` or `dismissed` for a threat already dealt with.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ createThreat(
+ projectId: string,
+ resourceType: ThreatResourceType,
+ resourceId: string,
+ description?: string,
+ status?: ThreatStatus,
+ ): Promise;
+ createThreat(
+ paramsOrFirst:
+ | {
+ projectId: string;
+ resourceType: ThreatResourceType;
+ resourceId: string;
+ description?: string;
+ status?: ThreatStatus;
+ }
+ | string,
+ ...rest: [ThreatResourceType?, string?, string?, ThreatStatus?]
+ ): Promise {
+ let params: {
+ projectId: string;
+ resourceType: ThreatResourceType;
+ resourceId: string;
+ description?: string;
+ status?: ThreatStatus;
+ };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ projectId: string;
+ resourceType: ThreatResourceType;
+ resourceId: string;
+ description?: string;
+ status?: ThreatStatus;
+ };
+ } else {
+ params = {
+ projectId: paramsOrFirst as string,
+ resourceType: rest[0] as ThreatResourceType,
+ resourceId: rest[1] as string,
+ description: rest[2] as string,
+ status: rest[3] as ThreatStatus,
+ };
+ }
+
+ const projectId = params.projectId;
+ const resourceType = params.resourceType;
+ const resourceId = params.resourceId;
+ const description = params.description;
+ const status = params.status;
+
+ if (typeof projectId === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "projectId"',
+ );
+ }
+ if (typeof resourceType === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "resourceType"',
+ );
+ }
+ if (typeof resourceId === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "resourceId"',
+ );
+ }
+ const apiPath = '/admin/threats';
+ const apiPayload: Payload = {};
+ if (typeof projectId !== 'undefined') {
+ apiPayload['projectId'] = projectId;
+ }
+ if (typeof resourceType !== 'undefined') {
+ apiPayload['resourceType'] = resourceType;
+ }
+ if (typeof resourceId !== 'undefined') {
+ apiPayload['resourceId'] = resourceId;
+ }
+ if (typeof description !== 'undefined') {
+ apiPayload['description'] = description;
+ }
+ if (typeof status !== 'undefined') {
+ apiPayload['status'] = status;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'threat',
+ models: {
+ threat: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ teamId: '',
+ userId: '',
+ region: '',
+ resourceType: '',
+ resourceId: '',
+ resourceCreatedAt: '',
+ type: '',
+ status: 'open',
+ description: '',
+ createdBy: '',
+ hashSignature: '',
+ analysisVerdict: '',
+ analysisFiles: [],
+ scanDomain: '',
+ scanVerdict: '',
+ scanSeverity: '',
+ scanReportId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Get a threat by its unique ID, including the detection details.
+ *
+ * @param {string} params.threatId - Threat ID.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ getThreat(params: { threatId: string }): Promise;
+ /**
+ * Get a threat by its unique ID, including the detection details.
+ *
+ * @param {string} threatId - Threat ID.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ getThreat(threatId: string): Promise;
+ getThreat(
+ paramsOrFirst: { threatId: string } | string,
+ ): Promise {
+ let params: { threatId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { threatId: string };
+ } else {
+ params = {
+ threatId: paramsOrFirst as string,
+ };
+ }
+
+ const threatId = params.threatId;
+
+ if (typeof threatId === 'undefined' || threatId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "threatId"',
+ );
+ }
+ const apiPath = '/admin/threats/{threatId}'.replace(
+ '{threatId}',
+ encodeURIComponent(String(threatId)),
+ );
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'threat',
+ models: {
+ threat: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ teamId: '',
+ userId: '',
+ region: '',
+ resourceType: '',
+ resourceId: '',
+ resourceCreatedAt: '',
+ type: '',
+ status: 'open',
+ description: '',
+ createdBy: '',
+ hashSignature: '',
+ analysisVerdict: '',
+ analysisFiles: [],
+ scanDomain: '',
+ scanVerdict: '',
+ scanSeverity: '',
+ scanReportId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Delete a threat record.
+ *
+ * @param {string} params.threatId - Threat ID.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ deleteThreat(params: { threatId: string }): Promise<{}>;
+ /**
+ * Delete a threat record.
+ *
+ * @param {string} threatId - Threat ID.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ deleteThreat(threatId: string): Promise<{}>;
+ deleteThreat(paramsOrFirst: { threatId: string } | string): Promise<{}> {
+ let params: { threatId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { threatId: string };
+ } else {
+ params = {
+ threatId: paramsOrFirst as string,
+ };
+ }
+
+ const threatId = params.threatId;
+
+ if (typeof threatId === 'undefined' || threatId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "threatId"',
+ );
+ }
+ const apiPath = '/admin/threats/{threatId}'.replace(
+ '{threatId}',
+ encodeURIComponent(String(threatId)),
+ );
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * Triage a threat: mark it resolved once the resource was dealt with, dismissed for a false positive, or open to revisit it.
+ *
+ * @param {string} params.threatId - Threat ID.
+ * @param {ThreatStatus} params.status - Triage status. `resolved` once the resource was dealt with, `dismissed` for a false positive, `open` to reopen.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ updateThreatStatus(params: {
+ threatId: string;
+ status: ThreatStatus;
+ }): Promise;
+ /**
+ * Triage a threat: mark it resolved once the resource was dealt with, dismissed for a false positive, or open to revisit it.
+ *
+ * @param {string} threatId - Threat ID.
+ * @param {ThreatStatus} status - Triage status. `resolved` once the resource was dealt with, `dismissed` for a false positive, `open` to reopen.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ updateThreatStatus(
+ threatId: string,
+ status: ThreatStatus,
+ ): Promise;
+ updateThreatStatus(
+ paramsOrFirst: { threatId: string; status: ThreatStatus } | string,
+ ...rest: [ThreatStatus?]
+ ): Promise {
+ let params: { threatId: string; status: ThreatStatus };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ threatId: string;
+ status: ThreatStatus;
+ };
+ } else {
+ params = {
+ threatId: paramsOrFirst as string,
+ status: rest[0] as ThreatStatus,
+ };
+ }
+
+ const threatId = params.threatId;
+ const status = params.status;
+
+ if (typeof threatId === 'undefined' || threatId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "threatId"',
+ );
+ }
+ if (typeof status === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "status"');
+ }
+ const apiPath = '/admin/threats/{threatId}/status'.replace(
+ '{threatId}',
+ encodeURIComponent(String(threatId)),
+ );
+ const apiPayload: Payload = {};
+ if (typeof status !== 'undefined') {
+ apiPayload['status'] = status;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'threat',
+ models: {
+ threat: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ teamId: '',
+ userId: '',
+ region: '',
+ resourceType: '',
+ resourceId: '',
+ resourceCreatedAt: '',
+ type: '',
+ status: 'open',
+ description: '',
+ createdBy: '',
+ hashSignature: '',
+ analysisVerdict: '',
+ analysisFiles: [],
+ scanDomain: '',
+ scanVerdict: '',
+ scanSeverity: '',
+ scanReportId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+}
diff --git a/src/services/advisor.ts b/src/services/advisor.ts
index 4be2f69f..4b42d13a 100644
--- a/src/services/advisor.ts
+++ b/src/services/advisor.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Advisor {
@@ -76,7 +81,73 @@ export class Advisor {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'reportList',
+ models: {
+ reportList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ reports: {
+ items: 'report',
+ },
+ },
+ },
+ report: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ type: '',
+ title: '',
+ summary: '',
+ targetType: '',
+ target: '',
+ categories: [],
+ },
+ properties: {
+ insights: {
+ items: 'insight',
+ },
+ },
+ },
+ insight: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ reportId: '',
+ type: '',
+ severity: 'info',
+ status: 'active',
+ resourceType: '',
+ resourceId: '',
+ parentResourceType: '',
+ parentResourceId: '',
+ title: '',
+ summary: '',
+ },
+ properties: {
+ ctas: {
+ items: 'insightCTA',
+ },
+ },
+ },
+ insightCTA: {
+ defaults: {
+ label: '',
+ service: '',
+ method: '',
+ params: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -134,7 +205,63 @@ export class Advisor {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'report',
+ models: {
+ report: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ type: '',
+ title: '',
+ summary: '',
+ targetType: '',
+ target: '',
+ categories: [],
+ },
+ properties: {
+ insights: {
+ items: 'insight',
+ },
+ },
+ },
+ insight: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ reportId: '',
+ type: '',
+ severity: 'info',
+ status: 'active',
+ resourceType: '',
+ resourceId: '',
+ parentResourceType: '',
+ parentResourceId: '',
+ title: '',
+ summary: '',
+ },
+ properties: {
+ ctas: {
+ items: 'insightCTA',
+ },
+ },
+ },
+ insightCTA: {
+ defaults: {
+ label: '',
+ service: '',
+ method: '',
+ params: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -277,7 +404,54 @@ export class Advisor {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'insightList',
+ models: {
+ insightList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ insights: {
+ items: 'insight',
+ },
+ },
+ },
+ insight: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ reportId: '',
+ type: '',
+ severity: 'info',
+ status: 'active',
+ resourceType: '',
+ resourceId: '',
+ parentResourceType: '',
+ parentResourceId: '',
+ title: '',
+ summary: '',
+ },
+ properties: {
+ ctas: {
+ items: 'insightCTA',
+ },
+ },
+ },
+ insightCTA: {
+ defaults: {
+ label: '',
+ service: '',
+ method: '',
+ params: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -350,6 +524,43 @@ export class Advisor {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'insight',
+ models: {
+ insight: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ reportId: '',
+ type: '',
+ severity: 'info',
+ status: 'active',
+ resourceType: '',
+ resourceId: '',
+ parentResourceType: '',
+ parentResourceId: '',
+ title: '',
+ summary: '',
+ },
+ properties: {
+ ctas: {
+ items: 'insightCTA',
+ },
+ },
+ },
+ insightCTA: {
+ defaults: {
+ label: '',
+ service: '',
+ method: '',
+ params: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/affiliates.ts b/src/services/affiliates.ts
index 2edbeacb..6fbc544c 100644
--- a/src/services/affiliates.ts
+++ b/src/services/affiliates.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Affiliates {
@@ -61,7 +66,34 @@ export class Affiliates {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'affiliateLinkList',
+ models: {
+ affiliateLinkList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ links: {
+ items: 'affiliateLink',
+ },
+ },
+ },
+ affiliateLink: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ name: '',
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -129,7 +161,24 @@ export class Affiliates {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'affiliateLink',
+ models: {
+ affiliateLink: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ name: '',
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -185,7 +234,24 @@ export class Affiliates {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'affiliateLink',
+ models: {
+ affiliateLink: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ name: '',
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -296,7 +362,37 @@ export class Affiliates {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'affiliateReferralList',
+ models: {
+ affiliateReferralList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ referrals: {
+ items: 'affiliateReferral',
+ },
+ },
+ },
+ affiliateReferral: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ linkId: '',
+ referredUserMaskedId: '',
+ referredUserCountry: '',
+ status: '',
+ attributedAt: '',
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -352,7 +448,36 @@ export class Affiliates {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'affiliateRewardList',
+ models: {
+ affiliateRewardList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ rewards: {
+ items: 'affiliateReward',
+ },
+ },
+ },
+ affiliateReward: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ linkId: '',
+ referralId: '',
+ amount: 0,
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -452,6 +577,25 @@ export class Affiliates {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'affiliateReward',
+ models: {
+ affiliateReward: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ userId: '',
+ linkId: '',
+ referralId: '',
+ amount: 0,
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/analytics-tracking.ts b/src/services/analytics-tracking.ts
new file mode 100644
index 00000000..e1bed9a8
--- /dev/null
+++ b/src/services/analytics-tracking.ts
@@ -0,0 +1,774 @@
+import type { Analytics } from './analytics';
+
+/**
+ * Auto-tracking helpers for the generated `Analytics` service: pageviews,
+ * outbound links, downloads, scroll depth and active engagement, all sent
+ * through `Analytics.createEvent`.
+ *
+ * ```ts
+ * const tracking = new Tracking(new Analytics(client), '');
+ * tracking.start();
+ * ```
+ *
+ * All helpers respect `navigator.doNotTrack === '1'` by default; opt out with
+ * `respectDoNotTrack: false` in the constructor options.
+ *
+ * Engagement time follows Plausible's model: rather than one total at unload,
+ * a delta is emitted at every natural checkpoint of the visit (tab hidden, SPA
+ * route change, unload). See `enableAutoEngagementTime` for details.
+ *
+ * Auto-emitted event names follow `snake_case` + lowercase (`pageview`,
+ * `outbound_link`, `file_download`, `screen_view`, etc.). Any prop keys use
+ * camelCase to match the endpoint's parameter naming. Callers can pass any
+ * custom event name; the auto-track methods only own the events they emit
+ * themselves.
+ */
+
+export type TrackingEventOptions = {
+ props?: Record;
+ url?: string; // defaults to the current page URL
+ referrer?: string;
+ scrollDepth?: number; // 0-100 percentage
+ engagementTime?: number; // seconds since the previous flush
+};
+
+export type TrackingOptions = {
+ /**
+ * When true (default) the tracker becomes a no-op if `navigator.doNotTrack`
+ * is set to `'1'`. Set to false to always fire regardless of the DNT signal.
+ */
+ respectDoNotTrack?: boolean;
+};
+
+export type OutboundTrackingOptions = {
+ /**
+ * When true, links pointing at the current host's subdomains are treated
+ * as outbound. Defaults to false (subdomains are same-origin for tracking).
+ */
+ includeSubdomains?: boolean;
+};
+
+export type DownloadTrackingOptions = {
+ /**
+ * File extensions (without the leading dot) that mark an anchor as a
+ * download. Defaults cover the common set.
+ */
+ extensions?: string[];
+};
+
+const DEFAULT_DOWNLOAD_EXTENSIONS = [
+ 'pdf',
+ 'zip',
+ 'rar',
+ '7z',
+ 'tar',
+ 'gz',
+ 'csv',
+ 'tsv',
+ 'xls',
+ 'xlsx',
+ 'doc',
+ 'docx',
+ 'ppt',
+ 'pptx',
+ 'dmg',
+ 'exe',
+ 'msi',
+ 'pkg',
+ 'deb',
+ 'rpm',
+ 'apk',
+ 'mp3',
+ 'wav',
+ 'flac',
+ 'mp4',
+ 'mov',
+ 'avi',
+ 'mkv',
+ 'webm',
+];
+
+/**
+ * Two-part public suffixes common enough to matter for outbound-link detection.
+ * See `rootDomain()` for why this is a short list rather than the Public Suffix
+ * List.
+ */
+const MULTI_PART_SUFFIXES = new Set([
+ 'co.uk',
+ 'org.uk',
+ 'ac.uk',
+ 'gov.uk',
+ 'me.uk',
+ 'net.uk',
+ 'sch.uk',
+ 'co.jp',
+ 'ne.jp',
+ 'or.jp',
+ 'ac.jp',
+ 'go.jp',
+ 'com.au',
+ 'net.au',
+ 'org.au',
+ 'edu.au',
+ 'gov.au',
+ 'com.br',
+ 'net.br',
+ 'org.br',
+ 'com.cn',
+ 'net.cn',
+ 'org.cn',
+ 'gov.cn',
+ 'co.in',
+ 'net.in',
+ 'org.in',
+ 'co.nz',
+ 'net.nz',
+ 'org.nz',
+ 'co.za',
+ 'org.za',
+ 'com.mx',
+ 'com.ar',
+ 'com.co',
+ 'com.pe',
+ 'com.tr',
+ 'com.tw',
+ 'com.sg',
+ 'com.hk',
+ 'com.my',
+ 'com.ph',
+ 'com.vn',
+ 'co.kr',
+ 'co.il',
+ 'co.id',
+ 'co.th',
+ 'com.ua',
+ 'com.pl',
+ 'com.es',
+]);
+
+const SCROLL_DEPTH_THROTTLE_MS = 200;
+
+type Cleanup = () => void;
+
+export class Tracking {
+ private readonly analytics: Analytics;
+ private readonly propertyId: string;
+ private readonly respectDoNotTrack: boolean;
+
+ private pageviewCleanups: Cleanup[] = [];
+ private outboundCleanup?: Cleanup;
+ private downloadCleanup?: Cleanup;
+ private scrollCleanups: Cleanup[] = [];
+ private engagementCleanups: Cleanup[] = [];
+
+ private currentPath?: string;
+ private maxScrollDepth = 0;
+ private scrollTicking = false;
+ private lastScrollReport = 0;
+
+ private engagementStart = 0;
+ private engagementAccumulatedMs = 0;
+ private engagementActive = false;
+
+ /**
+ * @param analytics - The generated `Analytics` service events are sent through.
+ * @param propertyId - Analytics property every event is recorded against.
+ */
+ constructor(
+ analytics: Analytics,
+ propertyId: string,
+ options: TrackingOptions = {},
+ ) {
+ this.analytics = analytics;
+ this.propertyId = propertyId;
+ this.respectDoNotTrack = options.respectDoNotTrack !== false;
+ }
+
+ /**
+ * Start the default auto-tracking set: pageviews, outbound links, scroll
+ * depth and active engagement time. Downloads are opt-in via
+ * `enableAutoDownloadTracking()` because the extension list is
+ * application-specific.
+ */
+ public start(): void {
+ this.enableAutoPageviews();
+ this.enableAutoOutboundTracking();
+ this.enableAutoScrollDepth();
+ this.enableAutoEngagementTime();
+ }
+
+ /**
+ * Track an event manually. Respects the DNT setting and swallows request
+ * failures so tracking never surfaces errors to the host page.
+ */
+ public track(name: string, options: TrackingEventOptions = {}): void {
+ if (!this.canTrack()) {
+ return;
+ }
+ try {
+ // Missing required params throw synchronously rather than rejecting.
+ this.analytics
+ .createEvent({
+ propertyId: this.propertyId,
+ name,
+ url: options.url ?? this.currentPageUrl(),
+ referrer: options.referrer,
+ screenWidth: this.viewportWidth(),
+ scrollDepth: options.scrollDepth,
+ engagementTime: options.engagementTime,
+ // The endpoint takes props as a flat alternating key/value list.
+ props: options.props
+ ? Object.entries(options.props).flatMap(
+ ([key, value]) => [key, String(value)],
+ )
+ : undefined,
+ })
+ .catch((error) => {
+ console.warn('Tracking: failed to send event', error);
+ });
+ } catch (error) {
+ console.warn('Tracking: failed to send event', error);
+ }
+ }
+
+ /**
+ * Convenience wrapper for pageview-shaped events.
+ */
+ public pageview(url?: string, referrer?: string): void {
+ this.track('pageview', {
+ url: url ?? this.currentPageUrl(),
+ referrer:
+ referrer ??
+ (typeof document !== 'undefined'
+ ? document.referrer
+ : undefined),
+ });
+ }
+
+ /**
+ * Enable SPA-aware pageview tracking. Fires an initial pageview on
+ * enable, then again on every `pushState`, `replaceState`, `popstate`
+ * or hashchange. Idempotent — repeat calls no-op.
+ */
+ public enableAutoPageviews(): void {
+ if (this.pageviewCleanups.length > 0) {
+ return;
+ }
+ if (typeof window === 'undefined' || typeof history === 'undefined') {
+ return;
+ }
+
+ this.currentPath = this.currentPageUrl();
+ this.pageview();
+
+ const handleNavigation = (): void => {
+ const nextPath = this.currentPageUrl();
+ if (nextPath === this.currentPath) {
+ return;
+ }
+ const previous = this.currentPath;
+ this.currentPath = nextPath;
+ this.flushScrollDepth(previous);
+ this.flushEngagement(previous);
+ this.pageview(nextPath);
+ // flushEngagement no longer auto-restarts the timer (see its
+ // implementation note re: bfcache). SPA navigation stays on the
+ // same document, so restart engagement tracking for the new
+ // route as long as the tab is visible.
+ if (
+ this.engagementCleanups.length > 0 &&
+ (typeof document === 'undefined' ||
+ document.visibilityState !== 'hidden')
+ ) {
+ this.startEngagement();
+ }
+ };
+
+ const originalPushState = history.pushState.bind(history);
+ const originalReplaceState = history.replaceState.bind(history);
+
+ // Our wrappers stay reachable after cleanup whenever another library
+ // patched on top of ours, so they have to be switchable off rather than
+ // merely unreferenced.
+ let patchActive = true;
+
+ const patchedPushState = (
+ data: unknown,
+ unused: string,
+ url?: string | URL | null,
+ ): void => {
+ originalPushState(data, unused, url);
+ if (patchActive) {
+ handleNavigation();
+ }
+ };
+ const patchedReplaceState = (
+ data: unknown,
+ unused: string,
+ url?: string | URL | null,
+ ): void => {
+ originalReplaceState(data, unused, url);
+ if (patchActive) {
+ handleNavigation();
+ }
+ };
+
+ history.pushState = patchedPushState;
+ history.replaceState = patchedReplaceState;
+
+ const popstateHandler = (): void => handleNavigation();
+ const hashchangeHandler = (): void => handleNavigation();
+
+ window.addEventListener('popstate', popstateHandler);
+ window.addEventListener('hashchange', hashchangeHandler);
+
+ this.pageviewCleanups.push(() => {
+ // Only unwind our own patch. A router (Next.js App Router, React
+ // Router, …) that patched these after us owns the current value,
+ // and assigning our saved reference back would silently throw its
+ // wrapper away. In that case ours stays in the chain, which is why
+ // `patchActive` exists: the wrapper keeps delegating to the original
+ // but stops reporting.
+ patchActive = false;
+
+ if (history.pushState === patchedPushState) {
+ history.pushState = originalPushState;
+ }
+ if (history.replaceState === patchedReplaceState) {
+ history.replaceState = originalReplaceState;
+ }
+ window.removeEventListener('popstate', popstateHandler);
+ window.removeEventListener('hashchange', hashchangeHandler);
+ });
+ }
+
+ /**
+ * Disable auto-pageview tracking installed by `enableAutoPageviews`.
+ * Safe to call when auto-pageviews were never enabled.
+ */
+ public disableAutoPageviews(): void {
+ for (const cleanup of this.pageviewCleanups) {
+ cleanup();
+ }
+ this.pageviewCleanups = [];
+ }
+
+ /**
+ * Enable click-based outbound link tracking. Detects anchor clicks that
+ * navigate to a different origin and fires an `outbound_link` event
+ * (with `hostname` and `href` props) before the browser navigates.
+ */
+ public enableAutoOutboundTracking(
+ options: OutboundTrackingOptions = {},
+ ): void {
+ if (this.outboundCleanup) {
+ return;
+ }
+ if (typeof document === 'undefined') {
+ return;
+ }
+
+ const includeSubdomains = options.includeSubdomains === true;
+
+ const clickHandler = (event: MouseEvent): void => {
+ const anchor = this.findAnchor(event.target);
+ if (!anchor || !anchor.href) {
+ return;
+ }
+ const target = this.parseUrl(anchor.href);
+ if (!target || !this.isExternal(target, includeSubdomains)) {
+ return;
+ }
+ this.track('outbound_link', {
+ url: target.href,
+ props: { hostname: target.hostname, href: target.href },
+ });
+ };
+
+ document.addEventListener('click', clickHandler, { capture: true });
+ this.outboundCleanup = () =>
+ document.removeEventListener('click', clickHandler, {
+ capture: true,
+ });
+ }
+
+ /**
+ * Disable outbound-link tracking installed by `enableAutoOutboundTracking`.
+ * Safe to call when auto-outbound was never enabled.
+ */
+ public disableAutoOutboundTracking(): void {
+ if (this.outboundCleanup) {
+ this.outboundCleanup();
+ this.outboundCleanup = undefined;
+ }
+ }
+
+ /**
+ * Enable click-based download tracking. Detects anchor clicks that point
+ * at a file whose extension appears in the configured list and fires a
+ * `file_download` event with `filename`, `extension` and `href` props.
+ */
+ public enableAutoDownloadTracking(
+ options: DownloadTrackingOptions = {},
+ ): void {
+ if (this.downloadCleanup) {
+ return;
+ }
+ if (typeof document === 'undefined') {
+ return;
+ }
+
+ const extensions = (
+ options.extensions ?? DEFAULT_DOWNLOAD_EXTENSIONS
+ ).map((ext) => ext.toLowerCase().replace(/^\./, ''));
+ const extensionSet = new Set(extensions);
+
+ const clickHandler = (event: MouseEvent): void => {
+ const anchor = this.findAnchor(event.target);
+ if (!anchor || !anchor.href) {
+ return;
+ }
+ const url = this.parseUrl(anchor.href);
+ if (!url) {
+ return;
+ }
+ const filename = url.pathname.split('/').pop() ?? '';
+ const extension = filename.includes('.')
+ ? filename.split('.').pop()?.toLowerCase()
+ : undefined;
+ if (!extension || !extensionSet.has(extension)) {
+ return;
+ }
+ this.track('file_download', {
+ url: url.href,
+ props: { filename, extension, href: url.href },
+ });
+ };
+
+ document.addEventListener('click', clickHandler, { capture: true });
+ this.downloadCleanup = () =>
+ document.removeEventListener('click', clickHandler, {
+ capture: true,
+ });
+ }
+
+ /**
+ * Disable file-download tracking installed by `enableAutoDownloadTracking`.
+ * Safe to call when auto-download was never enabled.
+ */
+ public disableAutoDownloadTracking(): void {
+ if (this.downloadCleanup) {
+ this.downloadCleanup();
+ this.downloadCleanup = undefined;
+ }
+ }
+
+ /**
+ * Enable passive scroll-depth tracking. Records the maximum percent of the
+ * document scrolled and reports it on `beforeunload` and on SPA route
+ * changes. Uses a throttled passive listener so it is safe on hot paths.
+ */
+ public enableAutoScrollDepth(): void {
+ if (this.scrollCleanups.length > 0) {
+ return;
+ }
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
+ return;
+ }
+
+ this.maxScrollDepth = 0;
+ this.lastScrollReport = 0;
+
+ const scrollHandler = (): void => {
+ if (this.scrollTicking) {
+ return;
+ }
+ this.scrollTicking = true;
+ window.requestAnimationFrame(() => {
+ const now = Date.now();
+ if (now - this.lastScrollReport < SCROLL_DEPTH_THROTTLE_MS) {
+ this.scrollTicking = false;
+ return;
+ }
+ this.lastScrollReport = now;
+ const depth = this.computeScrollDepth();
+ if (depth > this.maxScrollDepth) {
+ this.maxScrollDepth = depth;
+ }
+ this.scrollTicking = false;
+ });
+ };
+
+ const unloadHandler = (): void => {
+ this.flushScrollDepth(this.currentPageUrl());
+ };
+
+ window.addEventListener('scroll', scrollHandler, { passive: true });
+ window.addEventListener('beforeunload', unloadHandler);
+ window.addEventListener('pagehide', unloadHandler);
+
+ this.scrollCleanups.push(() => {
+ window.removeEventListener('scroll', scrollHandler);
+ window.removeEventListener('beforeunload', unloadHandler);
+ window.removeEventListener('pagehide', unloadHandler);
+ });
+ }
+
+ /**
+ * Disable scroll-depth tracking installed by `enableAutoScrollDepth`. Safe
+ * to call when auto-scroll-depth was never enabled. Any accumulated depth
+ * for the current page is dropped.
+ */
+ public disableAutoScrollDepth(): void {
+ for (const cleanup of this.scrollCleanups) {
+ cleanup();
+ }
+ this.scrollCleanups = [];
+ this.maxScrollDepth = 0;
+ this.scrollTicking = false;
+ this.lastScrollReport = 0;
+ }
+
+ /**
+ * Enable active engagement-time tracking. Counts time the tab is visible
+ * and uses `visibilitychange` to exclude background time.
+ *
+ * Delivery follows Plausible's model rather than a single total at the
+ * end of the visit: an `engagement_time` event is emitted at every natural
+ * checkpoint — the tab going hidden, an SPA route change, and finally
+ * `beforeunload`/`pagehide`. Unload is kept only as a best-effort last
+ * flush; it is the least reliable moment to send anything (browsers
+ * routinely cancel in-flight requests there, and `sendBeacon` cannot set
+ * the `X-Appwrite-Project` header the endpoint requires), so it must never
+ * be the only delivery.
+ *
+ * Each event carries a **delta** — the seconds accrued since the previous
+ * flush, not a running total — so the values are additive per session and
+ * a lost event costs only its own slice.
+ *
+ * There is deliberately no periodic ping. The cadence is driven by
+ * navigation and tab switches, so request volume tracks what the visitor
+ * actually does instead of multiplying with time on page.
+ */
+ public enableAutoEngagementTime(): void {
+ if (this.engagementCleanups.length > 0) {
+ return;
+ }
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
+ return;
+ }
+
+ this.engagementAccumulatedMs = 0;
+ // Do not start the clock for a tab that is already hidden (prerender,
+ // background tab restore); `visibilitychange` starts it when it is
+ // actually looked at.
+ if (document.visibilityState !== 'hidden') {
+ this.startEngagement();
+ }
+
+ const visibilityHandler = (): void => {
+ if (document.visibilityState === 'hidden') {
+ // Flush, don't just pause. The page is still fully alive here,
+ // which makes this the most reliable delivery point in the
+ // whole visit — and it is the same moment Plausible reports on.
+ this.flushEngagement(this.currentPageUrl());
+ } else if (document.visibilityState === 'visible') {
+ this.startEngagement();
+ }
+ };
+
+ const unloadHandler = (): void => {
+ this.flushEngagement(this.currentPageUrl());
+ };
+
+ const pageshowHandler = (event: PageTransitionEvent): void => {
+ // When the page is restored from the back-forward cache the
+ // engagement timer is in a stopped state (flushEngagement paused
+ // it on pagehide and does not auto-restart). Kick off a fresh
+ // engagementStart so bfcache dwell time is not billed as
+ // engagement.
+ if (event.persisted) {
+ this.startEngagement();
+ }
+ };
+
+ document.addEventListener('visibilitychange', visibilityHandler);
+ window.addEventListener('beforeunload', unloadHandler);
+ window.addEventListener('pagehide', unloadHandler);
+ window.addEventListener('pageshow', pageshowHandler);
+
+ this.engagementCleanups.push(() => {
+ document.removeEventListener('visibilitychange', visibilityHandler);
+ window.removeEventListener('beforeunload', unloadHandler);
+ window.removeEventListener('pagehide', unloadHandler);
+ window.removeEventListener('pageshow', pageshowHandler);
+ });
+ }
+
+ /**
+ * Disable engagement-time tracking installed by `enableAutoEngagementTime`.
+ * Safe to call when auto-engagement was never enabled. Any accumulated
+ * engagement time is dropped without being emitted.
+ */
+ public disableAutoEngagementTime(): void {
+ for (const cleanup of this.engagementCleanups) {
+ cleanup();
+ }
+ this.engagementCleanups = [];
+ this.engagementActive = false;
+ this.engagementAccumulatedMs = 0;
+ this.engagementStart = 0;
+ }
+
+ private canTrack(): boolean {
+ if (!this.respectDoNotTrack) {
+ return true;
+ }
+ if (typeof navigator === 'undefined') {
+ return true;
+ }
+ return navigator.doNotTrack !== '1';
+ }
+
+ private currentPageUrl(): string {
+ if (typeof window === 'undefined' || !window.location) {
+ return '';
+ }
+ return window.location.href;
+ }
+
+ // The endpoint buckets this as viewport width in CSS pixels, so it is
+ // `innerWidth` rather than `screen.width` scaled by devicePixelRatio.
+ private viewportWidth(): number | undefined {
+ if (typeof window === 'undefined' || !window.innerWidth) {
+ return undefined;
+ }
+ return window.innerWidth;
+ }
+
+ private findAnchor(target: EventTarget | null): HTMLAnchorElement | null {
+ let node = target as Node | null;
+ while (node) {
+ if ((node as HTMLElement).tagName === 'A') {
+ return node as HTMLAnchorElement;
+ }
+ node = (node as Node).parentNode;
+ }
+ return null;
+ }
+
+ private parseUrl(href: string): URL | null {
+ try {
+ return new URL(href, window.location.href);
+ } catch {
+ return null;
+ }
+ }
+
+ private isExternal(target: URL, includeSubdomains: boolean): boolean {
+ if (target.protocol !== 'http:' && target.protocol !== 'https:') {
+ return false;
+ }
+ if (target.hostname === window.location.hostname) {
+ return false;
+ }
+ if (includeSubdomains) {
+ return true;
+ }
+ const root = this.rootDomain(window.location.hostname);
+ return this.rootDomain(target.hostname) !== root;
+ }
+
+ private rootDomain(hostname: string): string {
+ const parts = hostname.split('.');
+ if (parts.length <= 2) {
+ return hostname;
+ }
+ // Taking the last two labels is wrong wherever the registry sells names
+ // one level down: `shop.example.co.uk` and `google.co.uk` both reduce to
+ // `co.uk`, so every outbound click between two `.co.uk` sites looks
+ // internal and is dropped. Take three labels after a known two-part
+ // suffix instead.
+ //
+ // This is a heuristic, not the Public Suffix List — the full list is
+ // orders of magnitude larger than this whole file, and a tracking
+ // snippet cannot carry it. Sites on a suffix that is missing here can
+ // pass `includeSubdomains: true` to treat every other host as outbound.
+ const suffix = parts.slice(-2).join('.');
+ if (parts.length > 2 && MULTI_PART_SUFFIXES.has(suffix)) {
+ return parts.slice(-3).join('.');
+ }
+ return suffix;
+ }
+
+ private computeScrollDepth(): number {
+ const scrollTop = window.scrollY || document.documentElement.scrollTop;
+ const viewport =
+ window.innerHeight || document.documentElement.clientHeight;
+ const total = document.documentElement.scrollHeight;
+ if (total <= viewport) {
+ return 100;
+ }
+ const depth = Math.round(((scrollTop + viewport) / total) * 100);
+ return Math.max(0, Math.min(100, depth));
+ }
+
+ private flushScrollDepth(url: string | undefined): void {
+ if (this.scrollCleanups.length === 0) {
+ return;
+ }
+ if (this.maxScrollDepth <= 0) {
+ return;
+ }
+ this.track('scroll_depth', {
+ url,
+ scrollDepth: this.maxScrollDepth,
+ });
+ this.maxScrollDepth = 0;
+ }
+
+ private startEngagement(): void {
+ if (this.engagementActive) {
+ return;
+ }
+ this.engagementActive = true;
+ this.engagementStart = Date.now();
+ }
+
+ private pauseEngagement(): void {
+ if (!this.engagementActive) {
+ return;
+ }
+ this.engagementActive = false;
+ this.engagementAccumulatedMs += Date.now() - this.engagementStart;
+ }
+
+ private flushEngagement(url: string | undefined): void {
+ if (this.engagementCleanups.length === 0) {
+ return;
+ }
+ this.pauseEngagement();
+ // Deltas, not a running total: emit only what accrued since the last
+ // flush. `floor` plus keeping the sub-second remainder in the
+ // accumulator is what makes repeated flushes safe — nothing is emitted
+ // twice, and a visit chopped into many short segments does not lose a
+ // fraction of a second to rounding on every one of them.
+ const seconds = Math.floor(this.engagementAccumulatedMs / 1000);
+ if (seconds > 0) {
+ this.engagementAccumulatedMs -= seconds * 1000;
+ this.track('engagement_time', {
+ url,
+ engagementTime: seconds,
+ });
+ }
+ // NOTE: intentionally do NOT call startEngagement() here. flushEngagement
+ // runs on `pagehide`, which is also the last hook before the browser
+ // may freeze the page into the back-forward cache. Auto-restarting
+ // would snapshot engagementStart just before the freeze; the next
+ // pauseEngagement (after bfcache restore) would then bill the entire
+ // bfcache dwell as active engagement. Restart is driven by explicit
+ // resume signals: `pageshow` (with `persisted === true`),
+ // `visibilitychange` back to visible, or the SPA navigation flow in
+ // `enableAutoPageviews`.
+ }
+}
diff --git a/src/services/analytics.ts b/src/services/analytics.ts
new file mode 100644
index 00000000..2732d5f1
--- /dev/null
+++ b/src/services/analytics.ts
@@ -0,0 +1,1001 @@
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
+import type { Models } from '../models';
+
+import { AnalyticsInterval } from '../enums/analytics-interval';
+import { AnalyticsDimension } from '../enums/analytics-dimension';
+export class Analytics {
+ client: Client;
+
+ constructor(client: Client) {
+ this.client = client;
+ }
+
+ /**
+ * List analytics properties for the current project.
+ *
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, domain, enabled, public
+ * @param {string} params.search - Search term to filter your list results. Matches the property ID, name and domain. Max length: 256 chars.
+ * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ listProperties(params?: {
+ queries?: string[];
+ search?: string;
+ total?: boolean;
+ }): Promise;
+ /**
+ * List analytics properties for the current project.
+ *
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, domain, enabled, public
+ * @param {string} search - Search term to filter your list results. Matches the property ID, name and domain. Max length: 256 chars.
+ * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ listProperties(
+ queries?: string[],
+ search?: string,
+ total?: boolean,
+ ): Promise;
+ listProperties(
+ paramsOrFirst?:
+ { queries?: string[]; search?: string; total?: boolean } | string[],
+ ...rest: [string?, boolean?]
+ ): Promise {
+ let params: { queries?: string[]; search?: string; total?: boolean };
+
+ if (
+ (typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
+ (paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst))
+ ) {
+ params = (paramsOrFirst || {}) as {
+ queries?: string[];
+ search?: string;
+ total?: boolean;
+ };
+ } else {
+ params = {
+ queries: paramsOrFirst as string[],
+ search: rest[0] as string,
+ total: rest[1] as boolean,
+ };
+ }
+
+ const queries = params.queries;
+ const search = params.search;
+ const total = params.total;
+
+ const apiPath = '/analytics/properties';
+ const apiPayload: Payload = {};
+ if (typeof queries !== 'undefined') {
+ apiPayload['queries'] = queries;
+ }
+ if (typeof search !== 'undefined') {
+ apiPayload['search'] = search;
+ }
+ if (typeof total !== 'undefined') {
+ apiPayload['total'] = total;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'analyticsPropertyList',
+ models: {
+ analyticsPropertyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ properties: {
+ items: 'analyticsProperty',
+ },
+ },
+ },
+ analyticsProperty: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ domain: '',
+ enabled: true,
+ public: false,
+ allowedOrigins: ['*'],
+ accessedAt: '',
+ firstAccessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Create a new analytics property to track a website or application.
+ *
+ * @param {string} params.propertyId - Unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Max length is 36 chars.
+ * @param {string} params.name - Human-readable name for this property.
+ * @param {string} params.domain - Primary domain to track (e.g. example.com). Optional for native apps.
+ * @param {boolean} params.enabled - Whether tracking is enabled.
+ * @param {boolean} params.xpublic - Whether stats are publicly viewable.
+ * @param {string[]} params.allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ createProperty(params: {
+ propertyId: string;
+ name: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ }): Promise;
+ /**
+ * Create a new analytics property to track a website or application.
+ *
+ * @param {string} propertyId - Unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Max length is 36 chars.
+ * @param {string} name - Human-readable name for this property.
+ * @param {string} domain - Primary domain to track (e.g. example.com). Optional for native apps.
+ * @param {boolean} enabled - Whether tracking is enabled.
+ * @param {boolean} xpublic - Whether stats are publicly viewable.
+ * @param {string[]} allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ createProperty(
+ propertyId: string,
+ name: string,
+ domain?: string,
+ enabled?: boolean,
+ xpublic?: boolean,
+ allowedOrigins?: string[],
+ ): Promise;
+ createProperty(
+ paramsOrFirst:
+ | {
+ propertyId: string;
+ name: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ }
+ | string,
+ ...rest: [string?, string?, boolean?, boolean?, string[]?]
+ ): Promise {
+ let params: {
+ propertyId: string;
+ name: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ propertyId: string;
+ name: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ };
+ } else {
+ params = {
+ propertyId: paramsOrFirst as string,
+ name: rest[0] as string,
+ domain: rest[1] as string,
+ enabled: rest[2] as boolean,
+ xpublic: rest[3] as boolean,
+ allowedOrigins: rest[4] as string[],
+ };
+ }
+
+ const propertyId = params.propertyId;
+ const name = params.name;
+ const domain = params.domain;
+ const enabled = params.enabled;
+ const xpublic = params.xpublic;
+ const allowedOrigins = params.allowedOrigins;
+
+ if (typeof propertyId === 'undefined') {
+ throw new AppwriteException(
+ 'Missing required parameter: "propertyId"',
+ );
+ }
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+ const apiPath = '/analytics/properties';
+ const apiPayload: Payload = {};
+ if (typeof propertyId !== 'undefined') {
+ apiPayload['propertyId'] = propertyId;
+ }
+ if (typeof name !== 'undefined') {
+ apiPayload['name'] = name;
+ }
+ if (typeof domain !== 'undefined') {
+ apiPayload['domain'] = domain;
+ }
+ if (typeof enabled !== 'undefined') {
+ apiPayload['enabled'] = enabled;
+ }
+ if (typeof xpublic !== 'undefined') {
+ apiPayload['public'] = xpublic;
+ }
+ if (typeof allowedOrigins !== 'undefined') {
+ apiPayload['allowedOrigins'] = allowedOrigins;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'analyticsProperty',
+ models: {
+ analyticsProperty: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ domain: '',
+ enabled: true,
+ public: false,
+ allowedOrigins: ['*'],
+ accessedAt: '',
+ firstAccessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Get an analytics property by ID.
+ *
+ * @param {string} params.propertyId - Analytics property unique ID.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ getProperty(params: {
+ propertyId: string;
+ }): Promise;
+ /**
+ * Get an analytics property by ID.
+ *
+ * @param {string} propertyId - Analytics property unique ID.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ getProperty(propertyId: string): Promise;
+ getProperty(
+ paramsOrFirst: { propertyId: string } | string,
+ ): Promise {
+ let params: { propertyId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { propertyId: string };
+ } else {
+ params = {
+ propertyId: paramsOrFirst as string,
+ };
+ }
+
+ const propertyId = params.propertyId;
+
+ if (typeof propertyId === 'undefined' || propertyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "propertyId"',
+ );
+ }
+ const apiPath = '/analytics/properties/{propertyId}'.replace(
+ '{propertyId}',
+ encodeURIComponent(String(propertyId)),
+ );
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'analyticsProperty',
+ models: {
+ analyticsProperty: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ domain: '',
+ enabled: true,
+ public: false,
+ allowedOrigins: ['*'],
+ accessedAt: '',
+ firstAccessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Update an analytics property. Only the attributes you pass are changed; omitted attributes keep their current value.
+ *
+ * @param {string} params.propertyId - Analytics property unique ID.
+ * @param {string} params.name - Human-readable name for this property.
+ * @param {string} params.domain - Primary domain to track (e.g. example.com). Pass an empty string to clear it.
+ * @param {boolean} params.enabled - Whether tracking is enabled.
+ * @param {boolean} params.xpublic - Whether stats are publicly viewable.
+ * @param {string[]} params.allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ updateProperty(params: {
+ propertyId: string;
+ name?: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ }): Promise;
+ /**
+ * Update an analytics property. Only the attributes you pass are changed; omitted attributes keep their current value.
+ *
+ * @param {string} propertyId - Analytics property unique ID.
+ * @param {string} name - Human-readable name for this property.
+ * @param {string} domain - Primary domain to track (e.g. example.com). Pass an empty string to clear it.
+ * @param {boolean} enabled - Whether tracking is enabled.
+ * @param {boolean} xpublic - Whether stats are publicly viewable.
+ * @param {string[]} allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ updateProperty(
+ propertyId: string,
+ name?: string,
+ domain?: string,
+ enabled?: boolean,
+ xpublic?: boolean,
+ allowedOrigins?: string[],
+ ): Promise;
+ updateProperty(
+ paramsOrFirst:
+ | {
+ propertyId: string;
+ name?: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ }
+ | string,
+ ...rest: [string?, string?, boolean?, boolean?, string[]?]
+ ): Promise {
+ let params: {
+ propertyId: string;
+ name?: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ propertyId: string;
+ name?: string;
+ domain?: string;
+ enabled?: boolean;
+ xpublic?: boolean;
+ allowedOrigins?: string[];
+ };
+ } else {
+ params = {
+ propertyId: paramsOrFirst as string,
+ name: rest[0] as string,
+ domain: rest[1] as string,
+ enabled: rest[2] as boolean,
+ xpublic: rest[3] as boolean,
+ allowedOrigins: rest[4] as string[],
+ };
+ }
+
+ const propertyId = params.propertyId;
+ const name = params.name;
+ const domain = params.domain;
+ const enabled = params.enabled;
+ const xpublic = params.xpublic;
+ const allowedOrigins = params.allowedOrigins;
+
+ if (typeof propertyId === 'undefined' || propertyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "propertyId"',
+ );
+ }
+ const apiPath = '/analytics/properties/{propertyId}'.replace(
+ '{propertyId}',
+ encodeURIComponent(String(propertyId)),
+ );
+ const apiPayload: Payload = {};
+ if (typeof name !== 'undefined') {
+ apiPayload['name'] = name;
+ }
+ if (typeof domain !== 'undefined') {
+ apiPayload['domain'] = domain;
+ }
+ if (typeof enabled !== 'undefined') {
+ apiPayload['enabled'] = enabled;
+ }
+ if (typeof xpublic !== 'undefined') {
+ apiPayload['public'] = xpublic;
+ }
+ if (typeof allowedOrigins !== 'undefined') {
+ apiPayload['allowedOrigins'] = allowedOrigins;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'analyticsProperty',
+ models: {
+ analyticsProperty: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ domain: '',
+ enabled: true,
+ public: false,
+ allowedOrigins: ['*'],
+ accessedAt: '',
+ firstAccessedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+
+ /**
+ * Delete an analytics property along with every event and session collected for it. This cannot be undone.
+ *
+ * @param {string} params.propertyId - Analytics property unique ID.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ deleteProperty(params: { propertyId: string }): Promise<{}>;
+ /**
+ * Delete an analytics property along with every event and session collected for it. This cannot be undone.
+ *
+ * @param {string} propertyId - Analytics property unique ID.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ deleteProperty(propertyId: string): Promise<{}>;
+ deleteProperty(
+ paramsOrFirst: { propertyId: string } | string,
+ ): Promise<{}> {
+ let params: { propertyId: string };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as { propertyId: string };
+ } else {
+ params = {
+ propertyId: paramsOrFirst as string,
+ };
+ }
+
+ const propertyId = params.propertyId;
+
+ if (typeof propertyId === 'undefined' || propertyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "propertyId"',
+ );
+ }
+ const apiPath = '/analytics/properties/{propertyId}'.replace(
+ '{propertyId}',
+ encodeURIComponent(String(propertyId)),
+ );
+ const apiPayload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * Send a tracking event from a browser, native app, or server-side SDK.
+ *
+ * @param {string} params.propertyId - Analytics property ID.
+ * @param {string} params.name - Event name. "pageview" is just a conventional event name; events are not modeled specially.
+ * @param {string} params.url - Full page URL or screen identifier.
+ * @param {string} params.domain - Hostname (e.g. example.com).
+ * @param {string} params.referrer - Referrer URL.
+ * @param {number} params.screenWidth - Viewport width in CSS pixels.
+ * @param {string} params.sessionHash - Optional session hash (provided by SDK).
+ * @param {number} params.scrollDepth - Scroll depth percentage 0-100.
+ * @param {number} params.engagementTime - Engagement time in seconds, 0-4294967295.
+ * @param {string[]} params.props - Custom string properties as a flat key=value list (max 32 entries, alternating key,value).
+ * @param {string} params.userId - Override user ID. Requires API-key auth with analytics.write scope.
+ * @param {string} params.ip - Override IP address. Requires API-key auth with analytics.write scope.
+ * @param {string} params.userAgent - Override user agent. Requires API-key auth with analytics.write scope.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ */
+ createEvent(params: {
+ propertyId: string;
+ name: string;
+ url: string;
+ domain?: string;
+ referrer?: string;
+ screenWidth?: number;
+ sessionHash?: string;
+ scrollDepth?: number;
+ engagementTime?: number;
+ props?: string[];
+ userId?: string;
+ ip?: string;
+ userAgent?: string;
+ }): Promise<{}>;
+ /**
+ * Send a tracking event from a browser, native app, or server-side SDK.
+ *
+ * @param {string} propertyId - Analytics property ID.
+ * @param {string} name - Event name. "pageview" is just a conventional event name; events are not modeled specially.
+ * @param {string} url - Full page URL or screen identifier.
+ * @param {string} domain - Hostname (e.g. example.com).
+ * @param {string} referrer - Referrer URL.
+ * @param {number} screenWidth - Viewport width in CSS pixels.
+ * @param {string} sessionHash - Optional session hash (provided by SDK).
+ * @param {number} scrollDepth - Scroll depth percentage 0-100.
+ * @param {number} engagementTime - Engagement time in seconds, 0-4294967295.
+ * @param {string[]} props - Custom string properties as a flat key=value list (max 32 entries, alternating key,value).
+ * @param {string} userId - Override user ID. Requires API-key auth with analytics.write scope.
+ * @param {string} ip - Override IP address. Requires API-key auth with analytics.write scope.
+ * @param {string} userAgent - Override user agent. Requires API-key auth with analytics.write scope.
+ * @throws {AppwriteException}
+ * @returns {Promise<{}>}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ createEvent(
+ propertyId: string,
+ name: string,
+ url: string,
+ domain?: string,
+ referrer?: string,
+ screenWidth?: number,
+ sessionHash?: string,
+ scrollDepth?: number,
+ engagementTime?: number,
+ props?: string[],
+ userId?: string,
+ ip?: string,
+ userAgent?: string,
+ ): Promise<{}>;
+ createEvent(
+ paramsOrFirst:
+ | {
+ propertyId: string;
+ name: string;
+ url: string;
+ domain?: string;
+ referrer?: string;
+ screenWidth?: number;
+ sessionHash?: string;
+ scrollDepth?: number;
+ engagementTime?: number;
+ props?: string[];
+ userId?: string;
+ ip?: string;
+ userAgent?: string;
+ }
+ | string,
+ ...rest: [
+ string?,
+ string?,
+ string?,
+ string?,
+ number?,
+ string?,
+ number?,
+ number?,
+ string[]?,
+ string?,
+ string?,
+ string?,
+ ]
+ ): Promise<{}> {
+ let params: {
+ propertyId: string;
+ name: string;
+ url: string;
+ domain?: string;
+ referrer?: string;
+ screenWidth?: number;
+ sessionHash?: string;
+ scrollDepth?: number;
+ engagementTime?: number;
+ props?: string[];
+ userId?: string;
+ ip?: string;
+ userAgent?: string;
+ };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ propertyId: string;
+ name: string;
+ url: string;
+ domain?: string;
+ referrer?: string;
+ screenWidth?: number;
+ sessionHash?: string;
+ scrollDepth?: number;
+ engagementTime?: number;
+ props?: string[];
+ userId?: string;
+ ip?: string;
+ userAgent?: string;
+ };
+ } else {
+ params = {
+ propertyId: paramsOrFirst as string,
+ name: rest[0] as string,
+ url: rest[1] as string,
+ domain: rest[2] as string,
+ referrer: rest[3] as string,
+ screenWidth: rest[4] as number,
+ sessionHash: rest[5] as string,
+ scrollDepth: rest[6] as number,
+ engagementTime: rest[7] as number,
+ props: rest[8] as string[],
+ userId: rest[9] as string,
+ ip: rest[10] as string,
+ userAgent: rest[11] as string,
+ };
+ }
+
+ const propertyId = params.propertyId;
+ const name = params.name;
+ const url = params.url;
+ const domain = params.domain;
+ const referrer = params.referrer;
+ const screenWidth = params.screenWidth;
+ const sessionHash = params.sessionHash;
+ const scrollDepth = params.scrollDepth;
+ const engagementTime = params.engagementTime;
+ const props = params.props;
+ const userId = params.userId;
+ const ip = params.ip;
+ const userAgent = params.userAgent;
+
+ if (typeof propertyId === 'undefined' || propertyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "propertyId"',
+ );
+ }
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+ if (typeof url === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "url"');
+ }
+ const apiPath = '/analytics/properties/{propertyId}/events'.replace(
+ '{propertyId}',
+ encodeURIComponent(String(propertyId)),
+ );
+ const apiPayload: Payload = {};
+ if (typeof name !== 'undefined') {
+ apiPayload['name'] = name;
+ }
+ if (typeof url !== 'undefined') {
+ apiPayload['url'] = url;
+ }
+ if (typeof domain !== 'undefined') {
+ apiPayload['domain'] = domain;
+ }
+ if (typeof referrer !== 'undefined') {
+ apiPayload['referrer'] = referrer;
+ }
+ if (typeof screenWidth !== 'undefined') {
+ apiPayload['screenWidth'] = screenWidth;
+ }
+ if (typeof sessionHash !== 'undefined') {
+ apiPayload['sessionHash'] = sessionHash;
+ }
+ if (typeof scrollDepth !== 'undefined') {
+ apiPayload['scrollDepth'] = scrollDepth;
+ }
+ if (typeof engagementTime !== 'undefined') {
+ apiPayload['engagementTime'] = engagementTime;
+ }
+ if (typeof props !== 'undefined') {
+ apiPayload['props'] = props;
+ }
+ if (typeof userId !== 'undefined') {
+ apiPayload['userId'] = userId;
+ }
+ if (typeof ip !== 'undefined') {
+ apiPayload['ip'] = ip;
+ }
+ if (typeof userAgent !== 'undefined') {
+ apiPayload['userAgent'] = userAgent;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ };
+
+ return this.client.call('post', uri, apiHeaders, apiPayload);
+ }
+
+ /**
+ * Read analytics metrics (visitors, sessions, pageviews, events, bounceRate, …) for a property over a date range.
+ *
+ * **Three response shapes**, chosen by `dimensions[]` and `interval`:
+ * - Neither: one row aggregating the whole window, with `value` and `date` null. Only this shape carries `pageviews`, `visits`, `bounceRate`, `visitDuration`, `viewsPerVisit`, `scrollDepth` and `engagementTime`.
+ * - `dimensions[]`: one row per dimension value, ranked by visitors, with `value` set and `date` null.
+ * - `interval`: one row per time bucket in chronological order, with `date` set and `value` null.
+ *
+ * Combining `dimensions[]` with `interval` is not supported yet. `queries[]` filters the underlying events using standard Utopia query syntax.
+ *
+ * @param {string} params.propertyId - Analytics property unique ID.
+ * @param {string[]} params.queries - Up to 10 filter queries in Utopia syntax. Allowed attributes: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, botName, botCategory, eventName. page, eventName are only accepted alongside `interval`, or with a breakdown on a dimension other than entryPage, exitPage. Allowed methods: equal, notEqual, contains, startsWith, endsWith. Example: `queries[]=equal("country", ["US"])`.
+ * @param {AnalyticsInterval} params.interval - Time bucket size. Omit (null) for a flat aggregate over the whole window. Allowed: 1h, 1d, 1w, 1m.
+ * @param {AnalyticsDimension[]} params.dimensions - Dimension to break the metrics down by. One at most for now; the parameter is a list so that cap can be raised without a breaking change. Allowed: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, entryPage, exitPage, trafficType, botName, botCategory, eventName.
+ * @param {string} params.dateRange - Date range shorthand (e.g. 7d, 30d). Ignored for any bound you supply explicitly via startAt/endAt.
+ * @param {string} params.startAt - Explicit window start in ISO 8601. Defaults to endAt minus dateRange.
+ * @param {string} params.endAt - Explicit window end in ISO 8601. Defaults to the current time.
+ * @param {number} params.limit - Maximum number of ranked values to return.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ listMetrics(params: {
+ propertyId: string;
+ queries?: string[];
+ interval?: AnalyticsInterval;
+ dimensions?: AnalyticsDimension[];
+ dateRange?: string;
+ startAt?: string;
+ endAt?: string;
+ limit?: number;
+ }): Promise;
+ /**
+ * Read analytics metrics (visitors, sessions, pageviews, events, bounceRate, …) for a property over a date range.
+ *
+ * **Three response shapes**, chosen by `dimensions[]` and `interval`:
+ * - Neither: one row aggregating the whole window, with `value` and `date` null. Only this shape carries `pageviews`, `visits`, `bounceRate`, `visitDuration`, `viewsPerVisit`, `scrollDepth` and `engagementTime`.
+ * - `dimensions[]`: one row per dimension value, ranked by visitors, with `value` set and `date` null.
+ * - `interval`: one row per time bucket in chronological order, with `date` set and `value` null.
+ *
+ * Combining `dimensions[]` with `interval` is not supported yet. `queries[]` filters the underlying events using standard Utopia query syntax.
+ *
+ * @param {string} propertyId - Analytics property unique ID.
+ * @param {string[]} queries - Up to 10 filter queries in Utopia syntax. Allowed attributes: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, botName, botCategory, eventName. page, eventName are only accepted alongside `interval`, or with a breakdown on a dimension other than entryPage, exitPage. Allowed methods: equal, notEqual, contains, startsWith, endsWith. Example: `queries[]=equal("country", ["US"])`.
+ * @param {AnalyticsInterval} interval - Time bucket size. Omit (null) for a flat aggregate over the whole window. Allowed: 1h, 1d, 1w, 1m.
+ * @param {AnalyticsDimension[]} dimensions - Dimension to break the metrics down by. One at most for now; the parameter is a list so that cap can be raised without a breaking change. Allowed: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, entryPage, exitPage, trafficType, botName, botCategory, eventName.
+ * @param {string} dateRange - Date range shorthand (e.g. 7d, 30d). Ignored for any bound you supply explicitly via startAt/endAt.
+ * @param {string} startAt - Explicit window start in ISO 8601. Defaults to endAt minus dateRange.
+ * @param {string} endAt - Explicit window end in ISO 8601. Defaults to the current time.
+ * @param {number} limit - Maximum number of ranked values to return.
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ * @deprecated Use the object parameter style method for a better developer experience.
+ */
+ listMetrics(
+ propertyId: string,
+ queries?: string[],
+ interval?: AnalyticsInterval,
+ dimensions?: AnalyticsDimension[],
+ dateRange?: string,
+ startAt?: string,
+ endAt?: string,
+ limit?: number,
+ ): Promise;
+ listMetrics(
+ paramsOrFirst:
+ | {
+ propertyId: string;
+ queries?: string[];
+ interval?: AnalyticsInterval;
+ dimensions?: AnalyticsDimension[];
+ dateRange?: string;
+ startAt?: string;
+ endAt?: string;
+ limit?: number;
+ }
+ | string,
+ ...rest: [
+ string[]?,
+ AnalyticsInterval?,
+ AnalyticsDimension[]?,
+ string?,
+ string?,
+ string?,
+ number?,
+ ]
+ ): Promise {
+ let params: {
+ propertyId: string;
+ queries?: string[];
+ interval?: AnalyticsInterval;
+ dimensions?: AnalyticsDimension[];
+ dateRange?: string;
+ startAt?: string;
+ endAt?: string;
+ limit?: number;
+ };
+
+ if (
+ paramsOrFirst &&
+ typeof paramsOrFirst === 'object' &&
+ !Array.isArray(paramsOrFirst)
+ ) {
+ params = (paramsOrFirst || {}) as {
+ propertyId: string;
+ queries?: string[];
+ interval?: AnalyticsInterval;
+ dimensions?: AnalyticsDimension[];
+ dateRange?: string;
+ startAt?: string;
+ endAt?: string;
+ limit?: number;
+ };
+ } else {
+ params = {
+ propertyId: paramsOrFirst as string,
+ queries: rest[0] as string[],
+ interval: rest[1] as AnalyticsInterval,
+ dimensions: rest[2] as AnalyticsDimension[],
+ dateRange: rest[3] as string,
+ startAt: rest[4] as string,
+ endAt: rest[5] as string,
+ limit: rest[6] as number,
+ };
+ }
+
+ const propertyId = params.propertyId;
+ const queries = params.queries;
+ const interval = params.interval;
+ const dimensions = params.dimensions;
+ const dateRange = params.dateRange;
+ const startAt = params.startAt;
+ const endAt = params.endAt;
+ const limit = params.limit;
+
+ if (typeof propertyId === 'undefined' || propertyId === '') {
+ throw new AppwriteException(
+ 'Missing required parameter: "propertyId"',
+ );
+ }
+ const apiPath = '/analytics/properties/{propertyId}/metrics'.replace(
+ '{propertyId}',
+ encodeURIComponent(String(propertyId)),
+ );
+ const apiPayload: Payload = {};
+ if (typeof queries !== 'undefined') {
+ apiPayload['queries'] = queries;
+ }
+ if (typeof interval !== 'undefined') {
+ apiPayload['interval'] = interval;
+ }
+ if (typeof dimensions !== 'undefined') {
+ apiPayload['dimensions'] = dimensions;
+ }
+ if (typeof dateRange !== 'undefined') {
+ apiPayload['dateRange'] = dateRange;
+ }
+ if (typeof startAt !== 'undefined') {
+ apiPayload['startAt'] = startAt;
+ }
+ if (typeof endAt !== 'undefined') {
+ apiPayload['endAt'] = endAt;
+ }
+ if (typeof limit !== 'undefined') {
+ apiPayload['limit'] = limit;
+ }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+
+ const apiHeaders: { [header: string]: string } = {
+ 'X-Appwrite-Project': this.client.config.project,
+ accept: 'application/json',
+ };
+
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'analyticsMetricList',
+ models: {
+ analyticsMetricList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ metrics: {
+ items: 'analyticsMetric',
+ },
+ },
+ },
+ analyticsMetric: {
+ defaults: {
+ visitors: 0,
+ sessions: 0,
+ events: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
+ }
+}
diff --git a/src/services/apps.ts b/src/services/apps.ts
index 555b8814..5a22b46c 100644
--- a/src/services/apps.ts
+++ b/src/services/apps.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Apps {
@@ -71,7 +76,70 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appsList',
+ models: {
+ appsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ apps: {
+ items: 'app',
+ },
+ },
+ },
+ app: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ description: '',
+ clientUri: '',
+ logoUri: '',
+ privacyPolicyUrl: '',
+ termsUrl: '',
+ contacts: [],
+ tagline: '',
+ tags: [],
+ labels: [],
+ images: [],
+ supportUrl: '',
+ dataDeletionUrl: '',
+ redirectUris: [],
+ postLogoutRedirectUris: [],
+ enabled: true,
+ type: 'confidential',
+ deviceFlow: false,
+ teamId: '',
+ userId: '',
+ installationScopes: [],
+ installationRedirectUrl: '',
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -382,7 +450,60 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'app',
+ models: {
+ app: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ description: '',
+ clientUri: '',
+ logoUri: '',
+ privacyPolicyUrl: '',
+ termsUrl: '',
+ contacts: [],
+ tagline: '',
+ tags: [],
+ labels: [],
+ images: [],
+ supportUrl: '',
+ dataDeletionUrl: '',
+ redirectUris: [],
+ postLogoutRedirectUris: [],
+ enabled: true,
+ type: 'confidential',
+ deviceFlow: false,
+ teamId: '',
+ userId: '',
+ installationScopes: [],
+ installationRedirectUrl: '',
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -401,7 +522,33 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appScopeList',
+ models: {
+ appScopeList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ scopes: {
+ items: 'appScope',
+ },
+ },
+ },
+ appScope: {
+ defaults: {
+ value: '',
+ description: '',
+ type: '',
+ category: '',
+ deprecated: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -420,7 +567,33 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appScopeList',
+ models: {
+ appScopeList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ scopes: {
+ items: 'appScope',
+ },
+ },
+ },
+ appScope: {
+ defaults: {
+ value: '',
+ description: '',
+ type: '',
+ category: '',
+ deprecated: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -472,7 +645,60 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'app',
+ models: {
+ app: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ description: '',
+ clientUri: '',
+ logoUri: '',
+ privacyPolicyUrl: '',
+ termsUrl: '',
+ contacts: [],
+ tagline: '',
+ tags: [],
+ labels: [],
+ images: [],
+ supportUrl: '',
+ dataDeletionUrl: '',
+ redirectUris: [],
+ postLogoutRedirectUris: [],
+ enabled: true,
+ type: 'confidential',
+ deviceFlow: false,
+ teamId: '',
+ userId: '',
+ installationScopes: [],
+ installationRedirectUrl: '',
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -791,7 +1017,60 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'app',
+ models: {
+ app: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ description: '',
+ clientUri: '',
+ logoUri: '',
+ privacyPolicyUrl: '',
+ termsUrl: '',
+ contacts: [],
+ tagline: '',
+ tags: [],
+ labels: [],
+ images: [],
+ supportUrl: '',
+ dataDeletionUrl: '',
+ redirectUris: [],
+ postLogoutRedirectUris: [],
+ enabled: true,
+ type: 'confidential',
+ deviceFlow: false,
+ teamId: '',
+ userId: '',
+ installationScopes: [],
+ installationRedirectUrl: '',
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -926,7 +1205,37 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appInstallationList',
+ models: {
+ appInstallationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ installations: {
+ items: 'appInstallation',
+ },
+ },
+ },
+ appInstallation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ teamId: '',
+ scopes: [],
+ authorizationDetails: [],
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1001,7 +1310,27 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appInstallation',
+ models: {
+ appInstallation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ teamId: '',
+ scopes: [],
+ authorizationDetails: [],
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1150,7 +1479,23 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2Token',
+ models: {
+ oauth2Token: {
+ defaults: {
+ access_token: '',
+ token_type: 'Bearer',
+ expires_in: 0,
+ refresh_token: '',
+ scope: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1232,7 +1577,36 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appKeyList',
+ models: {
+ appKeyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ keys: {
+ items: 'appKey',
+ },
+ },
+ },
+ appKey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1287,7 +1661,26 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appKey',
+ models: {
+ appKey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1348,7 +1741,26 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appKey',
+ models: {
+ appKey: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1482,7 +1894,60 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'app',
+ models: {
+ app: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ description: '',
+ clientUri: '',
+ logoUri: '',
+ privacyPolicyUrl: '',
+ termsUrl: '',
+ contacts: [],
+ tagline: '',
+ tags: [],
+ labels: [],
+ images: [],
+ supportUrl: '',
+ dataDeletionUrl: '',
+ redirectUris: [],
+ postLogoutRedirectUris: [],
+ enabled: true,
+ type: 'confidential',
+ deviceFlow: false,
+ teamId: '',
+ userId: '',
+ installationScopes: [],
+ installationRedirectUrl: '',
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1564,7 +2029,36 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appSecretList',
+ models: {
+ appSecretList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1619,7 +2113,26 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appSecretPlaintext',
+ models: {
+ appSecretPlaintext: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1688,7 +2201,26 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'appSecret',
+ models: {
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1821,7 +2353,60 @@ export class Apps {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'app',
+ models: {
+ app: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ description: '',
+ clientUri: '',
+ logoUri: '',
+ privacyPolicyUrl: '',
+ termsUrl: '',
+ contacts: [],
+ tagline: '',
+ tags: [],
+ labels: [],
+ images: [],
+ supportUrl: '',
+ dataDeletionUrl: '',
+ redirectUris: [],
+ postLogoutRedirectUris: [],
+ enabled: true,
+ type: 'confidential',
+ deviceFlow: false,
+ teamId: '',
+ userId: '',
+ installationScopes: [],
+ installationRedirectUrl: '',
+ },
+ properties: {
+ secrets: {
+ items: 'appSecret',
+ },
+ },
+ },
+ appSecret: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ appId: '',
+ secret: '',
+ hint: '',
+ createdById: '',
+ createdByName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
diff --git a/src/services/assistant.ts b/src/services/assistant.ts
deleted file mode 100644
index a8846bde..00000000
--- a/src/services/assistant.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { AppwriteException, Client, type Payload } from '../client';
-
-export class Assistant {
- client: Client;
-
- constructor(client: Client) {
- this.client = client;
- }
-
- /**
- * Send a prompt to the AI assistant and receive a response. This endpoint allows you to interact with Appwrite's AI assistant by sending questions or prompts and receiving helpful responses in real-time through a server-sent events stream.
- *
- * @param {string} params.prompt - Prompt. A string containing questions asked to the AI assistant.
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- chat(params: { prompt: string }): Promise;
- /**
- * Send a prompt to the AI assistant and receive a response. This endpoint allows you to interact with Appwrite's AI assistant by sending questions or prompts and receiving helpful responses in real-time through a server-sent events stream.
- *
- * @param {string} prompt - Prompt. A string containing questions asked to the AI assistant.
- * @throws {AppwriteException}
- * @returns {Promise}
- * @deprecated Use the object parameter style method for a better developer experience.
- */
- chat(prompt: string): Promise;
- chat(paramsOrFirst: { prompt: string } | string): Promise {
- let params: { prompt: string };
-
- if (
- paramsOrFirst &&
- typeof paramsOrFirst === 'object' &&
- !Array.isArray(paramsOrFirst)
- ) {
- params = (paramsOrFirst || {}) as { prompt: string };
- } else {
- params = {
- prompt: paramsOrFirst as string,
- };
- }
-
- const prompt = params.prompt;
-
- if (typeof prompt === 'undefined') {
- throw new AppwriteException('Missing required parameter: "prompt"');
- }
- const apiPath = '/console/assistant';
- const apiPayload: Payload = {};
- if (typeof prompt !== 'undefined') {
- apiPayload['prompt'] = prompt;
- }
- const uri = new URL(this.client.config.endpoint + apiPath);
-
- const apiHeaders: { [header: string]: string } = {
- 'X-Appwrite-Project': this.client.config.project,
- 'content-type': 'application/json',
- accept: 'text/plain',
- };
-
- return this.client.call('post', uri, apiHeaders, apiPayload, 'text');
- }
-}
diff --git a/src/services/avatars.ts b/src/services/avatars.ts
index 7242deed..930bb5ec 100644
--- a/src/services/avatars.ts
+++ b/src/services/avatars.ts
@@ -1,9 +1,9 @@
-import { Service } from '../service';
import {
AppwriteException,
Client,
type Payload,
UploadProgress,
+ applyDefaults,
} from '../client';
import type { Models } from '../models';
@@ -127,9 +127,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -244,9 +242,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -304,9 +300,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -416,9 +410,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -502,9 +494,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -617,9 +607,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -774,9 +762,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -985,9 +971,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -1312,9 +1296,7 @@ export class Avatars {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
diff --git a/src/services/backups.ts b/src/services/backups.ts
index 2a599486..9aed00ad 100644
--- a/src/services/backups.ts
+++ b/src/services/backups.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { BackupServices } from '../enums/backup-services';
@@ -60,7 +65,34 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupArchiveList',
+ models: {
+ backupArchiveList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -137,7 +169,24 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupArchive',
+ models: {
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -193,7 +242,24 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupArchive',
+ models: {
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -302,7 +368,36 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicyList',
+ models: {
+ backupPolicyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -466,7 +561,26 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -522,7 +636,26 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -640,7 +773,26 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -824,7 +976,26 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupRestoration',
+ models: {
+ backupRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ archiveId: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -878,7 +1049,36 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupRestorationList',
+ models: {
+ backupRestorationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ restorations: {
+ items: 'backupRestoration',
+ },
+ },
+ },
+ backupRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ archiveId: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -936,6 +1136,25 @@ export class Backups {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupRestoration',
+ models: {
+ backupRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ archiveId: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/console.ts b/src/services/console.ts
index 8e28091b..ce21cc34 100644
--- a/src/services/console.ts
+++ b/src/services/console.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { Platform } from '../enums/platform';
@@ -66,7 +71,35 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'campaign',
+ models: {
+ campaign: {
+ defaults: {
+ $id: '',
+ template: '',
+ title: '',
+ description: '',
+ },
+ properties: {
+ reviews: {
+ items: 'review',
+ },
+ },
+ },
+ review: {
+ defaults: {
+ name: '',
+ image: '',
+ description: '',
+ review: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -122,7 +155,25 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'coupon',
+ models: {
+ coupon: {
+ defaults: {
+ $id: '',
+ code: '',
+ credits: 0,
+ expiration: '',
+ campaign: '',
+ status: '',
+ onlyNewOrgs: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -204,7 +255,64 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'databaseList',
+ models: {
+ databaseList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ databases: {
+ items: 'database',
+ },
+ },
+ },
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -260,7 +368,42 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'consoleOAuth2ProviderList',
+ models: {
+ consoleOAuth2ProviderList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ oAuth2Providers: {
+ items: 'consoleOAuth2Provider',
+ },
+ },
+ },
+ consoleOAuth2Provider: {
+ defaults: {
+ $id: '',
+ },
+ properties: {
+ parameters: {
+ items: 'consoleOAuth2ProviderParameter',
+ },
+ },
+ },
+ consoleOAuth2ProviderParameter: {
+ defaults: {
+ $id: '',
+ name: '',
+ example: '',
+ hint: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -313,7 +456,88 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'billingPlanList',
+ models: {
+ billingPlanList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ plans: {
+ items: 'billingPlan',
+ },
+ },
+ },
+ billingPlan: {
+ defaults: {
+ $id: '',
+ name: '',
+ desc: '',
+ order: 0,
+ price: 0,
+ trial: 0,
+ bandwidth: 0,
+ storage: 0,
+ imageTransformations: 0,
+ screenshotsGenerated: 0,
+ webhooks: 0,
+ wafRules: 0,
+ projects: 0,
+ platforms: 0,
+ users: 0,
+ teams: 0,
+ databases: 0,
+ databasesReads: 0,
+ databasesWrites: 0,
+ databasesBatchSize: 0,
+ buckets: 0,
+ fileSize: 0,
+ functions: 0,
+ sites: 0,
+ executions: 0,
+ executionsRetentionCount: 1000,
+ GBHours: 0,
+ realtime: 0,
+ realtimeMessages: 0,
+ messages: 0,
+ topics: 0,
+ authPhone: 0,
+ domains: 0,
+ usageLogs: 0,
+ projectInactivityDays: 0,
+ alertLimit: 80,
+ budgetCapEnabled: false,
+ customSmtp: false,
+ emailBranding: false,
+ requiresPaymentMethod: true,
+ requiresBillingAddress: false,
+ isAvailable: true,
+ selfService: true,
+ premiumSupport: true,
+ budgeting: true,
+ supportsMockNumbers: true,
+ supportsOrganizationRoles: true,
+ supportsCredits: false,
+ supportsDedicatedDatabases: false,
+ supportsDisposableEmailValidation: false,
+ supportsCanonicalEmailValidation: false,
+ supportsFreeEmailValidation: false,
+ supportsCorporateEmailValidation: false,
+ supportsProjectSpecificRoles: false,
+ usagePerProject: true,
+ deploymentSize: 0,
+ buildSize: 0,
+ functionsIntervalMinimum: 0,
+ databasesAllowEncrypt: false,
+ databaseComputeCredit: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -367,7 +591,78 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'billingPlan',
+ models: {
+ billingPlan: {
+ defaults: {
+ $id: '',
+ name: '',
+ desc: '',
+ order: 0,
+ price: 0,
+ trial: 0,
+ bandwidth: 0,
+ storage: 0,
+ imageTransformations: 0,
+ screenshotsGenerated: 0,
+ webhooks: 0,
+ wafRules: 0,
+ projects: 0,
+ platforms: 0,
+ users: 0,
+ teams: 0,
+ databases: 0,
+ databasesReads: 0,
+ databasesWrites: 0,
+ databasesBatchSize: 0,
+ buckets: 0,
+ fileSize: 0,
+ functions: 0,
+ sites: 0,
+ executions: 0,
+ executionsRetentionCount: 1000,
+ GBHours: 0,
+ realtime: 0,
+ realtimeMessages: 0,
+ messages: 0,
+ topics: 0,
+ authPhone: 0,
+ domains: 0,
+ usageLogs: 0,
+ projectInactivityDays: 0,
+ alertLimit: 80,
+ budgetCapEnabled: false,
+ customSmtp: false,
+ emailBranding: false,
+ requiresPaymentMethod: true,
+ requiresBillingAddress: false,
+ isAvailable: true,
+ selfService: true,
+ premiumSupport: true,
+ budgeting: true,
+ supportsMockNumbers: true,
+ supportsOrganizationRoles: true,
+ supportsCredits: false,
+ supportsDedicatedDatabases: false,
+ supportsDisposableEmailValidation: false,
+ supportsCanonicalEmailValidation: false,
+ supportsFreeEmailValidation: false,
+ supportsCorporateEmailValidation: false,
+ supportsProjectSpecificRoles: false,
+ usagePerProject: true,
+ deploymentSize: 0,
+ buildSize: 0,
+ functionsIntervalMinimum: 0,
+ databasesAllowEncrypt: false,
+ databaseComputeCredit: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -387,7 +682,32 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'postgresExtensionList',
+ models: {
+ postgresExtensionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ extensions: {
+ items: 'postgresExtension',
+ },
+ },
+ },
+ postgresExtension: {
+ defaults: {
+ key: '',
+ name: '',
+ description: '',
+ category: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -443,7 +763,27 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'program',
+ models: {
+ program: {
+ defaults: {
+ $id: '',
+ title: '',
+ description: '',
+ tag: '',
+ icon: '',
+ url: '',
+ active: true,
+ external: true,
+ billingPlanId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -506,7 +846,31 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'organization',
+ models: {
+ organization: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ total: 0,
+ budgetAlerts: [75],
+ billingPlan: 'tier-0',
+ billingPlanId: 'tier-0',
+ billingEmail: '',
+ status: 'draft',
+ markedForDeletion: false,
+ platform: 'appwrite',
+ projects: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -525,7 +889,33 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'consoleRegionList',
+ models: {
+ consoleRegionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ regions: {
+ items: 'consoleRegion',
+ },
+ },
+ },
+ consoleRegion: {
+ defaults: {
+ $id: '',
+ name: '',
+ disabled: false,
+ default: false,
+ flag: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -652,7 +1042,32 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'consoleKeyScopeList',
+ models: {
+ consoleKeyScopeList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ scopes: {
+ items: 'consoleKeyScope',
+ },
+ },
+ },
+ consoleKeyScope: {
+ defaults: {
+ $id: '',
+ description: '',
+ category: '',
+ deprecated: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -706,7 +1121,32 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'consoleKeyScopeList',
+ models: {
+ consoleKeyScopeList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ scopes: {
+ items: 'consoleKeyScope',
+ },
+ },
+ },
+ consoleKeyScope: {
+ defaults: {
+ $id: '',
+ description: '',
+ category: '',
+ deprecated: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -942,7 +1382,19 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'columnList',
+ models: {
+ columnList: {
+ defaults: {
+ total: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1052,7 +1504,37 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'columnIndexList',
+ models: {
+ columnIndexList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'columnIndex',
+ },
+ },
+ },
+ columnIndex: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ status: '',
+ error: '',
+ columns: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1248,7 +1730,26 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'emailTemplate',
+ models: {
+ emailTemplate: {
+ defaults: {
+ templateId: '',
+ locale: '',
+ message: '',
+ senderName: '',
+ senderEmail: '',
+ replyToEmail: '',
+ replyToName: '',
+ subject: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1267,6 +1768,43 @@ export class Console {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'consoleVariables',
+ models: {
+ consoleVariables: {
+ defaults: {
+ _APP_DOMAIN_TARGET_CNAME: '',
+ _APP_DOMAIN_TARGET_A: '',
+ _APP_DOMAIN_TARGET_AAAA: '',
+ _APP_DOMAIN_TARGET_CAA: '',
+ _APP_USAGE_STATS: '',
+ _APP_VCS_ENABLED: false,
+ _APP_VCS_PROVIDERS: [],
+ _APP_VCS_PROVIDERS_WITH_REPOSITORY_CREATION: [],
+ _APP_VCS_PROVIDERS_WITH_PUBLIC_REPOSITORIES: [],
+ _APP_DOMAIN_ENABLED: false,
+ _APP_DOMAIN_SITES: '',
+ _APP_DOMAIN_FUNCTIONS: '',
+ _APP_OPTIONS_FORCE_HTTPS: '',
+ _APP_DOMAINS_NAMESERVERS: '',
+ _APP_DB_ADAPTER: 'mariadb',
+ supportForRelationships: true,
+ supportForOperators: true,
+ supportForSpatials: true,
+ supportForSpatialIndexNull: false,
+ supportForFulltextWildcard: true,
+ supportForMultipleFulltextIndexes: true,
+ supportForAttributeResizing: true,
+ supportForSchemas: true,
+ maxIndexLength: 768,
+ supportForIntegerIds: true,
+ _APP_CONSOLE_EMAIL_VERIFICATION: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/databases.ts b/src/services/databases.ts
index bb0b50e8..60892a14 100644
--- a/src/services/databases.ts
+++ b/src/services/databases.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { RelationshipType } from '../enums/relationship-type';
@@ -90,7 +95,64 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'databaseList',
+ models: {
+ databaseList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ databases: {
+ items: 'database',
+ },
+ },
+ },
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -181,7 +243,54 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'database',
+ models: {
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -251,7 +360,34 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transactionList',
+ models: {
+ transactionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ transactions: {
+ items: 'transaction',
+ },
+ },
+ },
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -305,7 +441,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -364,7 +517,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -455,7 +625,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -590,7 +777,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -647,7 +851,54 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'database',
+ models: {
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -733,7 +984,54 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'database',
+ models: {
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -895,7 +1193,54 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collectionList',
+ models: {
+ collectionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ collections: {
+ items: 'collection',
+ },
+ },
+ },
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1066,7 +1411,44 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collection',
+ models: {
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1144,7 +1526,44 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collection',
+ models: {
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1291,7 +1710,44 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collection',
+ models: {
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1478,7 +1934,19 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeList',
+ models: {
+ attributeList: {
+ defaults: {
+ total: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1656,7 +2124,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeBigint',
+ models: {
+ attributeBigint: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1837,7 +2322,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeBigint',
+ models: {
+ attributeBigint: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1983,7 +2485,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeBoolean',
+ models: {
+ attributeBoolean: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2130,7 +2649,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeBoolean',
+ models: {
+ attributeBoolean: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2274,7 +2810,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeDatetime',
+ models: {
+ attributeDatetime: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2421,7 +2974,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeDatetime',
+ models: {
+ attributeDatetime: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2567,7 +3137,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeEmail',
+ models: {
+ attributeEmail: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'email',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2716,7 +3304,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeEmail',
+ models: {
+ attributeEmail: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'email',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2879,7 +3485,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeEnum',
+ models: {
+ attributeEnum: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'enum',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3045,7 +3669,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeEnum',
+ models: {
+ attributeEnum: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'enum',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3223,7 +3865,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeFloat',
+ models: {
+ attributeFloat: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3404,7 +4063,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeFloat',
+ models: {
+ attributeFloat: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3582,7 +4258,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeInteger',
+ models: {
+ attributeInteger: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3763,7 +4456,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeInteger',
+ models: {
+ attributeInteger: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3909,7 +4619,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeIp',
+ models: {
+ attributeIp: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'ip',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4058,7 +4786,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeIp',
+ models: {
+ attributeIp: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'ip',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4190,7 +4936,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeLine',
+ models: {
+ attributeLine: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4332,7 +5095,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeLine',
+ models: {
+ attributeLine: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4490,7 +5270,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeLongtext',
+ models: {
+ attributeLongtext: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4639,7 +5436,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeLongtext',
+ models: {
+ attributeLongtext: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4797,7 +5611,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeMediumtext',
+ models: {
+ attributeMediumtext: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4946,7 +5777,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeMediumtext',
+ models: {
+ attributeMediumtext: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5078,7 +5926,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributePoint',
+ models: {
+ attributePoint: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5220,7 +6085,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributePoint',
+ models: {
+ attributePoint: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5352,7 +6234,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributePolygon',
+ models: {
+ attributePolygon: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5494,7 +6393,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributePolygon',
+ models: {
+ attributePolygon: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5672,7 +6588,29 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeRelationship',
+ models: {
+ attributeRelationship: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ relationType: '',
+ twoWay: false,
+ twoWayKey: '',
+ onDelete: 'restrict',
+ side: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5799,7 +6737,29 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeRelationship',
+ models: {
+ attributeRelationship: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ relationType: '',
+ twoWay: false,
+ twoWayKey: '',
+ onDelete: 'restrict',
+ side: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5980,7 +6940,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeString',
+ models: {
+ attributeString: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ size: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6141,7 +7119,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeString',
+ models: {
+ attributeString: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ size: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6299,7 +7295,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeText',
+ models: {
+ attributeText: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6448,7 +7461,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeText',
+ models: {
+ attributeText: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6594,7 +7624,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeUrl',
+ models: {
+ attributeUrl: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'url',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6743,7 +7791,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeUrl',
+ models: {
+ attributeUrl: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ format: 'url',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6924,7 +7990,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeVarchar',
+ models: {
+ attributeVarchar: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ size: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7085,7 +8169,25 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'attributeVarchar',
+ models: {
+ attributeVarchar: {
+ defaults: {
+ key: '',
+ type: '',
+ error: '',
+ required: false,
+ $createdAt: '',
+ $updatedAt: '',
+ size: 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7462,7 +8564,34 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7633,7 +8762,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7752,7 +8898,34 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7873,7 +9046,34 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7999,7 +9199,34 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -8113,7 +9340,34 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('delete', uri, apiHeaders, apiPayload);
+ const request = this.client.call('delete', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -8244,7 +9498,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -8415,7 +9686,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -8586,7 +9874,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -8864,7 +10169,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -9024,7 +10346,24 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -9135,7 +10474,36 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'indexList',
+ models: {
+ indexList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -9303,7 +10671,26 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'index',
+ models: {
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -9394,7 +10781,26 @@ export class Databases {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'index',
+ models: {
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
diff --git a/src/services/documents-db.ts b/src/services/documents-db.ts
index d3d7b57e..38293f52 100644
--- a/src/services/documents-db.ts
+++ b/src/services/documents-db.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { DocumentsDBIndexType } from '../enums/documents-db-index-type';
@@ -73,7 +78,64 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'databaseList',
+ models: {
+ databaseList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ databases: {
+ items: 'database',
+ },
+ },
+ },
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -208,7 +270,54 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'database',
+ models: {
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -227,7 +336,41 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseSpecificationList',
+ models: {
+ dedicatedDatabaseSpecificationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ specifications: {
+ items: 'dedicatedDatabaseSpecification',
+ },
+ },
+ },
+ dedicatedDatabaseSpecification: {
+ defaults: {
+ slug: '',
+ name: '',
+ price: 0,
+ storageOverageRate: 0,
+ bandwidthOverageRate: 0,
+ replicaRate: 0,
+ pitrRate: 0,
+ cpu: 0,
+ memory: 0,
+ maxConnections: 0,
+ includedStorage: 0,
+ includedBandwidth: 0,
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -296,7 +439,34 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transactionList',
+ models: {
+ transactionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ transactions: {
+ items: 'transaction',
+ },
+ },
+ },
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -349,7 +519,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -407,7 +594,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -497,7 +701,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'transaction',
+ models: {
+ transaction: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: 'pending',
+ operations: 0,
+ expiresAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -610,7 +831,54 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'database',
+ models: {
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -743,7 +1011,54 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'database',
+ models: {
+ database: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ enabled: true,
+ type: 'legacy',
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ archives: {
+ items: 'backupArchive',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ backupArchive: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ policyId: '',
+ status: '',
+ migrationId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -903,7 +1218,54 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collectionList',
+ models: {
+ collectionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ collections: {
+ items: 'collection',
+ },
+ },
+ },
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1073,7 +1435,44 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collection',
+ models: {
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1150,7 +1549,44 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collection',
+ models: {
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1299,7 +1735,44 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'collection',
+ models: {
+ collection: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ databaseId: '',
+ name: '',
+ enabled: true,
+ documentSecurity: false,
+ bytesMax: 0,
+ bytesUsed: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1510,7 +1983,34 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1680,7 +2180,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1798,7 +2315,34 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1918,7 +2462,34 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2043,7 +2614,34 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2156,7 +2754,34 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('delete', uri, apiHeaders, apiPayload);
+ const request = this.client.call('delete', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'documentList',
+ models: {
+ documentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ documents: {
+ items: 'document',
+ },
+ },
+ },
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2286,7 +2911,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2456,7 +3098,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2626,7 +3285,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2902,7 +3578,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3061,7 +3754,24 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'document',
+ models: {
+ document: {
+ defaults: {
+ $id: '',
+ $sequence: '',
+ $collectionId: '',
+ $databaseId: '',
+ $createdAt: '',
+ $updatedAt: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3171,7 +3881,36 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'indexList',
+ models: {
+ indexList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ indexes: {
+ items: 'index',
+ },
+ },
+ },
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3338,7 +4077,26 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'index',
+ models: {
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3428,7 +4186,26 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'index',
+ models: {
+ index: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ type: '',
+ error: '',
+ attributes: [],
+ lengths: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3594,7 +4371,63 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3699,7 +4532,36 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseOperationList',
+ models: {
+ dedicatedDatabaseOperationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ operations: {
+ items: 'dedicatedDatabaseOperation',
+ },
+ },
+ },
+ dedicatedDatabaseOperation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ type: '',
+ status: '',
+ attempts: 0,
+ errorCode: '',
+ errorMessage: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3757,7 +4619,35 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseReplicas',
+ models: {
+ dedicatedDatabaseReplicas: {
+ defaults: {
+ replicas: 0,
+ syncMode: 'async',
+ syncDegraded: false,
+ syncAcknowledgements: 0,
+ syncStandbyCount: 0,
+ },
+ properties: {
+ members: {
+ items: 'dedicatedDatabaseMember',
+ },
+ },
+ },
+ dedicatedDatabaseMember: {
+ defaults: {
+ $id: '',
+ role: 'unknown',
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3813,6 +4703,49 @@ export class DocumentsDB {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'databaseStatus',
+ models: {
+ databaseStatus: {
+ defaults: {
+ health: 'unknown',
+ ready: false,
+ engine: 'postgresql',
+ version: '',
+ uptime: 0,
+ syncMode: 'async',
+ syncDegraded: false,
+ syncAcknowledgements: 0,
+ syncStandbyCount: 0,
+ },
+ properties: {
+ replicas: {
+ items: 'databaseStatusReplica',
+ },
+ volumes: {
+ items: 'databaseStatusVolume',
+ },
+ },
+ },
+ databaseStatusReplica: {
+ defaults: {
+ index: 0,
+ role: 'unknown',
+ healthy: false,
+ },
+ },
+ databaseStatusVolume: {
+ defaults: {
+ path: '',
+ usedPercent: '0%',
+ available: '0GB',
+ mounted: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/domains.ts b/src/services/domains.ts
index 26430644..e9956fbf 100644
--- a/src/services/domains.ts
+++ b/src/services/domains.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { DomainRegistrationType } from '../enums/domain-registration-type';
@@ -73,7 +78,60 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainsList',
+ models: {
+ domainsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ domains: {
+ items: 'domain',
+ },
+ },
+ },
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -142,7 +200,50 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -234,7 +335,24 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainPrice',
+ models: {
+ domainPrice: {
+ defaults: {
+ domain: '',
+ tld: '',
+ available: false,
+ periodYears: 1,
+ premium: false,
+ renewalPeriodYears: 1,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -327,7 +445,34 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainPricesList',
+ models: {
+ domainPricesList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ prices: {
+ items: 'domainPrice',
+ },
+ },
+ },
+ domainPrice: {
+ defaults: {
+ domain: '',
+ tld: '',
+ available: false,
+ periodYears: 1,
+ premium: false,
+ renewalPeriodYears: 1,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -570,7 +715,28 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainPurchase',
+ models: {
+ domainPurchase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domainId: '',
+ domain: '',
+ organizationId: '',
+ status: 'pending',
+ clientSecret: '',
+ amount: 0,
+ currency: 'USD',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -649,7 +815,28 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainPurchase',
+ models: {
+ domainPurchase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domainId: '',
+ domain: '',
+ organizationId: '',
+ status: 'pending',
+ clientSecret: '',
+ amount: 0,
+ currency: 'USD',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -776,7 +963,31 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainSuggestionsList',
+ models: {
+ domainSuggestionsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ suggestions: {
+ items: 'domainSuggestion',
+ },
+ },
+ },
+ domainSuggestion: {
+ defaults: {
+ domain: '',
+ premium: false,
+ available: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -907,7 +1118,28 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainPurchase',
+ models: {
+ domainPurchase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domainId: '',
+ domain: '',
+ organizationId: '',
+ status: 'pending',
+ clientSecret: '',
+ amount: 0,
+ currency: 'USD',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -986,7 +1218,28 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainPurchase',
+ models: {
+ domainPurchase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domainId: '',
+ domain: '',
+ organizationId: '',
+ status: 'pending',
+ clientSecret: '',
+ amount: 0,
+ currency: 'USD',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1065,7 +1318,19 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainTransferOut',
+ models: {
+ domainTransferOut: {
+ defaults: {
+ authCode: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1119,7 +1384,50 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1255,7 +1563,50 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1331,7 +1682,50 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1392,7 +1786,50 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1450,7 +1887,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1513,7 +1983,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1571,7 +2074,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1632,7 +2168,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1690,7 +2259,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1751,7 +2353,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1809,7 +2444,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1870,7 +2538,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1928,7 +2629,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1989,7 +2723,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2045,7 +2812,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2106,7 +2906,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2181,7 +3014,40 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecordsList',
+ models: {
+ dnsRecordsList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2310,7 +3176,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2454,7 +3343,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2583,7 +3495,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2727,7 +3662,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2858,7 +3816,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3006,7 +3987,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3135,7 +4139,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3279,7 +4306,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3414,7 +4464,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3554,7 +4627,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3683,7 +4779,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3827,7 +4946,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3977,7 +5119,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4134,7 +5299,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4263,7 +5451,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4409,7 +5620,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4587,7 +5821,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4809,7 +6066,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4937,7 +6217,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5083,7 +6386,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5162,7 +6488,30 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dnsRecord',
+ models: {
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5315,7 +6664,50 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5373,7 +6765,21 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domainTransferStatus',
+ models: {
+ domainTransferStatus: {
+ defaults: {
+ status: 'pending_registry',
+ reason: '',
+ timestamp: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5507,6 +6913,49 @@ export class Domains {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'domain',
+ models: {
+ domain: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ domain: '',
+ registrar: '',
+ nameservers: '',
+ expire: '',
+ renewal: '',
+ autoRenewal: false,
+ renewalPrice: 0,
+ teamId: '',
+ },
+ properties: {
+ dnsRecords: {
+ items: 'dnsRecord',
+ },
+ },
+ },
+ dnsRecord: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ name: '',
+ value: '',
+ ttl: 3600,
+ priority: 0,
+ lock: false,
+ weight: 0,
+ port: 0,
+ comment: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/embeddings.ts b/src/services/embeddings.ts
index e09a2c34..45e97805 100644
--- a/src/services/embeddings.ts
+++ b/src/services/embeddings.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { EmbeddingModel } from '../enums/embedding-model';
@@ -80,6 +85,31 @@ export class Embeddings {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'embeddingList',
+ models: {
+ embeddingList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ embeddings: {
+ items: 'embedding',
+ },
+ },
+ },
+ embedding: {
+ defaults: {
+ model: '',
+ dimension: 0,
+ embedding: [],
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/functions.ts b/src/services/functions.ts
index e1ae628c..d42126ca 100644
--- a/src/services/functions.ts
+++ b/src/services/functions.ts
@@ -1,9 +1,9 @@
-import { Service } from '../service';
import {
AppwriteException,
Client,
type Payload,
UploadProgress,
+ applyDefaults,
} from '../client';
import type { Models } from '../models';
@@ -98,7 +98,76 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'functionList',
+ models: {
+ functionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ functions: {
+ items: 'function',
+ },
+ },
+ },
+ function: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ execute: [],
+ name: '',
+ enabled: true,
+ live: true,
+ logging: true,
+ runtime: '',
+ deploymentRetention: 0,
+ deploymentId: '',
+ deploymentCreatedAt: '',
+ latestDeploymentId: '',
+ latestDeploymentCreatedAt: '',
+ latestDeploymentStatus: '',
+ scopes: [],
+ events: [],
+ schedule: '',
+ timeout: 15,
+ entrypoint: '',
+ commands: '',
+ version: 'v5',
+ installationId: '',
+ providerRepositoryId: '',
+ providerBranch: '',
+ providerRootDirectory: '',
+ providerSilentMode: false,
+ providerBranches: [],
+ providerPaths: [],
+ buildSpecification: 's-1vcpu-512mb',
+ runtimeSpecification: 's-1vcpu-512mb',
+ },
+ properties: {
+ vars: {
+ items: 'variable',
+ },
+ },
+ },
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -463,7 +532,66 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'function',
+ models: {
+ function: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ execute: [],
+ name: '',
+ enabled: true,
+ live: true,
+ logging: true,
+ runtime: '',
+ deploymentRetention: 0,
+ deploymentId: '',
+ deploymentCreatedAt: '',
+ latestDeploymentId: '',
+ latestDeploymentCreatedAt: '',
+ latestDeploymentStatus: '',
+ scopes: [],
+ events: [],
+ schedule: '',
+ timeout: 15,
+ entrypoint: '',
+ commands: '',
+ version: 'v5',
+ installationId: '',
+ providerRepositoryId: '',
+ providerBranch: '',
+ providerRootDirectory: '',
+ providerSilentMode: false,
+ providerBranches: [],
+ providerPaths: [],
+ buildSpecification: 's-1vcpu-512mb',
+ runtimeSpecification: 's-1vcpu-512mb',
+ },
+ properties: {
+ vars: {
+ items: 'variable',
+ },
+ },
+ },
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -515,7 +643,35 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'runtimeList',
+ models: {
+ runtimeList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ runtimes: {
+ items: 'runtime',
+ },
+ },
+ },
+ runtime: {
+ defaults: {
+ $id: '',
+ key: '',
+ name: '',
+ version: '',
+ base: '',
+ image: '',
+ logo: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -584,7 +740,32 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'specificationList',
+ models: {
+ specificationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ specifications: {
+ items: 'specification',
+ },
+ },
+ },
+ specification: {
+ defaults: {
+ memory: 0,
+ cpus: 0,
+ enabled: false,
+ slug: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -702,7 +883,70 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'templateFunctionList',
+ models: {
+ templateFunctionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ templates: {
+ items: 'templateFunction',
+ },
+ },
+ },
+ templateFunction: {
+ defaults: {
+ icon: '',
+ id: '',
+ name: '',
+ tagline: '',
+ permissions: [],
+ events: [],
+ cron: '',
+ timeout: 15,
+ useCases: [],
+ instructions: '',
+ vcsProvider: '',
+ providerRepositoryId: '',
+ providerOwner: '',
+ providerVersion: '',
+ scopes: [],
+ },
+ properties: {
+ runtimes: {
+ items: 'templateRuntime',
+ },
+ variables: {
+ items: 'templateVariable',
+ },
+ },
+ },
+ templateRuntime: {
+ defaults: {
+ name: '',
+ commands: '',
+ entrypoint: '',
+ providerRootDirectory: '',
+ },
+ },
+ templateVariable: {
+ defaults: {
+ name: '',
+ description: '',
+ value: '',
+ secret: false,
+ placeholder: '',
+ required: false,
+ type: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -760,7 +1004,60 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'templateFunction',
+ models: {
+ templateFunction: {
+ defaults: {
+ icon: '',
+ id: '',
+ name: '',
+ tagline: '',
+ permissions: [],
+ events: [],
+ cron: '',
+ timeout: 15,
+ useCases: [],
+ instructions: '',
+ vcsProvider: '',
+ providerRepositoryId: '',
+ providerOwner: '',
+ providerVersion: '',
+ scopes: [],
+ },
+ properties: {
+ runtimes: {
+ items: 'templateRuntime',
+ },
+ variables: {
+ items: 'templateVariable',
+ },
+ },
+ },
+ templateRuntime: {
+ defaults: {
+ name: '',
+ commands: '',
+ entrypoint: '',
+ providerRootDirectory: '',
+ },
+ },
+ templateVariable: {
+ defaults: {
+ name: '',
+ description: '',
+ value: '',
+ secret: false,
+ placeholder: '',
+ required: false,
+ type: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -816,7 +1113,66 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'function',
+ models: {
+ function: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ execute: [],
+ name: '',
+ enabled: true,
+ live: true,
+ logging: true,
+ runtime: '',
+ deploymentRetention: 0,
+ deploymentId: '',
+ deploymentCreatedAt: '',
+ latestDeploymentId: '',
+ latestDeploymentCreatedAt: '',
+ latestDeploymentStatus: '',
+ scopes: [],
+ events: [],
+ schedule: '',
+ timeout: 15,
+ entrypoint: '',
+ commands: '',
+ version: 'v5',
+ installationId: '',
+ providerRepositoryId: '',
+ providerBranch: '',
+ providerRootDirectory: '',
+ providerSilentMode: false,
+ providerBranches: [],
+ providerPaths: [],
+ buildSpecification: 's-1vcpu-512mb',
+ runtimeSpecification: 's-1vcpu-512mb',
+ },
+ properties: {
+ vars: {
+ items: 'variable',
+ },
+ },
+ },
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1176,7 +1532,66 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'function',
+ models: {
+ function: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ execute: [],
+ name: '',
+ enabled: true,
+ live: true,
+ logging: true,
+ runtime: '',
+ deploymentRetention: 0,
+ deploymentId: '',
+ deploymentCreatedAt: '',
+ latestDeploymentId: '',
+ latestDeploymentCreatedAt: '',
+ latestDeploymentStatus: '',
+ scopes: [],
+ events: [],
+ schedule: '',
+ timeout: 15,
+ entrypoint: '',
+ commands: '',
+ version: 'v5',
+ installationId: '',
+ providerRepositoryId: '',
+ providerBranch: '',
+ providerRootDirectory: '',
+ providerSilentMode: false,
+ providerBranches: [],
+ providerPaths: [],
+ buildSpecification: 's-1vcpu-512mb',
+ runtimeSpecification: 's-1vcpu-512mb',
+ },
+ properties: {
+ vars: {
+ items: 'variable',
+ },
+ },
+ },
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1310,7 +1725,66 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'function',
+ models: {
+ function: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ execute: [],
+ name: '',
+ enabled: true,
+ live: true,
+ logging: true,
+ runtime: '',
+ deploymentRetention: 0,
+ deploymentId: '',
+ deploymentCreatedAt: '',
+ latestDeploymentId: '',
+ latestDeploymentCreatedAt: '',
+ latestDeploymentStatus: '',
+ scopes: [],
+ events: [],
+ schedule: '',
+ timeout: 15,
+ entrypoint: '',
+ commands: '',
+ version: 'v5',
+ installationId: '',
+ providerRepositoryId: '',
+ providerBranch: '',
+ providerRootDirectory: '',
+ providerSilentMode: false,
+ providerBranches: [],
+ providerPaths: [],
+ buildSpecification: 's-1vcpu-512mb',
+ runtimeSpecification: 's-1vcpu-512mb',
+ },
+ properties: {
+ vars: {
+ items: 'variable',
+ },
+ },
+ },
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1415,7 +1889,54 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'deploymentList',
+ models: {
+ deploymentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ deployments: {
+ items: 'deployment',
+ },
+ },
+ },
+ deployment: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ resourceId: '',
+ resourceType: '',
+ entrypoint: '',
+ sourceSize: 0,
+ buildSize: 0,
+ totalSize: 0,
+ buildId: '',
+ activate: false,
+ screenshotLight: '',
+ screenshotDark: '',
+ buildLogs: '',
+ buildDuration: 0,
+ providerRepositoryName: '',
+ providerRepositoryOwner: '',
+ providerRepositoryUrl: '',
+ providerCommitHash: '',
+ providerCommitAuthorUrl: '',
+ providerCommitAuthor: '',
+ providerCommitMessage: '',
+ providerCommitUrl: '',
+ providerBranch: '',
+ providerBranchUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1664,7 +2185,44 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'deployment',
+ models: {
+ deployment: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ resourceId: '',
+ resourceType: '',
+ entrypoint: '',
+ sourceSize: 0,
+ buildSize: 0,
+ totalSize: 0,
+ buildId: '',
+ activate: false,
+ screenshotLight: '',
+ screenshotDark: '',
+ buildLogs: '',
+ buildDuration: 0,
+ providerRepositoryName: '',
+ providerRepositoryOwner: '',
+ providerRepositoryUrl: '',
+ providerCommitHash: '',
+ providerCommitAuthorUrl: '',
+ providerCommitAuthor: '',
+ providerCommitMessage: '',
+ providerCommitUrl: '',
+ providerBranch: '',
+ providerBranchUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1838,7 +2396,44 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'deployment',
+ models: {
+ deployment: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ resourceId: '',
+ resourceType: '',
+ entrypoint: '',
+ sourceSize: 0,
+ buildSize: 0,
+ totalSize: 0,
+ buildId: '',
+ activate: false,
+ screenshotLight: '',
+ screenshotDark: '',
+ buildLogs: '',
+ buildDuration: 0,
+ providerRepositoryName: '',
+ providerRepositoryOwner: '',
+ providerRepositoryUrl: '',
+ providerCommitHash: '',
+ providerCommitAuthorUrl: '',
+ providerCommitAuthor: '',
+ providerCommitMessage: '',
+ providerCommitUrl: '',
+ providerBranch: '',
+ providerBranchUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1956,7 +2551,44 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'deployment',
+ models: {
+ deployment: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ resourceId: '',
+ resourceType: '',
+ entrypoint: '',
+ sourceSize: 0,
+ buildSize: 0,
+ totalSize: 0,
+ buildId: '',
+ activate: false,
+ screenshotLight: '',
+ screenshotDark: '',
+ buildLogs: '',
+ buildDuration: 0,
+ providerRepositoryName: '',
+ providerRepositoryOwner: '',
+ providerRepositoryUrl: '',
+ providerCommitHash: '',
+ providerCommitAuthorUrl: '',
+ providerCommitAuthor: '',
+ providerCommitMessage: '',
+ providerCommitUrl: '',
+ providerBranch: '',
+ providerBranchUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2033,7 +2665,44 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'deployment',
+ models: {
+ deployment: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ resourceId: '',
+ resourceType: '',
+ entrypoint: '',
+ sourceSize: 0,
+ buildSize: 0,
+ totalSize: 0,
+ buildId: '',
+ activate: false,
+ screenshotLight: '',
+ screenshotDark: '',
+ buildLogs: '',
+ buildDuration: 0,
+ providerRepositoryName: '',
+ providerRepositoryOwner: '',
+ providerRepositoryUrl: '',
+ providerCommitHash: '',
+ providerCommitAuthorUrl: '',
+ providerCommitAuthor: '',
+ providerCommitMessage: '',
+ providerCommitUrl: '',
+ providerBranch: '',
+ providerBranchUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2216,9 +2885,7 @@ export class Functions {
apiPayload['project'] = this.client.config.project;
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
- for (const [key, value] of Object.entries(
- Service.flatten(apiPayload),
- )) {
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
uri.searchParams.append(key, value);
}
@@ -2301,7 +2968,44 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'deployment',
+ models: {
+ deployment: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: '',
+ resourceId: '',
+ resourceType: '',
+ entrypoint: '',
+ sourceSize: 0,
+ buildSize: 0,
+ totalSize: 0,
+ buildId: '',
+ activate: false,
+ screenshotLight: '',
+ screenshotDark: '',
+ buildLogs: '',
+ buildDuration: 0,
+ providerRepositoryName: '',
+ providerRepositoryOwner: '',
+ providerRepositoryUrl: '',
+ providerCommitHash: '',
+ providerCommitAuthorUrl: '',
+ providerCommitAuthor: '',
+ providerCommitMessage: '',
+ providerCommitUrl: '',
+ providerBranch: '',
+ providerBranchUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2386,7 +3090,55 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'executionList',
+ models: {
+ executionList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ executions: {
+ items: 'execution',
+ },
+ },
+ },
+ execution: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ resourceId: '',
+ resourceType: 'functions',
+ deploymentId: '',
+ requestMethod: '',
+ requestPath: '',
+ responseStatusCode: 0,
+ responseBody: '',
+ logs: '',
+ errors: '',
+ duration: 0,
+ },
+ properties: {
+ requestHeaders: {
+ items: 'headers',
+ },
+ responseHeaders: {
+ items: 'headers',
+ },
+ },
+ },
+ headers: {
+ defaults: {
+ name: '',
+ value: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2535,7 +3287,45 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'execution',
+ models: {
+ execution: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ resourceId: '',
+ resourceType: 'functions',
+ deploymentId: '',
+ requestMethod: '',
+ requestPath: '',
+ responseStatusCode: 0,
+ responseBody: '',
+ logs: '',
+ errors: '',
+ duration: 0,
+ },
+ properties: {
+ requestHeaders: {
+ items: 'headers',
+ },
+ responseHeaders: {
+ items: 'headers',
+ },
+ },
+ },
+ headers: {
+ defaults: {
+ name: '',
+ value: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2609,7 +3399,45 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'execution',
+ models: {
+ execution: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ resourceId: '',
+ resourceType: 'functions',
+ deploymentId: '',
+ requestMethod: '',
+ requestPath: '',
+ responseStatusCode: 0,
+ responseBody: '',
+ logs: '',
+ errors: '',
+ duration: 0,
+ },
+ properties: {
+ requestHeaders: {
+ items: 'headers',
+ },
+ responseHeaders: {
+ items: 'headers',
+ },
+ },
+ },
+ headers: {
+ defaults: {
+ name: '',
+ value: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2766,7 +3594,36 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'variableList',
+ models: {
+ variableList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ variables: {
+ items: 'variable',
+ },
+ },
+ },
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2895,7 +3752,26 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'variable',
+ models: {
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2969,7 +3845,26 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'variable',
+ models: {
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3088,7 +3983,26 @@ export class Functions {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'variable',
+ models: {
+ variable: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ key: '',
+ value: '',
+ secret: false,
+ resourceType: '',
+ resourceId: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
diff --git a/src/services/growth.ts b/src/services/growth.ts
index bb72c8fe..1ae4122c 100644
--- a/src/services/growth.ts
+++ b/src/services/growth.ts
@@ -3,6 +3,7 @@ import {
Client,
type Payload,
UploadProgress,
+ applyDefaults,
} from '../client';
import type { Models } from '../models';
diff --git a/src/services/locale.ts b/src/services/locale.ts
index d7e6a828..d721721a 100644
--- a/src/services/locale.ts
+++ b/src/services/locale.ts
@@ -1,4 +1,4 @@
-import { Client, type Payload } from '../client';
+import { Client, type Payload, applyDefaults } from '../client';
import type { Models } from '../models';
export class Locale {
@@ -26,7 +26,25 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'locale',
+ models: {
+ locale: {
+ defaults: {
+ ip: '',
+ countryCode: '',
+ country: '',
+ continentCode: '',
+ continent: '',
+ eu: false,
+ currency: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -78,7 +96,30 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'localeCodeList',
+ models: {
+ localeCodeList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ localeCodes: {
+ items: 'localeCode',
+ },
+ },
+ },
+ localeCode: {
+ defaults: {
+ code: '',
+ name: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -130,7 +171,30 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'continentList',
+ models: {
+ continentList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ continents: {
+ items: 'continent',
+ },
+ },
+ },
+ continent: {
+ defaults: {
+ name: '',
+ code: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -182,7 +246,30 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'countryList',
+ models: {
+ countryList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ countries: {
+ items: 'country',
+ },
+ },
+ },
+ country: {
+ defaults: {
+ name: '',
+ code: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -234,7 +321,30 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'countryList',
+ models: {
+ countryList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ countries: {
+ items: 'country',
+ },
+ },
+ },
+ country: {
+ defaults: {
+ name: '',
+ code: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -288,7 +398,31 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'phoneList',
+ models: {
+ phoneList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ phones: {
+ items: 'phone',
+ },
+ },
+ },
+ phone: {
+ defaults: {
+ code: '',
+ countryCode: '',
+ countryName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -340,7 +474,35 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'currencyList',
+ models: {
+ currencyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ currencies: {
+ items: 'currency',
+ },
+ },
+ },
+ currency: {
+ defaults: {
+ symbol: '',
+ name: '',
+ symbolNative: '',
+ decimalDigits: 0,
+ rounding: 0,
+ code: '',
+ namePlural: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -392,6 +554,30 @@ export class Locale {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'languageList',
+ models: {
+ languageList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ languages: {
+ items: 'language',
+ },
+ },
+ },
+ language: {
+ defaults: {
+ name: '',
+ code: '',
+ nativeName: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/manager.ts b/src/services/manager.ts
index 736aff81..767bda67 100644
--- a/src/services/manager.ts
+++ b/src/services/manager.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { BlockResourceType } from '../enums/block-resource-type';
@@ -144,7 +149,27 @@ export class Manager {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'managerBlock',
+ models: {
+ managerBlock: {
+ defaults: {
+ $createdAt: '',
+ resourceType: '',
+ resourceId: '',
+ mode: 'full',
+ projectName: '',
+ region: '',
+ organizationName: '',
+ organizationId: '',
+ billingPlan: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -242,7 +267,37 @@ export class Manager {
accept: 'application/json',
};
- return this.client.call('delete', uri, apiHeaders, apiPayload);
+ const request = this.client.call('delete', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'managerBlockDelete',
+ models: {
+ managerBlockDelete: {
+ defaults: {
+ deleted: 0,
+ },
+ properties: {
+ blocks: {
+ items: 'managerBlock',
+ },
+ },
+ },
+ managerBlock: {
+ defaults: {
+ $createdAt: '',
+ resourceType: '',
+ resourceId: '',
+ mode: 'full',
+ projectName: '',
+ region: '',
+ organizationName: '',
+ organizationId: '',
+ billingPlan: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -297,7 +352,37 @@ export class Manager {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'managerBlockList',
+ models: {
+ managerBlockList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ blocks: {
+ items: 'managerBlock',
+ },
+ },
+ },
+ managerBlock: {
+ defaults: {
+ $createdAt: '',
+ resourceType: '',
+ resourceId: '',
+ mode: 'full',
+ projectName: '',
+ region: '',
+ organizationName: '',
+ organizationId: '',
+ billingPlan: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -539,7 +624,31 @@ export class Manager {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'organization',
+ models: {
+ organization: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ total: 0,
+ budgetAlerts: [75],
+ billingPlan: 'tier-0',
+ billingPlanId: 'tier-0',
+ billingEmail: '',
+ status: 'draft',
+ markedForDeletion: false,
+ platform: 'appwrite',
+ projects: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -648,6 +757,48 @@ export class Manager {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'user',
+ models: {
+ user: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ registration: '',
+ status: true,
+ labels: [],
+ passwordUpdate: '',
+ email: '',
+ phone: '',
+ emailVerification: false,
+ phoneVerification: false,
+ mfa: false,
+ accessedAt: '',
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/messaging.ts b/src/services/messaging.ts
index 56c5812b..d75d58d7 100644
--- a/src/services/messaging.ts
+++ b/src/services/messaging.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { MessagePriority } from '../enums/message-priority';
@@ -87,7 +92,35 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'messageList',
+ models: {
+ messageList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ messages: {
+ items: 'message',
+ },
+ },
+ },
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -337,7 +370,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -579,7 +630,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -897,7 +966,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1217,7 +1304,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1365,7 +1470,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1512,7 +1635,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1657,7 +1798,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1801,7 +1960,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1859,7 +2036,25 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'message',
+ models: {
+ message: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ providerType: '',
+ deliveredTotal: 0,
+ data: [],
+ status: 'draft',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1998,7 +2193,36 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'targetList',
+ models: {
+ targetList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ targets: {
+ items: 'target',
+ },
+ },
+ },
+ target: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ userId: '',
+ providerType: '',
+ identifier: '',
+ expired: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2078,7 +2302,36 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'providerList',
+ models: {
+ providerList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ providers: {
+ items: 'provider',
+ },
+ },
+ },
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2244,7 +2497,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2409,7 +2681,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2572,7 +2863,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2734,7 +3044,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2855,7 +3184,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2973,7 +3321,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3083,7 +3450,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3192,7 +3578,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3299,7 +3704,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3405,7 +3829,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3596,7 +4039,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3784,7 +4246,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3917,7 +4398,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4047,7 +4547,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4212,7 +4731,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4374,7 +4912,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4539,7 +5096,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4701,7 +5277,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -4892,7 +5487,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5080,7 +5694,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5327,7 +5960,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5573,7 +6225,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -5814,7 +6485,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6054,7 +6744,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6187,7 +6896,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6317,7 +7045,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6450,7 +7197,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6580,7 +7346,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6713,7 +7498,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6843,7 +7647,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -6976,7 +7799,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7106,7 +7948,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7164,7 +8025,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'provider',
+ models: {
+ provider: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ provider: '',
+ enabled: true,
+ type: '',
+ credentials: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7301,7 +8181,36 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'topicList',
+ models: {
+ topicList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ topics: {
+ items: 'topic',
+ },
+ },
+ },
+ topic: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ emailTotal: 0,
+ smsTotal: 0,
+ pushTotal: 0,
+ subscribe: ['users'],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7422,7 +8331,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'topic',
+ models: {
+ topic: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ emailTotal: 0,
+ smsTotal: 0,
+ pushTotal: 0,
+ subscribe: ['users'],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7480,7 +8408,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'topic',
+ models: {
+ topic: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ emailTotal: 0,
+ smsTotal: 0,
+ pushTotal: 0,
+ subscribe: ['users'],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7600,7 +8547,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'topic',
+ models: {
+ topic: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ name: '',
+ emailTotal: 0,
+ smsTotal: 0,
+ pushTotal: 0,
+ subscribe: ['users'],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7760,7 +8726,36 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'subscriberList',
+ models: {
+ subscriberList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ subscribers: {
+ items: 'subscriber',
+ },
+ },
+ },
+ subscriber: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ targetId: '',
+ userId: '',
+ userName: '',
+ topicId: '',
+ providerType: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7856,7 +8851,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'subscriber',
+ models: {
+ subscriber: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ targetId: '',
+ userId: '',
+ userName: '',
+ topicId: '',
+ providerType: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -7935,7 +8949,26 @@ export class Messaging {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'subscriber',
+ models: {
+ subscriber: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ targetId: '',
+ userId: '',
+ userName: '',
+ topicId: '',
+ providerType: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
diff --git a/src/services/migrations.ts b/src/services/migrations.ts
index b3cccc14..df0abee2 100644
--- a/src/services/migrations.ts
+++ b/src/services/migrations.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
import { AppwriteMigrationResource } from '../enums/appwrite-migration-resource';
@@ -90,7 +95,49 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migrationList',
+ models: {
+ migrationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ migrations: {
+ items: 'migration',
+ },
+ },
+ },
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -226,7 +273,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -348,7 +427,46 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migrationReport',
+ models: {
+ migrationReport: {
+ defaults: {
+ user: 0,
+ team: 0,
+ database: 0,
+ row: 0,
+ file: 0,
+ bucket: 0,
+ function: 0,
+ platform: 0,
+ 'api-key': 0,
+ 'project-variable': 0,
+ webhook: 0,
+ 'auth-methods': 0,
+ 'project-protocols': 0,
+ 'project-labels': 0,
+ 'project-services': 0,
+ policies: 0,
+ smtp: 0,
+ rule: 0,
+ 'project-email-template': 0,
+ site: 0,
+ provider: 0,
+ topic: 0,
+ subscriber: 0,
+ message: 0,
+ size: 0,
+ version: '',
+ 'oauth2-provider': 0,
+ 'backup-policy': 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -546,7 +664,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -689,7 +839,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -774,7 +956,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -858,7 +1072,46 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migrationReport',
+ models: {
+ migrationReport: {
+ defaults: {
+ user: 0,
+ team: 0,
+ database: 0,
+ row: 0,
+ file: 0,
+ bucket: 0,
+ function: 0,
+ platform: 0,
+ 'api-key': 0,
+ 'project-variable': 0,
+ webhook: 0,
+ 'auth-methods': 0,
+ 'project-protocols': 0,
+ 'project-labels': 0,
+ 'project-services': 0,
+ policies: 0,
+ smtp: 0,
+ rule: 0,
+ 'project-email-template': 0,
+ site: 0,
+ provider: 0,
+ topic: 0,
+ subscriber: 0,
+ message: 0,
+ size: 0,
+ version: '',
+ 'oauth2-provider': 0,
+ 'backup-policy': 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1000,7 +1253,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1145,7 +1430,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1335,7 +1652,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1524,7 +1873,46 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migrationReport',
+ models: {
+ migrationReport: {
+ defaults: {
+ user: 0,
+ team: 0,
+ database: 0,
+ row: 0,
+ file: 0,
+ bucket: 0,
+ function: 0,
+ platform: 0,
+ 'api-key': 0,
+ 'project-variable': 0,
+ webhook: 0,
+ 'auth-methods': 0,
+ 'project-protocols': 0,
+ 'project-labels': 0,
+ 'project-services': 0,
+ policies: 0,
+ smtp: 0,
+ rule: 0,
+ 'project-email-template': 0,
+ site: 0,
+ provider: 0,
+ topic: 0,
+ subscriber: 0,
+ message: 0,
+ size: 0,
+ version: '',
+ 'oauth2-provider': 0,
+ 'backup-policy': 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1696,7 +2084,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1867,7 +2287,46 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migrationReport',
+ models: {
+ migrationReport: {
+ defaults: {
+ user: 0,
+ team: 0,
+ database: 0,
+ row: 0,
+ file: 0,
+ bucket: 0,
+ function: 0,
+ platform: 0,
+ 'api-key': 0,
+ 'project-variable': 0,
+ webhook: 0,
+ 'auth-methods': 0,
+ 'project-protocols': 0,
+ 'project-labels': 0,
+ 'project-services': 0,
+ policies: 0,
+ smtp: 0,
+ rule: 0,
+ 'project-email-template': 0,
+ site: 0,
+ provider: 0,
+ topic: 0,
+ subscriber: 0,
+ message: 0,
+ size: 0,
+ version: '',
+ 'oauth2-provider': 0,
+ 'backup-policy': 0,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1923,7 +2382,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1980,7 +2471,39 @@ export class Migrations {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'migration',
+ models: {
+ migration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ status: '',
+ stage: '',
+ source: '',
+ destination: 'Appwrite',
+ resources: [],
+ resourceId: '',
+ resourceInternalId: '',
+ resourceType: '',
+ parentResourceId: '',
+ parentResourceInternalId: '',
+ parentResourceType: '',
+ destinationResourceId: '',
+ destinationResourceInternalId: '',
+ destinationResourceType: '',
+ statusCounters: [],
+ resourceData: [],
+ errors: [],
+ options: [],
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
diff --git a/src/services/mongo.ts b/src/services/mongo.ts
index 119803fa..5d8fd247 100644
--- a/src/services/mongo.ts
+++ b/src/services/mongo.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Mongo {
@@ -59,7 +64,73 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseList',
+ models: {
+ dedicatedDatabaseList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ databases: {
+ items: 'dedicatedDatabase',
+ },
+ },
+ },
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -304,7 +375,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -323,7 +450,41 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseSpecificationList',
+ models: {
+ dedicatedDatabaseSpecificationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ specifications: {
+ items: 'dedicatedDatabaseSpecification',
+ },
+ },
+ },
+ dedicatedDatabaseSpecification: {
+ defaults: {
+ slug: '',
+ name: '',
+ price: 0,
+ storageOverageRate: 0,
+ bandwidthOverageRate: 0,
+ replicaRate: 0,
+ pitrRate: 0,
+ cpu: 0,
+ memory: 0,
+ maxConnections: 0,
+ includedStorage: 0,
+ includedBandwidth: 0,
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -379,7 +540,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -714,7 +931,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -842,7 +1115,40 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackupList',
+ models: {
+ dedicatedDatabaseBackupList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ backups: {
+ items: 'dedicatedDatabaseBackup',
+ },
+ },
+ },
+ dedicatedDatabaseBackup: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ policyId: '',
+ trigger: 'manual',
+ type: 'full',
+ requestedType: '',
+ fallbackReason: '',
+ status: 'pending',
+ sizeBytes: 0,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -916,7 +1222,30 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackup',
+ models: {
+ dedicatedDatabaseBackup: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ policyId: '',
+ trigger: 'manual',
+ type: 'full',
+ requestedType: '',
+ fallbackReason: '',
+ status: 'pending',
+ sizeBytes: 0,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -989,7 +1318,36 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicyList',
+ models: {
+ backupPolicyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1149,7 +1507,26 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1223,7 +1600,26 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1354,7 +1750,26 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1598,7 +2013,23 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackupStorage',
+ models: {
+ dedicatedDatabaseBackupStorage: {
+ defaults: {
+ provider: '',
+ bucket: '',
+ region: '',
+ prefix: 'backups/',
+ endpoint: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1672,7 +2103,30 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackup',
+ models: {
+ dedicatedDatabaseBackup: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ policyId: '',
+ trigger: 'manual',
+ type: 'full',
+ requestedType: '',
+ fallbackReason: '',
+ status: 'pending',
+ sizeBytes: 0,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1801,7 +2255,39 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBranchList',
+ models: {
+ dedicatedDatabaseBranchList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ branches: {
+ items: 'dedicatedDatabaseBranch',
+ },
+ },
+ },
+ dedicatedDatabaseBranch: {
+ defaults: {
+ branchId: '',
+ branchName: '',
+ namespace: '',
+ expiresAt: 0,
+ host: '',
+ database: '',
+ username: '',
+ password: '',
+ ssl: false,
+ engine: '',
+ connectionString: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1886,7 +2372,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1961,7 +2503,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('delete', uri, apiHeaders, apiPayload);
+ const request = this.client.call('delete', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2022,7 +2620,26 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseOperation',
+ models: {
+ dedicatedDatabaseOperation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ type: '',
+ status: '',
+ attempts: 0,
+ errorCode: '',
+ errorMessage: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2097,7 +2714,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2190,7 +2863,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2285,7 +3014,63 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2390,7 +3175,36 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseOperationList',
+ models: {
+ dedicatedDatabaseOperationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ operations: {
+ items: 'dedicatedDatabaseOperation',
+ },
+ },
+ },
+ dedicatedDatabaseOperation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ type: '',
+ status: '',
+ attempts: 0,
+ errorCode: '',
+ errorMessage: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2448,7 +3262,20 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabasePITRWindows',
+ models: {
+ dedicatedDatabasePITRWindows: {
+ defaults: {
+ earliest: '',
+ latest: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2506,7 +3333,35 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseReplicas',
+ models: {
+ dedicatedDatabaseReplicas: {
+ defaults: {
+ replicas: 0,
+ syncMode: 'async',
+ syncDegraded: false,
+ syncAcknowledgements: 0,
+ syncStandbyCount: 0,
+ },
+ properties: {
+ members: {
+ items: 'dedicatedDatabaseMember',
+ },
+ },
+ },
+ dedicatedDatabaseMember: {
+ defaults: {
+ $id: '',
+ role: 'unknown',
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2623,7 +3478,35 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseRestorationList',
+ models: {
+ dedicatedDatabaseRestorationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ restorations: {
+ items: 'dedicatedDatabaseRestoration',
+ },
+ },
+ },
+ dedicatedDatabaseRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ type: 'backup',
+ status: 'pending',
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2741,7 +3624,25 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseRestoration',
+ models: {
+ dedicatedDatabaseRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ type: 'backup',
+ status: 'pending',
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2818,7 +3719,25 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseRestoration',
+ models: {
+ dedicatedDatabaseRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ type: 'backup',
+ status: 'pending',
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2874,7 +3793,50 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'databaseStatus',
+ models: {
+ databaseStatus: {
+ defaults: {
+ health: 'unknown',
+ ready: false,
+ engine: 'postgresql',
+ version: '',
+ uptime: 0,
+ syncMode: 'async',
+ syncDegraded: false,
+ syncAcknowledgements: 0,
+ syncStandbyCount: 0,
+ },
+ properties: {
+ replicas: {
+ items: 'databaseStatusReplica',
+ },
+ volumes: {
+ items: 'databaseStatusVolume',
+ },
+ },
+ },
+ databaseStatusReplica: {
+ defaults: {
+ index: 0,
+ role: 'unknown',
+ healthy: false,
+ },
+ },
+ databaseStatusVolume: {
+ defaults: {
+ path: '',
+ usedPercent: '0%',
+ available: '0GB',
+ mounted: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2953,6 +3915,62 @@ export class Mongo {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/mysql.ts b/src/services/mysql.ts
index d685f575..37071fea 100644
--- a/src/services/mysql.ts
+++ b/src/services/mysql.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Mysql {
@@ -59,7 +64,73 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseList',
+ models: {
+ dedicatedDatabaseList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ databases: {
+ items: 'dedicatedDatabase',
+ },
+ },
+ },
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -304,7 +375,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -323,7 +450,41 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseSpecificationList',
+ models: {
+ dedicatedDatabaseSpecificationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ specifications: {
+ items: 'dedicatedDatabaseSpecification',
+ },
+ },
+ },
+ dedicatedDatabaseSpecification: {
+ defaults: {
+ slug: '',
+ name: '',
+ price: 0,
+ storageOverageRate: 0,
+ bandwidthOverageRate: 0,
+ replicaRate: 0,
+ pitrRate: 0,
+ cpu: 0,
+ memory: 0,
+ maxConnections: 0,
+ includedStorage: 0,
+ includedBandwidth: 0,
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -379,7 +540,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -714,7 +931,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -842,7 +1115,40 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackupList',
+ models: {
+ dedicatedDatabaseBackupList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ backups: {
+ items: 'dedicatedDatabaseBackup',
+ },
+ },
+ },
+ dedicatedDatabaseBackup: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ policyId: '',
+ trigger: 'manual',
+ type: 'full',
+ requestedType: '',
+ fallbackReason: '',
+ status: 'pending',
+ sizeBytes: 0,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -916,7 +1222,30 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackup',
+ models: {
+ dedicatedDatabaseBackup: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ policyId: '',
+ trigger: 'manual',
+ type: 'full',
+ requestedType: '',
+ fallbackReason: '',
+ status: 'pending',
+ sizeBytes: 0,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -989,7 +1318,36 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicyList',
+ models: {
+ backupPolicyList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ policies: {
+ items: 'backupPolicy',
+ },
+ },
+ },
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1149,7 +1507,26 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1223,7 +1600,26 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1354,7 +1750,26 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'backupPolicy',
+ models: {
+ backupPolicy: {
+ defaults: {
+ $id: '',
+ name: '',
+ $createdAt: '',
+ $updatedAt: '',
+ retention: 1,
+ schedule: '0 * * * *',
+ type: 'full',
+ enabled: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1598,7 +2013,23 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('put', uri, apiHeaders, apiPayload);
+ const request = this.client.call('put', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackupStorage',
+ models: {
+ dedicatedDatabaseBackupStorage: {
+ defaults: {
+ provider: '',
+ bucket: '',
+ region: '',
+ prefix: 'backups/',
+ endpoint: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1672,7 +2103,30 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBackup',
+ models: {
+ dedicatedDatabaseBackup: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ policyId: '',
+ trigger: 'manual',
+ type: 'full',
+ requestedType: '',
+ fallbackReason: '',
+ status: 'pending',
+ sizeBytes: 0,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1801,7 +2255,39 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseBranchList',
+ models: {
+ dedicatedDatabaseBranchList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ branches: {
+ items: 'dedicatedDatabaseBranch',
+ },
+ },
+ },
+ dedicatedDatabaseBranch: {
+ defaults: {
+ branchId: '',
+ branchName: '',
+ namespace: '',
+ expiresAt: 0,
+ host: '',
+ database: '',
+ username: '',
+ password: '',
+ ssl: false,
+ engine: '',
+ connectionString: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1886,7 +2372,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -1961,7 +2503,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('delete', uri, apiHeaders, apiPayload);
+ const request = this.client.call('delete', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2022,7 +2620,26 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseOperation',
+ models: {
+ dedicatedDatabaseOperation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ type: '',
+ status: '',
+ attempts: 0,
+ errorCode: '',
+ errorMessage: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2131,7 +2748,34 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseExecution',
+ models: {
+ dedicatedDatabaseExecution: {
+ defaults: {
+ rows: [],
+ rowCount: 0,
+ durationMs: 0,
+ truncated: false,
+ bytes: 0,
+ },
+ properties: {
+ columns: {
+ items: 'dedicatedDatabaseExecutionColumn',
+ },
+ },
+ },
+ dedicatedDatabaseExecutionColumn: {
+ defaults: {
+ name: '',
+ type: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2206,7 +2850,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2299,7 +2999,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2394,7 +3150,63 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2499,7 +3311,36 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseOperationList',
+ models: {
+ dedicatedDatabaseOperationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ operations: {
+ items: 'dedicatedDatabaseOperation',
+ },
+ },
+ },
+ dedicatedDatabaseOperation: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ type: '',
+ status: '',
+ attempts: 0,
+ errorCode: '',
+ errorMessage: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2557,7 +3398,20 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabasePITRWindows',
+ models: {
+ dedicatedDatabasePITRWindows: {
+ defaults: {
+ earliest: '',
+ latest: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2615,7 +3469,28 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabasePooler',
+ models: {
+ dedicatedDatabasePooler: {
+ defaults: {
+ enabled: false,
+ mode: 'transaction',
+ maxConnections: 100,
+ defaultPoolSize: 20,
+ port: 6432,
+ readWriteSplitting: false,
+ poolerCpuRequest: '',
+ poolerCpuLimit: '',
+ poolerMemoryRequest: '',
+ poolerMemoryLimit: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2790,7 +3665,28 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabasePooler',
+ models: {
+ dedicatedDatabasePooler: {
+ defaults: {
+ enabled: false,
+ mode: 'transaction',
+ maxConnections: 100,
+ defaultPoolSize: 20,
+ port: 6432,
+ readWriteSplitting: false,
+ poolerCpuRequest: '',
+ poolerCpuLimit: '',
+ poolerMemoryRequest: '',
+ poolerMemoryLimit: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2848,7 +3744,35 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseReplicas',
+ models: {
+ dedicatedDatabaseReplicas: {
+ defaults: {
+ replicas: 0,
+ syncMode: 'async',
+ syncDegraded: false,
+ syncAcknowledgements: 0,
+ syncStandbyCount: 0,
+ },
+ properties: {
+ members: {
+ items: 'dedicatedDatabaseMember',
+ },
+ },
+ },
+ dedicatedDatabaseMember: {
+ defaults: {
+ $id: '',
+ role: 'unknown',
+ status: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -2965,7 +3889,35 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseRestorationList',
+ models: {
+ dedicatedDatabaseRestorationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ restorations: {
+ items: 'dedicatedDatabaseRestoration',
+ },
+ },
+ },
+ dedicatedDatabaseRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ type: 'backup',
+ status: 'pending',
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3083,7 +4035,25 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseRestoration',
+ models: {
+ dedicatedDatabaseRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ type: 'backup',
+ status: 'pending',
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3160,7 +4130,25 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabaseRestoration',
+ models: {
+ dedicatedDatabaseRestoration: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ databaseId: '',
+ projectId: '',
+ type: 'backup',
+ status: 'pending',
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3216,7 +4204,50 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'databaseStatus',
+ models: {
+ databaseStatus: {
+ defaults: {
+ health: 'unknown',
+ ready: false,
+ engine: 'postgresql',
+ version: '',
+ uptime: 0,
+ syncMode: 'async',
+ syncDegraded: false,
+ syncAcknowledgements: 0,
+ syncStandbyCount: 0,
+ },
+ properties: {
+ replicas: {
+ items: 'databaseStatusReplica',
+ },
+ volumes: {
+ items: 'databaseStatusVolume',
+ },
+ },
+ },
+ databaseStatusReplica: {
+ defaults: {
+ index: 0,
+ role: 'unknown',
+ healthy: false,
+ },
+ },
+ databaseStatusVolume: {
+ defaults: {
+ path: '',
+ usedPercent: '0%',
+ available: '0GB',
+ mounted: false,
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -3295,6 +4326,62 @@ export class Mysql {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'dedicatedDatabase',
+ models: {
+ dedicatedDatabase: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ projectId: '',
+ name: '',
+ version: '',
+ specification: '',
+ backend: '',
+ hostname: '',
+ connectionUser: '',
+ connectionPassword: '',
+ connectionString: '',
+ ssl: false,
+ status: 'provisioning',
+ containerStatus: '',
+ lifecycleState: '',
+ idleTimeoutMinutes: 15,
+ cpu: 500,
+ memory: 512,
+ storage: 10,
+ storageStatus: 'idle',
+ storageTargetGb: 0,
+ storageClass: 'ssd',
+ storageMaxGb: 0,
+ nodePool: '',
+ replicas: 0,
+ syncMode: '',
+ networkMaxConnections: 100,
+ networkIdleTimeoutSeconds: 900,
+ networkIPAllowlist: [],
+ backupEnabled: true,
+ pitr: true,
+ pitrRetentionDays: 7,
+ storageAutoscaling: true,
+ storageAutoscalingThresholdPercent: 85,
+ storageAutoscalingMaxGb: 0,
+ maintenanceWindowDay: 'sun',
+ maintenanceWindowHourUtc: 3,
+ metricsEnabled: false,
+ sqlApiEnabled: true,
+ sqlApiAllowedStatements: ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ sqlApiMaxRows: 10000,
+ sqlApiMaxBytes: 10485760,
+ sqlApiTimeoutSeconds: 30,
+ error: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/notifications.ts b/src/services/notifications.ts
index 065d0cdc..8d316bbe 100644
--- a/src/services/notifications.ts
+++ b/src/services/notifications.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Notifications {
@@ -73,7 +78,39 @@ export class Notifications {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'notificationList',
+ models: {
+ notificationList: {
+ defaults: {
+ total: 0,
+ },
+ properties: {
+ notifications: {
+ items: 'notification',
+ },
+ },
+ },
+ notification: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: 'info',
+ channel: '',
+ resourceType: '',
+ resourceId: '',
+ parentResourceType: '',
+ parentResourceId: '',
+ title: '',
+ body: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -149,6 +186,28 @@ export class Notifications {
accept: 'application/json',
};
- return this.client.call('patch', uri, apiHeaders, apiPayload);
+ const request = this.client.call('patch', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'notification',
+ models: {
+ notification: {
+ defaults: {
+ $id: '',
+ $createdAt: '',
+ $updatedAt: '',
+ type: 'info',
+ channel: '',
+ resourceType: '',
+ resourceId: '',
+ parentResourceType: '',
+ parentResourceId: '',
+ title: '',
+ body: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
}
diff --git a/src/services/oauth-2.ts b/src/services/oauth-2.ts
index 0cb439cf..b94d4fcb 100644
--- a/src/services/oauth-2.ts
+++ b/src/services/oauth-2.ts
@@ -1,4 +1,9 @@
-import { AppwriteException, Client, type Payload } from '../client';
+import {
+ AppwriteException,
+ Client,
+ type Payload,
+ applyDefaults,
+} from '../client';
import type { Models } from '../models';
export class Oauth2 {
@@ -97,7 +102,19 @@ export class Oauth2 {
accept: 'application/json',
};
- return this.client.call('post', uri, apiHeaders, apiPayload);
+ const request = this.client.call('post', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2Approve',
+ models: {
+ oauth2Approve: {
+ defaults: {
+ redirectUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -114,7 +131,7 @@ export class Oauth2 {
* @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account.
* @param {number} params.maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required.
* @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields
- * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
+ * @param {string[]} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
* @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI.
* @param {string} params.requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint.
* @throws {AppwriteException}
@@ -132,7 +149,7 @@ export class Oauth2 {
prompt?: string;
maxAge?: number;
authorizationDetails?: string;
- resource?: string;
+ resource?: string[];
audience?: string;
requestUri?: string;
}): Promise;
@@ -150,7 +167,7 @@ export class Oauth2 {
* @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account.
* @param {number} maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required.
* @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields
- * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
+ * @param {string[]} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
* @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI.
* @param {string} requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint.
* @throws {AppwriteException}
@@ -169,7 +186,7 @@ export class Oauth2 {
prompt?: string,
maxAge?: number,
authorizationDetails?: string,
- resource?: string,
+ resource?: string[],
audience?: string,
requestUri?: string,
): Promise;
@@ -187,7 +204,7 @@ export class Oauth2 {
prompt?: string;
maxAge?: number;
authorizationDetails?: string;
- resource?: string;
+ resource?: string[];
audience?: string;
requestUri?: string;
}
@@ -203,7 +220,7 @@ export class Oauth2 {
string?,
number?,
string?,
- string?,
+ string[]?,
string?,
string?,
]
@@ -220,7 +237,7 @@ export class Oauth2 {
prompt?: string;
maxAge?: number;
authorizationDetails?: string;
- resource?: string;
+ resource?: string[];
audience?: string;
requestUri?: string;
};
@@ -243,7 +260,7 @@ export class Oauth2 {
prompt?: string;
maxAge?: number;
authorizationDetails?: string;
- resource?: string;
+ resource?: string[];
audience?: string;
requestUri?: string;
};
@@ -260,7 +277,7 @@ export class Oauth2 {
prompt: rest[7] as string,
maxAge: rest[8] as number,
authorizationDetails: rest[9] as string,
- resource: rest[10] as string,
+ resource: rest[10] as string[],
audience: rest[11] as string,
requestUri: rest[12] as string,
};
@@ -334,7 +351,20 @@ export class Oauth2 {
accept: 'application/json',
};
- return this.client.call('get', uri, apiHeaders, apiPayload);
+ const request = this.client.call('get', uri, apiHeaders, apiPayload);
+ const defaults = {
+ root: 'oauth2Authorize',
+ models: {
+ oauth2Authorize: {
+ defaults: {
+ grantId: '',
+ redirectUrl: '',
+ },
+ },
+ },
+ };
+
+ return request.then((response) => applyDefaults(response, defaults));
}
/**
@@ -351,7 +381,7 @@ export class Oauth2 {
* @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account.
* @param {number} params.maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required.
* @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields
- * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
+ * @param {string[]} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
* @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI.
* @param {string} params.requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint.
* @throws {AppwriteException}
@@ -369,7 +399,7 @@ export class Oauth2 {
prompt?: string;
maxAge?: number;
authorizationDetails?: string;
- resource?: string;
+ resource?: string[];
audience?: string;
requestUri?: string;
}): Promise;
@@ -387,7 +417,7 @@ export class Oauth2 {
* @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account.
* @param {number} maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required.
* @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields
- * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
+ * @param {string[]} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.
* @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI.
* @param {string} requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint.
* @throws {AppwriteException}
@@ -406,7 +436,7 @@ export class Oauth2 {
prompt?: string,
maxAge?: number,
authorizationDetails?: string,
- resource?: string,
+ resource?: string[],
audience?: string,
requestUri?: string,
): Promise