@appwrite.io/console 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/cjs/sdk.js +132 -4
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +132 -4
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +132 -4
- package/docs/examples/domains/create-purchase.md +25 -0
- package/docs/examples/organizations/get-scopes.md +2 -1
- package/package.json +1 -1
- package/src/client.ts +7 -2
- package/src/models.ts +5 -1
- package/src/query.ts +26 -0
- package/src/services/domains.ts +147 -0
- package/src/services/organizations.ts +14 -6
- package/types/models.d.ts +5 -1
- package/types/query.d.ts +22 -0
- package/types/services/domains.d.ts +49 -0
- package/types/services/organizations.d.ts +4 -1
package/dist/iife/sdk.js
CHANGED
|
@@ -4007,12 +4007,34 @@
|
|
|
4007
4007
|
Query.offset = (offset) => new Query("offset", undefined, offset).toString();
|
|
4008
4008
|
/**
|
|
4009
4009
|
* Filter resources where attribute contains the specified value.
|
|
4010
|
+
* For string attributes, checks if the string contains the substring.
|
|
4010
4011
|
*
|
|
4012
|
+
* Note: For array attributes, use {@link containsAny} or {@link containsAll} instead.
|
|
4011
4013
|
* @param {string} attribute
|
|
4012
4014
|
* @param {string | string[]} value
|
|
4013
4015
|
* @returns {string}
|
|
4014
4016
|
*/
|
|
4015
4017
|
Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
|
|
4018
|
+
/**
|
|
4019
|
+
* Filter resources where attribute contains ANY of the specified values.
|
|
4020
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
4021
|
+
* contains at least one of the given values.
|
|
4022
|
+
*
|
|
4023
|
+
* @param {string} attribute
|
|
4024
|
+
* @param {any[]} value
|
|
4025
|
+
* @returns {string}
|
|
4026
|
+
*/
|
|
4027
|
+
Query.containsAny = (attribute, value) => new Query("containsAny", attribute, value).toString();
|
|
4028
|
+
/**
|
|
4029
|
+
* Filter resources where attribute contains ALL of the specified values.
|
|
4030
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
4031
|
+
* contains every one of the given values.
|
|
4032
|
+
*
|
|
4033
|
+
* @param {string} attribute
|
|
4034
|
+
* @param {any[]} value
|
|
4035
|
+
* @returns {string}
|
|
4036
|
+
*/
|
|
4037
|
+
Query.containsAll = (attribute, value) => new Query("containsAll", attribute, value).toString();
|
|
4016
4038
|
/**
|
|
4017
4039
|
* Filter resources where attribute does not contain the specified value.
|
|
4018
4040
|
*
|
|
@@ -4230,6 +4252,8 @@
|
|
|
4230
4252
|
const JSONbigSerializer = jsonBigint.exports({ useNativeBigInt: true });
|
|
4231
4253
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4232
4254
|
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
4255
|
+
const MAX_INT64 = BigInt('9223372036854775807');
|
|
4256
|
+
const MIN_INT64 = BigInt('-9223372036854775808');
|
|
4233
4257
|
function isBigNumber(value) {
|
|
4234
4258
|
return value !== null
|
|
4235
4259
|
&& typeof value === 'object'
|
|
@@ -4246,7 +4270,10 @@
|
|
|
4246
4270
|
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
4247
4271
|
return Number(str);
|
|
4248
4272
|
}
|
|
4249
|
-
|
|
4273
|
+
if (bi >= MIN_INT64 && bi <= MAX_INT64) {
|
|
4274
|
+
return bi;
|
|
4275
|
+
}
|
|
4276
|
+
return value.toNumber();
|
|
4250
4277
|
}
|
|
4251
4278
|
return value.toNumber();
|
|
4252
4279
|
}
|
|
@@ -4305,7 +4332,7 @@
|
|
|
4305
4332
|
'x-sdk-name': 'Console',
|
|
4306
4333
|
'x-sdk-platform': 'console',
|
|
4307
4334
|
'x-sdk-language': 'web',
|
|
4308
|
-
'x-sdk-version': '3.
|
|
4335
|
+
'x-sdk-version': '3.1.0',
|
|
4309
4336
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
4310
4337
|
};
|
|
4311
4338
|
this.realtime = {
|
|
@@ -11494,6 +11521,102 @@
|
|
|
11494
11521
|
const apiHeaders = {};
|
|
11495
11522
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
11496
11523
|
}
|
|
11524
|
+
createPurchase(paramsOrFirst, ...rest) {
|
|
11525
|
+
let params;
|
|
11526
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
11527
|
+
params = (paramsOrFirst || {});
|
|
11528
|
+
}
|
|
11529
|
+
else {
|
|
11530
|
+
params = {
|
|
11531
|
+
domain: paramsOrFirst,
|
|
11532
|
+
teamId: rest[0],
|
|
11533
|
+
firstName: rest[1],
|
|
11534
|
+
lastName: rest[2],
|
|
11535
|
+
email: rest[3],
|
|
11536
|
+
phone: rest[4],
|
|
11537
|
+
billingAddressId: rest[5],
|
|
11538
|
+
paymentMethodId: rest[6],
|
|
11539
|
+
addressLine3: rest[7],
|
|
11540
|
+
companyName: rest[8],
|
|
11541
|
+
periodYears: rest[9]
|
|
11542
|
+
};
|
|
11543
|
+
}
|
|
11544
|
+
const domain = params.domain;
|
|
11545
|
+
const teamId = params.teamId;
|
|
11546
|
+
const firstName = params.firstName;
|
|
11547
|
+
const lastName = params.lastName;
|
|
11548
|
+
const email = params.email;
|
|
11549
|
+
const phone = params.phone;
|
|
11550
|
+
const billingAddressId = params.billingAddressId;
|
|
11551
|
+
const paymentMethodId = params.paymentMethodId;
|
|
11552
|
+
const addressLine3 = params.addressLine3;
|
|
11553
|
+
const companyName = params.companyName;
|
|
11554
|
+
const periodYears = params.periodYears;
|
|
11555
|
+
if (typeof domain === 'undefined') {
|
|
11556
|
+
throw new AppwriteException('Missing required parameter: "domain"');
|
|
11557
|
+
}
|
|
11558
|
+
if (typeof teamId === 'undefined') {
|
|
11559
|
+
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
11560
|
+
}
|
|
11561
|
+
if (typeof firstName === 'undefined') {
|
|
11562
|
+
throw new AppwriteException('Missing required parameter: "firstName"');
|
|
11563
|
+
}
|
|
11564
|
+
if (typeof lastName === 'undefined') {
|
|
11565
|
+
throw new AppwriteException('Missing required parameter: "lastName"');
|
|
11566
|
+
}
|
|
11567
|
+
if (typeof email === 'undefined') {
|
|
11568
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
11569
|
+
}
|
|
11570
|
+
if (typeof phone === 'undefined') {
|
|
11571
|
+
throw new AppwriteException('Missing required parameter: "phone"');
|
|
11572
|
+
}
|
|
11573
|
+
if (typeof billingAddressId === 'undefined') {
|
|
11574
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
11575
|
+
}
|
|
11576
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
11577
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
11578
|
+
}
|
|
11579
|
+
const apiPath = '/domains/purchases';
|
|
11580
|
+
const payload = {};
|
|
11581
|
+
if (typeof domain !== 'undefined') {
|
|
11582
|
+
payload['domain'] = domain;
|
|
11583
|
+
}
|
|
11584
|
+
if (typeof teamId !== 'undefined') {
|
|
11585
|
+
payload['teamId'] = teamId;
|
|
11586
|
+
}
|
|
11587
|
+
if (typeof firstName !== 'undefined') {
|
|
11588
|
+
payload['firstName'] = firstName;
|
|
11589
|
+
}
|
|
11590
|
+
if (typeof lastName !== 'undefined') {
|
|
11591
|
+
payload['lastName'] = lastName;
|
|
11592
|
+
}
|
|
11593
|
+
if (typeof email !== 'undefined') {
|
|
11594
|
+
payload['email'] = email;
|
|
11595
|
+
}
|
|
11596
|
+
if (typeof phone !== 'undefined') {
|
|
11597
|
+
payload['phone'] = phone;
|
|
11598
|
+
}
|
|
11599
|
+
if (typeof billingAddressId !== 'undefined') {
|
|
11600
|
+
payload['billingAddressId'] = billingAddressId;
|
|
11601
|
+
}
|
|
11602
|
+
if (typeof addressLine3 !== 'undefined') {
|
|
11603
|
+
payload['addressLine3'] = addressLine3;
|
|
11604
|
+
}
|
|
11605
|
+
if (typeof companyName !== 'undefined') {
|
|
11606
|
+
payload['companyName'] = companyName;
|
|
11607
|
+
}
|
|
11608
|
+
if (typeof periodYears !== 'undefined') {
|
|
11609
|
+
payload['periodYears'] = periodYears;
|
|
11610
|
+
}
|
|
11611
|
+
if (typeof paymentMethodId !== 'undefined') {
|
|
11612
|
+
payload['paymentMethodId'] = paymentMethodId;
|
|
11613
|
+
}
|
|
11614
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
11615
|
+
const apiHeaders = {
|
|
11616
|
+
'content-type': 'application/json',
|
|
11617
|
+
};
|
|
11618
|
+
return this.client.call('post', uri, apiHeaders, payload);
|
|
11619
|
+
}
|
|
11497
11620
|
listSuggestions(paramsOrFirst, ...rest) {
|
|
11498
11621
|
let params;
|
|
11499
11622
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -19600,22 +19723,27 @@
|
|
|
19600
19723
|
const apiHeaders = {};
|
|
19601
19724
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
19602
19725
|
}
|
|
19603
|
-
getScopes(paramsOrFirst) {
|
|
19726
|
+
getScopes(paramsOrFirst, ...rest) {
|
|
19604
19727
|
let params;
|
|
19605
19728
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
19606
19729
|
params = (paramsOrFirst || {});
|
|
19607
19730
|
}
|
|
19608
19731
|
else {
|
|
19609
19732
|
params = {
|
|
19610
|
-
organizationId: paramsOrFirst
|
|
19733
|
+
organizationId: paramsOrFirst,
|
|
19734
|
+
projectId: rest[0]
|
|
19611
19735
|
};
|
|
19612
19736
|
}
|
|
19613
19737
|
const organizationId = params.organizationId;
|
|
19738
|
+
const projectId = params.projectId;
|
|
19614
19739
|
if (typeof organizationId === 'undefined') {
|
|
19615
19740
|
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
19616
19741
|
}
|
|
19617
19742
|
const apiPath = '/organizations/{organizationId}/roles'.replace('{organizationId}', organizationId);
|
|
19618
19743
|
const payload = {};
|
|
19744
|
+
if (typeof projectId !== 'undefined') {
|
|
19745
|
+
payload['projectId'] = projectId;
|
|
19746
|
+
}
|
|
19619
19747
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
19620
19748
|
const apiHeaders = {};
|
|
19621
19749
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
```javascript
|
|
2
|
+
import { Client, Domains } from "@appwrite.io/console";
|
|
3
|
+
|
|
4
|
+
const client = new Client()
|
|
5
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
6
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
7
|
+
|
|
8
|
+
const domains = new Domains(client);
|
|
9
|
+
|
|
10
|
+
const result = await domains.createPurchase({
|
|
11
|
+
domain: '',
|
|
12
|
+
teamId: '<TEAM_ID>',
|
|
13
|
+
firstName: '<FIRST_NAME>',
|
|
14
|
+
lastName: '<LAST_NAME>',
|
|
15
|
+
email: 'email@example.com',
|
|
16
|
+
phone: '+12065550100',
|
|
17
|
+
billingAddressId: '<BILLING_ADDRESS_ID>',
|
|
18
|
+
paymentMethodId: '<PAYMENT_METHOD_ID>',
|
|
19
|
+
addressLine3: '<ADDRESS_LINE3>', // optional
|
|
20
|
+
companyName: '<COMPANY_NAME>', // optional
|
|
21
|
+
periodYears: 1 // optional
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log(result);
|
|
25
|
+
```
|
|
@@ -8,7 +8,8 @@ const client = new Client()
|
|
|
8
8
|
const organizations = new Organizations(client);
|
|
9
9
|
|
|
10
10
|
const result = await organizations.getScopes({
|
|
11
|
-
organizationId: '<ORGANIZATION_ID>'
|
|
11
|
+
organizationId: '<ORGANIZATION_ID>',
|
|
12
|
+
projectId: '<PROJECT_ID>' // optional
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
console.log(result);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@appwrite.io/console",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"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",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.1.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
package/src/client.ts
CHANGED
|
@@ -7,6 +7,8 @@ const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
|
|
|
7
7
|
|
|
8
8
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
9
9
|
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
10
|
+
const MAX_INT64 = BigInt('9223372036854775807');
|
|
11
|
+
const MIN_INT64 = BigInt('-9223372036854775808');
|
|
10
12
|
|
|
11
13
|
function isBigNumber(value: any): boolean {
|
|
12
14
|
return value !== null
|
|
@@ -25,7 +27,10 @@ function reviver(_key: string, value: any): any {
|
|
|
25
27
|
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
26
28
|
return Number(str);
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
if (bi >= MIN_INT64 && bi <= MAX_INT64) {
|
|
31
|
+
return bi;
|
|
32
|
+
}
|
|
33
|
+
return value.toNumber();
|
|
29
34
|
}
|
|
30
35
|
return value.toNumber();
|
|
31
36
|
}
|
|
@@ -395,7 +400,7 @@ class Client {
|
|
|
395
400
|
'x-sdk-name': 'Console',
|
|
396
401
|
'x-sdk-platform': 'console',
|
|
397
402
|
'x-sdk-language': 'web',
|
|
398
|
-
'x-sdk-version': '3.
|
|
403
|
+
'x-sdk-version': '3.1.0',
|
|
399
404
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
400
405
|
};
|
|
401
406
|
|
package/src/models.ts
CHANGED
|
@@ -8567,6 +8567,10 @@ export namespace Models {
|
|
|
8567
8567
|
* Domain registrar (e.g. "appwrite" or "third_party").
|
|
8568
8568
|
*/
|
|
8569
8569
|
registrar: string;
|
|
8570
|
+
/**
|
|
8571
|
+
* Payment status for domain purchase.
|
|
8572
|
+
*/
|
|
8573
|
+
paymentStatus: string;
|
|
8570
8574
|
/**
|
|
8571
8575
|
* Nameservers setting. "Appwrite" or empty string.
|
|
8572
8576
|
*/
|
|
@@ -8584,7 +8588,7 @@ export namespace Models {
|
|
|
8584
8588
|
*/
|
|
8585
8589
|
autoRenewal: boolean;
|
|
8586
8590
|
/**
|
|
8587
|
-
* Renewal price (in
|
|
8591
|
+
* Renewal price (in cents).
|
|
8588
8592
|
*/
|
|
8589
8593
|
renewalPrice: number;
|
|
8590
8594
|
/**
|
package/src/query.ts
CHANGED
|
@@ -272,7 +272,9 @@ export class Query {
|
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
274
|
* Filter resources where attribute contains the specified value.
|
|
275
|
+
* For string attributes, checks if the string contains the substring.
|
|
275
276
|
*
|
|
277
|
+
* Note: For array attributes, use {@link containsAny} or {@link containsAll} instead.
|
|
276
278
|
* @param {string} attribute
|
|
277
279
|
* @param {string | string[]} value
|
|
278
280
|
* @returns {string}
|
|
@@ -280,6 +282,30 @@ export class Query {
|
|
|
280
282
|
static contains = (attribute: string, value: string | any[]): string =>
|
|
281
283
|
new Query("contains", attribute, value).toString();
|
|
282
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Filter resources where attribute contains ANY of the specified values.
|
|
287
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
288
|
+
* contains at least one of the given values.
|
|
289
|
+
*
|
|
290
|
+
* @param {string} attribute
|
|
291
|
+
* @param {any[]} value
|
|
292
|
+
* @returns {string}
|
|
293
|
+
*/
|
|
294
|
+
static containsAny = (attribute: string, value: any[]): string =>
|
|
295
|
+
new Query("containsAny", attribute, value).toString();
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Filter resources where attribute contains ALL of the specified values.
|
|
299
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
300
|
+
* contains every one of the given values.
|
|
301
|
+
*
|
|
302
|
+
* @param {string} attribute
|
|
303
|
+
* @param {any[]} value
|
|
304
|
+
* @returns {string}
|
|
305
|
+
*/
|
|
306
|
+
static containsAll = (attribute: string, value: any[]): string =>
|
|
307
|
+
new Query("containsAll", attribute, value).toString();
|
|
308
|
+
|
|
283
309
|
/**
|
|
284
310
|
* Filter resources where attribute does not contain the specified value.
|
|
285
311
|
*
|
package/src/services/domains.ts
CHANGED
|
@@ -206,6 +206,153 @@ export class Domains {
|
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Create a domain purchase with registrant information.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} params.domain - Fully qualified domain name to purchase (for example, example.com).
|
|
213
|
+
* @param {string} params.teamId - Team ID that will own the domain.
|
|
214
|
+
* @param {string} params.firstName - Registrant first name used for domain registration.
|
|
215
|
+
* @param {string} params.lastName - Registrant last name used for domain registration.
|
|
216
|
+
* @param {string} params.email - Registrant email address for registration and notices.
|
|
217
|
+
* @param {string} params.phone - Registrant phone number in E.164 format (for example, +15555551234).
|
|
218
|
+
* @param {string} params.billingAddressId - Billing address ID used for registration contact details.
|
|
219
|
+
* @param {string} params.paymentMethodId - Payment method ID to authorize and capture the purchase.
|
|
220
|
+
* @param {string} params.addressLine3 - Additional address line for the registrant (line 3).
|
|
221
|
+
* @param {string} params.companyName - Company or organization name for the registrant.
|
|
222
|
+
* @param {number} params.periodYears - Registration term in years (1-10).
|
|
223
|
+
* @throws {AppwriteException}
|
|
224
|
+
* @returns {Promise<Models.Domain>}
|
|
225
|
+
*/
|
|
226
|
+
createPurchase(params: { domain: string, teamId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number }): Promise<Models.Domain>;
|
|
227
|
+
/**
|
|
228
|
+
* Create a domain purchase with registrant information.
|
|
229
|
+
*
|
|
230
|
+
* @param {string} domain - Fully qualified domain name to purchase (for example, example.com).
|
|
231
|
+
* @param {string} teamId - Team ID that will own the domain.
|
|
232
|
+
* @param {string} firstName - Registrant first name used for domain registration.
|
|
233
|
+
* @param {string} lastName - Registrant last name used for domain registration.
|
|
234
|
+
* @param {string} email - Registrant email address for registration and notices.
|
|
235
|
+
* @param {string} phone - Registrant phone number in E.164 format (for example, +15555551234).
|
|
236
|
+
* @param {string} billingAddressId - Billing address ID used for registration contact details.
|
|
237
|
+
* @param {string} paymentMethodId - Payment method ID to authorize and capture the purchase.
|
|
238
|
+
* @param {string} addressLine3 - Additional address line for the registrant (line 3).
|
|
239
|
+
* @param {string} companyName - Company or organization name for the registrant.
|
|
240
|
+
* @param {number} periodYears - Registration term in years (1-10).
|
|
241
|
+
* @throws {AppwriteException}
|
|
242
|
+
* @returns {Promise<Models.Domain>}
|
|
243
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
244
|
+
*/
|
|
245
|
+
createPurchase(domain: string, teamId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number): Promise<Models.Domain>;
|
|
246
|
+
createPurchase(
|
|
247
|
+
paramsOrFirst: { domain: string, teamId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number } | string,
|
|
248
|
+
...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?]
|
|
249
|
+
): Promise<Models.Domain> {
|
|
250
|
+
let params: { domain: string, teamId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number };
|
|
251
|
+
|
|
252
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
253
|
+
params = (paramsOrFirst || {}) as { domain: string, teamId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number };
|
|
254
|
+
} else {
|
|
255
|
+
params = {
|
|
256
|
+
domain: paramsOrFirst as string,
|
|
257
|
+
teamId: rest[0] as string,
|
|
258
|
+
firstName: rest[1] as string,
|
|
259
|
+
lastName: rest[2] as string,
|
|
260
|
+
email: rest[3] as string,
|
|
261
|
+
phone: rest[4] as string,
|
|
262
|
+
billingAddressId: rest[5] as string,
|
|
263
|
+
paymentMethodId: rest[6] as string,
|
|
264
|
+
addressLine3: rest[7] as string,
|
|
265
|
+
companyName: rest[8] as string,
|
|
266
|
+
periodYears: rest[9] as number
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const domain = params.domain;
|
|
271
|
+
const teamId = params.teamId;
|
|
272
|
+
const firstName = params.firstName;
|
|
273
|
+
const lastName = params.lastName;
|
|
274
|
+
const email = params.email;
|
|
275
|
+
const phone = params.phone;
|
|
276
|
+
const billingAddressId = params.billingAddressId;
|
|
277
|
+
const paymentMethodId = params.paymentMethodId;
|
|
278
|
+
const addressLine3 = params.addressLine3;
|
|
279
|
+
const companyName = params.companyName;
|
|
280
|
+
const periodYears = params.periodYears;
|
|
281
|
+
|
|
282
|
+
if (typeof domain === 'undefined') {
|
|
283
|
+
throw new AppwriteException('Missing required parameter: "domain"');
|
|
284
|
+
}
|
|
285
|
+
if (typeof teamId === 'undefined') {
|
|
286
|
+
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
287
|
+
}
|
|
288
|
+
if (typeof firstName === 'undefined') {
|
|
289
|
+
throw new AppwriteException('Missing required parameter: "firstName"');
|
|
290
|
+
}
|
|
291
|
+
if (typeof lastName === 'undefined') {
|
|
292
|
+
throw new AppwriteException('Missing required parameter: "lastName"');
|
|
293
|
+
}
|
|
294
|
+
if (typeof email === 'undefined') {
|
|
295
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
296
|
+
}
|
|
297
|
+
if (typeof phone === 'undefined') {
|
|
298
|
+
throw new AppwriteException('Missing required parameter: "phone"');
|
|
299
|
+
}
|
|
300
|
+
if (typeof billingAddressId === 'undefined') {
|
|
301
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
302
|
+
}
|
|
303
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
304
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const apiPath = '/domains/purchases';
|
|
308
|
+
const payload: Payload = {};
|
|
309
|
+
if (typeof domain !== 'undefined') {
|
|
310
|
+
payload['domain'] = domain;
|
|
311
|
+
}
|
|
312
|
+
if (typeof teamId !== 'undefined') {
|
|
313
|
+
payload['teamId'] = teamId;
|
|
314
|
+
}
|
|
315
|
+
if (typeof firstName !== 'undefined') {
|
|
316
|
+
payload['firstName'] = firstName;
|
|
317
|
+
}
|
|
318
|
+
if (typeof lastName !== 'undefined') {
|
|
319
|
+
payload['lastName'] = lastName;
|
|
320
|
+
}
|
|
321
|
+
if (typeof email !== 'undefined') {
|
|
322
|
+
payload['email'] = email;
|
|
323
|
+
}
|
|
324
|
+
if (typeof phone !== 'undefined') {
|
|
325
|
+
payload['phone'] = phone;
|
|
326
|
+
}
|
|
327
|
+
if (typeof billingAddressId !== 'undefined') {
|
|
328
|
+
payload['billingAddressId'] = billingAddressId;
|
|
329
|
+
}
|
|
330
|
+
if (typeof addressLine3 !== 'undefined') {
|
|
331
|
+
payload['addressLine3'] = addressLine3;
|
|
332
|
+
}
|
|
333
|
+
if (typeof companyName !== 'undefined') {
|
|
334
|
+
payload['companyName'] = companyName;
|
|
335
|
+
}
|
|
336
|
+
if (typeof periodYears !== 'undefined') {
|
|
337
|
+
payload['periodYears'] = periodYears;
|
|
338
|
+
}
|
|
339
|
+
if (typeof paymentMethodId !== 'undefined') {
|
|
340
|
+
payload['paymentMethodId'] = paymentMethodId;
|
|
341
|
+
}
|
|
342
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
343
|
+
|
|
344
|
+
const apiHeaders: { [header: string]: string } = {
|
|
345
|
+
'content-type': 'application/json',
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return this.client.call(
|
|
349
|
+
'post',
|
|
350
|
+
uri,
|
|
351
|
+
apiHeaders,
|
|
352
|
+
payload
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
209
356
|
/**
|
|
210
357
|
* List domain suggestions.
|
|
211
358
|
*
|
|
@@ -2496,33 +2496,38 @@ export class Organizations {
|
|
|
2496
2496
|
* Get Scopes
|
|
2497
2497
|
*
|
|
2498
2498
|
* @param {string} params.organizationId - Organization id
|
|
2499
|
+
* @param {string} params.projectId - Project id
|
|
2499
2500
|
* @throws {AppwriteException}
|
|
2500
2501
|
* @returns {Promise<Models.Roles>}
|
|
2501
2502
|
*/
|
|
2502
|
-
getScopes(params: { organizationId: string }): Promise<Models.Roles>;
|
|
2503
|
+
getScopes(params: { organizationId: string, projectId?: string }): Promise<Models.Roles>;
|
|
2503
2504
|
/**
|
|
2504
2505
|
* Get Scopes
|
|
2505
2506
|
*
|
|
2506
2507
|
* @param {string} organizationId - Organization id
|
|
2508
|
+
* @param {string} projectId - Project id
|
|
2507
2509
|
* @throws {AppwriteException}
|
|
2508
2510
|
* @returns {Promise<Models.Roles>}
|
|
2509
2511
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2510
2512
|
*/
|
|
2511
|
-
getScopes(organizationId: string): Promise<Models.Roles>;
|
|
2513
|
+
getScopes(organizationId: string, projectId?: string): Promise<Models.Roles>;
|
|
2512
2514
|
getScopes(
|
|
2513
|
-
paramsOrFirst: { organizationId: string } | string
|
|
2515
|
+
paramsOrFirst: { organizationId: string, projectId?: string } | string,
|
|
2516
|
+
...rest: [(string)?]
|
|
2514
2517
|
): Promise<Models.Roles> {
|
|
2515
|
-
let params: { organizationId: string };
|
|
2518
|
+
let params: { organizationId: string, projectId?: string };
|
|
2516
2519
|
|
|
2517
2520
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2518
|
-
params = (paramsOrFirst || {}) as { organizationId: string };
|
|
2521
|
+
params = (paramsOrFirst || {}) as { organizationId: string, projectId?: string };
|
|
2519
2522
|
} else {
|
|
2520
2523
|
params = {
|
|
2521
|
-
organizationId: paramsOrFirst as string
|
|
2524
|
+
organizationId: paramsOrFirst as string,
|
|
2525
|
+
projectId: rest[0] as string
|
|
2522
2526
|
};
|
|
2523
2527
|
}
|
|
2524
2528
|
|
|
2525
2529
|
const organizationId = params.organizationId;
|
|
2530
|
+
const projectId = params.projectId;
|
|
2526
2531
|
|
|
2527
2532
|
if (typeof organizationId === 'undefined') {
|
|
2528
2533
|
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
@@ -2530,6 +2535,9 @@ export class Organizations {
|
|
|
2530
2535
|
|
|
2531
2536
|
const apiPath = '/organizations/{organizationId}/roles'.replace('{organizationId}', organizationId);
|
|
2532
2537
|
const payload: Payload = {};
|
|
2538
|
+
if (typeof projectId !== 'undefined') {
|
|
2539
|
+
payload['projectId'] = projectId;
|
|
2540
|
+
}
|
|
2533
2541
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2534
2542
|
|
|
2535
2543
|
const apiHeaders: { [header: string]: string } = {
|
package/types/models.d.ts
CHANGED
|
@@ -8342,6 +8342,10 @@ export declare namespace Models {
|
|
|
8342
8342
|
* Domain registrar (e.g. "appwrite" or "third_party").
|
|
8343
8343
|
*/
|
|
8344
8344
|
registrar: string;
|
|
8345
|
+
/**
|
|
8346
|
+
* Payment status for domain purchase.
|
|
8347
|
+
*/
|
|
8348
|
+
paymentStatus: string;
|
|
8345
8349
|
/**
|
|
8346
8350
|
* Nameservers setting. "Appwrite" or empty string.
|
|
8347
8351
|
*/
|
|
@@ -8359,7 +8363,7 @@ export declare namespace Models {
|
|
|
8359
8363
|
*/
|
|
8360
8364
|
autoRenewal: boolean;
|
|
8361
8365
|
/**
|
|
8362
|
-
* Renewal price (in
|
|
8366
|
+
* Renewal price (in cents).
|
|
8363
8367
|
*/
|
|
8364
8368
|
renewalPrice: number;
|
|
8365
8369
|
/**
|
package/types/query.d.ts
CHANGED
|
@@ -198,12 +198,34 @@ export declare class Query {
|
|
|
198
198
|
static offset: (offset: number) => string;
|
|
199
199
|
/**
|
|
200
200
|
* Filter resources where attribute contains the specified value.
|
|
201
|
+
* For string attributes, checks if the string contains the substring.
|
|
201
202
|
*
|
|
203
|
+
* Note: For array attributes, use {@link containsAny} or {@link containsAll} instead.
|
|
202
204
|
* @param {string} attribute
|
|
203
205
|
* @param {string | string[]} value
|
|
204
206
|
* @returns {string}
|
|
205
207
|
*/
|
|
206
208
|
static contains: (attribute: string, value: string | any[]) => string;
|
|
209
|
+
/**
|
|
210
|
+
* Filter resources where attribute contains ANY of the specified values.
|
|
211
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
212
|
+
* contains at least one of the given values.
|
|
213
|
+
*
|
|
214
|
+
* @param {string} attribute
|
|
215
|
+
* @param {any[]} value
|
|
216
|
+
* @returns {string}
|
|
217
|
+
*/
|
|
218
|
+
static containsAny: (attribute: string, value: any[]) => string;
|
|
219
|
+
/**
|
|
220
|
+
* Filter resources where attribute contains ALL of the specified values.
|
|
221
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
222
|
+
* contains every one of the given values.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} attribute
|
|
225
|
+
* @param {any[]} value
|
|
226
|
+
* @returns {string}
|
|
227
|
+
*/
|
|
228
|
+
static containsAll: (attribute: string, value: any[]) => string;
|
|
207
229
|
/**
|
|
208
230
|
* Filter resources where attribute does not contain the specified value.
|
|
209
231
|
*
|
|
@@ -74,6 +74,55 @@ export declare class Domains {
|
|
|
74
74
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
75
75
|
*/
|
|
76
76
|
getPrice(domain: string, periodYears?: number, registrationType?: RegistrationType): Promise<Models.DomainPrice>;
|
|
77
|
+
/**
|
|
78
|
+
* Create a domain purchase with registrant information.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} params.domain - Fully qualified domain name to purchase (for example, example.com).
|
|
81
|
+
* @param {string} params.teamId - Team ID that will own the domain.
|
|
82
|
+
* @param {string} params.firstName - Registrant first name used for domain registration.
|
|
83
|
+
* @param {string} params.lastName - Registrant last name used for domain registration.
|
|
84
|
+
* @param {string} params.email - Registrant email address for registration and notices.
|
|
85
|
+
* @param {string} params.phone - Registrant phone number in E.164 format (for example, +15555551234).
|
|
86
|
+
* @param {string} params.billingAddressId - Billing address ID used for registration contact details.
|
|
87
|
+
* @param {string} params.paymentMethodId - Payment method ID to authorize and capture the purchase.
|
|
88
|
+
* @param {string} params.addressLine3 - Additional address line for the registrant (line 3).
|
|
89
|
+
* @param {string} params.companyName - Company or organization name for the registrant.
|
|
90
|
+
* @param {number} params.periodYears - Registration term in years (1-10).
|
|
91
|
+
* @throws {AppwriteException}
|
|
92
|
+
* @returns {Promise<Models.Domain>}
|
|
93
|
+
*/
|
|
94
|
+
createPurchase(params: {
|
|
95
|
+
domain: string;
|
|
96
|
+
teamId: string;
|
|
97
|
+
firstName: string;
|
|
98
|
+
lastName: string;
|
|
99
|
+
email: string;
|
|
100
|
+
phone: string;
|
|
101
|
+
billingAddressId: string;
|
|
102
|
+
paymentMethodId: string;
|
|
103
|
+
addressLine3?: string;
|
|
104
|
+
companyName?: string;
|
|
105
|
+
periodYears?: number;
|
|
106
|
+
}): Promise<Models.Domain>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a domain purchase with registrant information.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} domain - Fully qualified domain name to purchase (for example, example.com).
|
|
111
|
+
* @param {string} teamId - Team ID that will own the domain.
|
|
112
|
+
* @param {string} firstName - Registrant first name used for domain registration.
|
|
113
|
+
* @param {string} lastName - Registrant last name used for domain registration.
|
|
114
|
+
* @param {string} email - Registrant email address for registration and notices.
|
|
115
|
+
* @param {string} phone - Registrant phone number in E.164 format (for example, +15555551234).
|
|
116
|
+
* @param {string} billingAddressId - Billing address ID used for registration contact details.
|
|
117
|
+
* @param {string} paymentMethodId - Payment method ID to authorize and capture the purchase.
|
|
118
|
+
* @param {string} addressLine3 - Additional address line for the registrant (line 3).
|
|
119
|
+
* @param {string} companyName - Company or organization name for the registrant.
|
|
120
|
+
* @param {number} periodYears - Registration term in years (1-10).
|
|
121
|
+
* @throws {AppwriteException}
|
|
122
|
+
* @returns {Promise<Models.Domain>}
|
|
123
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
124
|
+
*/
|
|
125
|
+
createPurchase(domain: string, teamId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number): Promise<Models.Domain>;
|
|
77
126
|
/**
|
|
78
127
|
* List domain suggestions.
|
|
79
128
|
*
|