@appwrite.io/console 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/sdk.js +170 -31
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +170 -31
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +170 -31
- package/docs/examples/account/create-billing-address.md +18 -0
- package/docs/examples/account/delete-billing-address.md +13 -0
- package/docs/examples/account/update-billing-address.md +19 -0
- package/docs/examples/console/get-coupon.md +13 -0
- package/docs/examples/organizations/list-credits.md +14 -0
- package/package.json +1 -1
- package/src/client.ts +5 -1
- package/src/models.ts +39 -1
- package/src/services/account.ts +154 -34
- package/src/services/console.ts +1 -1
- package/src/services/organizations.ts +36 -4
- package/types/client.d.ts +1 -0
- package/types/models.d.ts +39 -1
- package/types/services/account.d.ts +40 -12
- package/types/services/console.d.ts +1 -1
- package/types/services/organizations.d.ts +14 -4
package/dist/iife/sdk.js
CHANGED
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
'x-sdk-name': 'Console',
|
|
282
282
|
'x-sdk-platform': 'console',
|
|
283
283
|
'x-sdk-language': 'web',
|
|
284
|
-
'x-sdk-version': '1.
|
|
284
|
+
'x-sdk-version': '1.4.0',
|
|
285
285
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
286
286
|
};
|
|
287
287
|
this.realtime = {
|
|
@@ -626,6 +626,11 @@
|
|
|
626
626
|
return response;
|
|
627
627
|
});
|
|
628
628
|
}
|
|
629
|
+
ping() {
|
|
630
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
631
|
+
return this.call('GET', new URL(this.config.endpoint + '/ping'));
|
|
632
|
+
});
|
|
633
|
+
}
|
|
629
634
|
call(method, url, headers = {}, params = {}, responseType = 'json') {
|
|
630
635
|
var _a;
|
|
631
636
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -789,7 +794,7 @@
|
|
|
789
794
|
*
|
|
790
795
|
* @param {string[]} queries
|
|
791
796
|
* @throws {AppwriteException}
|
|
792
|
-
* @returns {Promise<Models.
|
|
797
|
+
* @returns {Promise<Models.BillingAddressList>}
|
|
793
798
|
*/
|
|
794
799
|
listBillingAddresses(queries) {
|
|
795
800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -805,6 +810,60 @@
|
|
|
805
810
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
806
811
|
});
|
|
807
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* Create new billing address
|
|
815
|
+
*
|
|
816
|
+
*
|
|
817
|
+
* @param {string} country
|
|
818
|
+
* @param {string} streetAddress
|
|
819
|
+
* @param {string} city
|
|
820
|
+
* @param {string} state
|
|
821
|
+
* @param {string} postalCode
|
|
822
|
+
* @param {string} addressLine2
|
|
823
|
+
* @throws {AppwriteException}
|
|
824
|
+
* @returns {Promise<{}>}
|
|
825
|
+
*/
|
|
826
|
+
createBillingAddress(country, streetAddress, city, state, postalCode, addressLine2) {
|
|
827
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
828
|
+
if (typeof country === 'undefined') {
|
|
829
|
+
throw new AppwriteException('Missing required parameter: "country"');
|
|
830
|
+
}
|
|
831
|
+
if (typeof streetAddress === 'undefined') {
|
|
832
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
833
|
+
}
|
|
834
|
+
if (typeof city === 'undefined') {
|
|
835
|
+
throw new AppwriteException('Missing required parameter: "city"');
|
|
836
|
+
}
|
|
837
|
+
if (typeof state === 'undefined') {
|
|
838
|
+
throw new AppwriteException('Missing required parameter: "state"');
|
|
839
|
+
}
|
|
840
|
+
const apiPath = '/account/billing-addresses';
|
|
841
|
+
const payload = {};
|
|
842
|
+
if (typeof country !== 'undefined') {
|
|
843
|
+
payload['country'] = country;
|
|
844
|
+
}
|
|
845
|
+
if (typeof streetAddress !== 'undefined') {
|
|
846
|
+
payload['streetAddress'] = streetAddress;
|
|
847
|
+
}
|
|
848
|
+
if (typeof city !== 'undefined') {
|
|
849
|
+
payload['city'] = city;
|
|
850
|
+
}
|
|
851
|
+
if (typeof state !== 'undefined') {
|
|
852
|
+
payload['state'] = state;
|
|
853
|
+
}
|
|
854
|
+
if (typeof postalCode !== 'undefined') {
|
|
855
|
+
payload['postalCode'] = postalCode;
|
|
856
|
+
}
|
|
857
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
858
|
+
payload['addressLine2'] = addressLine2;
|
|
859
|
+
}
|
|
860
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
861
|
+
const apiHeaders = {
|
|
862
|
+
'content-type': 'application/json',
|
|
863
|
+
};
|
|
864
|
+
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
865
|
+
});
|
|
866
|
+
}
|
|
808
867
|
/**
|
|
809
868
|
* Get billing address
|
|
810
869
|
*
|
|
@@ -827,6 +886,86 @@
|
|
|
827
886
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
828
887
|
});
|
|
829
888
|
}
|
|
889
|
+
/**
|
|
890
|
+
* Update billing address
|
|
891
|
+
*
|
|
892
|
+
*
|
|
893
|
+
* @param {string} billingAddressId
|
|
894
|
+
* @param {string} country
|
|
895
|
+
* @param {string} streetAddress
|
|
896
|
+
* @param {string} city
|
|
897
|
+
* @param {string} state
|
|
898
|
+
* @param {string} postalCode
|
|
899
|
+
* @param {string} addressLine2
|
|
900
|
+
* @throws {AppwriteException}
|
|
901
|
+
* @returns {Promise<{}>}
|
|
902
|
+
*/
|
|
903
|
+
updateBillingAddress(billingAddressId, country, streetAddress, city, state, postalCode, addressLine2) {
|
|
904
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
905
|
+
if (typeof billingAddressId === 'undefined') {
|
|
906
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
907
|
+
}
|
|
908
|
+
if (typeof country === 'undefined') {
|
|
909
|
+
throw new AppwriteException('Missing required parameter: "country"');
|
|
910
|
+
}
|
|
911
|
+
if (typeof streetAddress === 'undefined') {
|
|
912
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
913
|
+
}
|
|
914
|
+
if (typeof city === 'undefined') {
|
|
915
|
+
throw new AppwriteException('Missing required parameter: "city"');
|
|
916
|
+
}
|
|
917
|
+
if (typeof state === 'undefined') {
|
|
918
|
+
throw new AppwriteException('Missing required parameter: "state"');
|
|
919
|
+
}
|
|
920
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
921
|
+
const payload = {};
|
|
922
|
+
if (typeof country !== 'undefined') {
|
|
923
|
+
payload['country'] = country;
|
|
924
|
+
}
|
|
925
|
+
if (typeof streetAddress !== 'undefined') {
|
|
926
|
+
payload['streetAddress'] = streetAddress;
|
|
927
|
+
}
|
|
928
|
+
if (typeof city !== 'undefined') {
|
|
929
|
+
payload['city'] = city;
|
|
930
|
+
}
|
|
931
|
+
if (typeof state !== 'undefined') {
|
|
932
|
+
payload['state'] = state;
|
|
933
|
+
}
|
|
934
|
+
if (typeof postalCode !== 'undefined') {
|
|
935
|
+
payload['postalCode'] = postalCode;
|
|
936
|
+
}
|
|
937
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
938
|
+
payload['addressLine2'] = addressLine2;
|
|
939
|
+
}
|
|
940
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
941
|
+
const apiHeaders = {
|
|
942
|
+
'content-type': 'application/json',
|
|
943
|
+
};
|
|
944
|
+
return yield this.client.call('put', uri, apiHeaders, payload);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Delete billing address
|
|
949
|
+
*
|
|
950
|
+
*
|
|
951
|
+
* @param {string} billingAddressId
|
|
952
|
+
* @throws {AppwriteException}
|
|
953
|
+
* @returns {Promise<{}>}
|
|
954
|
+
*/
|
|
955
|
+
deleteBillingAddress(billingAddressId) {
|
|
956
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
957
|
+
if (typeof billingAddressId === 'undefined') {
|
|
958
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
959
|
+
}
|
|
960
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
961
|
+
const payload = {};
|
|
962
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
963
|
+
const apiHeaders = {
|
|
964
|
+
'content-type': 'application/json',
|
|
965
|
+
};
|
|
966
|
+
return yield this.client.call('delete', uri, apiHeaders, payload);
|
|
967
|
+
});
|
|
968
|
+
}
|
|
830
969
|
/**
|
|
831
970
|
* Update email
|
|
832
971
|
*
|
|
@@ -2287,32 +2426,6 @@
|
|
|
2287
2426
|
return yield this.client.call('put', uri, apiHeaders, payload);
|
|
2288
2427
|
});
|
|
2289
2428
|
}
|
|
2290
|
-
/**
|
|
2291
|
-
* List credits
|
|
2292
|
-
*
|
|
2293
|
-
*
|
|
2294
|
-
* @param {string} organizationId
|
|
2295
|
-
* @param {string[]} queries
|
|
2296
|
-
* @throws {AppwriteException}
|
|
2297
|
-
* @returns {Promise<Models.CreditList>}
|
|
2298
|
-
*/
|
|
2299
|
-
listCredits(organizationId, queries) {
|
|
2300
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2301
|
-
if (typeof organizationId === 'undefined') {
|
|
2302
|
-
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
2303
|
-
}
|
|
2304
|
-
const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
|
|
2305
|
-
const payload = {};
|
|
2306
|
-
if (typeof queries !== 'undefined') {
|
|
2307
|
-
payload['queries'] = queries;
|
|
2308
|
-
}
|
|
2309
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2310
|
-
const apiHeaders = {
|
|
2311
|
-
'content-type': 'application/json',
|
|
2312
|
-
};
|
|
2313
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
2314
|
-
});
|
|
2315
|
-
}
|
|
2316
2429
|
}
|
|
2317
2430
|
|
|
2318
2431
|
class Avatars {
|
|
@@ -3012,7 +3125,7 @@
|
|
|
3012
3125
|
* @throws {AppwriteException}
|
|
3013
3126
|
* @returns {Promise<Models.Coupon>}
|
|
3014
3127
|
*/
|
|
3015
|
-
|
|
3128
|
+
getCoupon(couponId) {
|
|
3016
3129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3017
3130
|
if (typeof couponId === 'undefined') {
|
|
3018
3131
|
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
@@ -9496,7 +9609,7 @@
|
|
|
9496
9609
|
* @param {string[]} queries
|
|
9497
9610
|
* @param {string} search
|
|
9498
9611
|
* @throws {AppwriteException}
|
|
9499
|
-
* @returns {Promise<Models.
|
|
9612
|
+
* @returns {Promise<Models.OrganizationList<Preferences>>}
|
|
9500
9613
|
*/
|
|
9501
9614
|
list(queries, search) {
|
|
9502
9615
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9619,7 +9732,7 @@
|
|
|
9619
9732
|
* @param {string} organizationId
|
|
9620
9733
|
* @param {string} aggregationId
|
|
9621
9734
|
* @throws {AppwriteException}
|
|
9622
|
-
* @returns {Promise<Models.
|
|
9735
|
+
* @returns {Promise<Models.AggregationTeam>}
|
|
9623
9736
|
*/
|
|
9624
9737
|
getAggregation(organizationId, aggregationId) {
|
|
9625
9738
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9777,6 +9890,32 @@
|
|
|
9777
9890
|
return yield this.client.call('patch', uri, apiHeaders, payload);
|
|
9778
9891
|
});
|
|
9779
9892
|
}
|
|
9893
|
+
/**
|
|
9894
|
+
* List credits
|
|
9895
|
+
*
|
|
9896
|
+
*
|
|
9897
|
+
* @param {string} organizationId
|
|
9898
|
+
* @param {string[]} queries
|
|
9899
|
+
* @throws {AppwriteException}
|
|
9900
|
+
* @returns {Promise<Models.CreditList>}
|
|
9901
|
+
*/
|
|
9902
|
+
listCredits(organizationId, queries) {
|
|
9903
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9904
|
+
if (typeof organizationId === 'undefined') {
|
|
9905
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
9906
|
+
}
|
|
9907
|
+
const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
|
|
9908
|
+
const payload = {};
|
|
9909
|
+
if (typeof queries !== 'undefined') {
|
|
9910
|
+
payload['queries'] = queries;
|
|
9911
|
+
}
|
|
9912
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9913
|
+
const apiHeaders = {
|
|
9914
|
+
'content-type': 'application/json',
|
|
9915
|
+
};
|
|
9916
|
+
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9917
|
+
});
|
|
9918
|
+
}
|
|
9780
9919
|
/**
|
|
9781
9920
|
* Add credits from coupon
|
|
9782
9921
|
*
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Account } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const account = new Account(client);
|
|
8
|
+
|
|
9
|
+
const result = await account.createBillingAddress(
|
|
10
|
+
'<COUNTRY>', // country
|
|
11
|
+
'<STREET_ADDRESS>', // streetAddress
|
|
12
|
+
'<CITY>', // city
|
|
13
|
+
'<STATE>', // state
|
|
14
|
+
'<POSTAL_CODE>', // postalCode (optional)
|
|
15
|
+
'<ADDRESS_LINE2>' // addressLine2 (optional)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(result);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Client, Account } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const account = new Account(client);
|
|
8
|
+
|
|
9
|
+
const result = await account.deleteBillingAddress(
|
|
10
|
+
'<BILLING_ADDRESS_ID>' // billingAddressId
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
console.log(result);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Client, Account } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const account = new Account(client);
|
|
8
|
+
|
|
9
|
+
const result = await account.updateBillingAddress(
|
|
10
|
+
'<BILLING_ADDRESS_ID>', // billingAddressId
|
|
11
|
+
'<COUNTRY>', // country
|
|
12
|
+
'<STREET_ADDRESS>', // streetAddress
|
|
13
|
+
'<CITY>', // city
|
|
14
|
+
'<STATE>', // state
|
|
15
|
+
'<POSTAL_CODE>', // postalCode (optional)
|
|
16
|
+
'<ADDRESS_LINE2>' // addressLine2 (optional)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
console.log(result);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Client, Console } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const console = new Console(client);
|
|
8
|
+
|
|
9
|
+
const result = await console.getCoupon(
|
|
10
|
+
'<COUPON_ID>' // couponId
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
console.log(result);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client, Organizations } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const organizations = new Organizations(client);
|
|
8
|
+
|
|
9
|
+
const result = await organizations.listCredits(
|
|
10
|
+
'<ORGANIZATION_ID>', // organizationId
|
|
11
|
+
[] // queries (optional)
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
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 abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.4.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
package/src/client.ts
CHANGED
|
@@ -304,7 +304,7 @@ class Client {
|
|
|
304
304
|
'x-sdk-name': 'Console',
|
|
305
305
|
'x-sdk-platform': 'console',
|
|
306
306
|
'x-sdk-language': 'web',
|
|
307
|
-
'x-sdk-version': '1.
|
|
307
|
+
'x-sdk-version': '1.4.0',
|
|
308
308
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
309
309
|
};
|
|
310
310
|
|
|
@@ -682,6 +682,10 @@ class Client {
|
|
|
682
682
|
return response;
|
|
683
683
|
}
|
|
684
684
|
|
|
685
|
+
async ping(): Promise<string> {
|
|
686
|
+
return this.call('GET', new URL(this.config.endpoint + '/ping'));
|
|
687
|
+
}
|
|
688
|
+
|
|
685
689
|
async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {
|
|
686
690
|
const { uri, options } = this.prepareRequest(method, url, headers, params);
|
|
687
691
|
|
package/src/models.ts
CHANGED
|
@@ -4366,7 +4366,7 @@ export namespace Models {
|
|
|
4366
4366
|
/**
|
|
4367
4367
|
* Additional resources
|
|
4368
4368
|
*/
|
|
4369
|
-
addons: AdditionalResource
|
|
4369
|
+
addons: AdditionalResource;
|
|
4370
4370
|
/**
|
|
4371
4371
|
* Custom SMTP
|
|
4372
4372
|
*/
|
|
@@ -4810,6 +4810,14 @@ export namespace Models {
|
|
|
4810
4810
|
* Name of the owner
|
|
4811
4811
|
*/
|
|
4812
4812
|
name: string;
|
|
4813
|
+
/**
|
|
4814
|
+
* Mandate ID of the payment method
|
|
4815
|
+
*/
|
|
4816
|
+
mandateId: string;
|
|
4817
|
+
/**
|
|
4818
|
+
* Country of the payment method
|
|
4819
|
+
*/
|
|
4820
|
+
country: string;
|
|
4813
4821
|
/**
|
|
4814
4822
|
* Last payment error associated with the payment method.
|
|
4815
4823
|
*/
|
|
@@ -5032,6 +5040,10 @@ export namespace Models {
|
|
|
5032
5040
|
* Aggregated stats for total databases storage.
|
|
5033
5041
|
*/
|
|
5034
5042
|
databasesStorageTotal: number;
|
|
5043
|
+
/**
|
|
5044
|
+
* Aggregated stats for total backups storage.
|
|
5045
|
+
*/
|
|
5046
|
+
backupsStorageTotal: number;
|
|
5035
5047
|
/**
|
|
5036
5048
|
* Aggregated stats for total storage.
|
|
5037
5049
|
*/
|
|
@@ -5139,6 +5151,19 @@ export namespace Models {
|
|
|
5139
5151
|
*/
|
|
5140
5152
|
invoices: Invoice[];
|
|
5141
5153
|
}
|
|
5154
|
+
/**
|
|
5155
|
+
* Billing address list
|
|
5156
|
+
*/
|
|
5157
|
+
export type BillingAddressList = {
|
|
5158
|
+
/**
|
|
5159
|
+
* Total number of billingAddresses documents that matched your query.
|
|
5160
|
+
*/
|
|
5161
|
+
total: number;
|
|
5162
|
+
/**
|
|
5163
|
+
* List of billingAddresses.
|
|
5164
|
+
*/
|
|
5165
|
+
billingAddresses: BillingAddress[];
|
|
5166
|
+
}
|
|
5142
5167
|
/**
|
|
5143
5168
|
* Billing plan list
|
|
5144
5169
|
*/
|
|
@@ -5152,6 +5177,19 @@ export namespace Models {
|
|
|
5152
5177
|
*/
|
|
5153
5178
|
plans: BillingPlan[];
|
|
5154
5179
|
}
|
|
5180
|
+
/**
|
|
5181
|
+
* Organizations List
|
|
5182
|
+
*/
|
|
5183
|
+
export type OrganizationList<Preferences extends Models.Preferences> = {
|
|
5184
|
+
/**
|
|
5185
|
+
* Total number of teams documents that matched your query.
|
|
5186
|
+
*/
|
|
5187
|
+
total: number;
|
|
5188
|
+
/**
|
|
5189
|
+
* List of teams.
|
|
5190
|
+
*/
|
|
5191
|
+
teams: Organization<Preferences>[];
|
|
5192
|
+
}
|
|
5155
5193
|
/**
|
|
5156
5194
|
* Payment Methods List
|
|
5157
5195
|
*/
|
package/src/services/account.ts
CHANGED
|
@@ -118,9 +118,9 @@ export class Account {
|
|
|
118
118
|
*
|
|
119
119
|
* @param {string[]} queries
|
|
120
120
|
* @throws {AppwriteException}
|
|
121
|
-
* @returns {Promise<Models.
|
|
121
|
+
* @returns {Promise<Models.BillingAddressList>}
|
|
122
122
|
*/
|
|
123
|
-
async listBillingAddresses(queries?: string[]): Promise<Models.
|
|
123
|
+
async listBillingAddresses(queries?: string[]): Promise<Models.BillingAddressList> {
|
|
124
124
|
const apiPath = '/account/billing-addresses';
|
|
125
125
|
const payload: Payload = {};
|
|
126
126
|
if (typeof queries !== 'undefined') {
|
|
@@ -140,6 +140,66 @@ export class Account {
|
|
|
140
140
|
payload
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Create new billing address
|
|
145
|
+
*
|
|
146
|
+
*
|
|
147
|
+
* @param {string} country
|
|
148
|
+
* @param {string} streetAddress
|
|
149
|
+
* @param {string} city
|
|
150
|
+
* @param {string} state
|
|
151
|
+
* @param {string} postalCode
|
|
152
|
+
* @param {string} addressLine2
|
|
153
|
+
* @throws {AppwriteException}
|
|
154
|
+
* @returns {Promise<{}>}
|
|
155
|
+
*/
|
|
156
|
+
async createBillingAddress(country: string, streetAddress: string, city: string, state: string, postalCode?: string, addressLine2?: string): Promise<{}> {
|
|
157
|
+
if (typeof country === 'undefined') {
|
|
158
|
+
throw new AppwriteException('Missing required parameter: "country"');
|
|
159
|
+
}
|
|
160
|
+
if (typeof streetAddress === 'undefined') {
|
|
161
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
162
|
+
}
|
|
163
|
+
if (typeof city === 'undefined') {
|
|
164
|
+
throw new AppwriteException('Missing required parameter: "city"');
|
|
165
|
+
}
|
|
166
|
+
if (typeof state === 'undefined') {
|
|
167
|
+
throw new AppwriteException('Missing required parameter: "state"');
|
|
168
|
+
}
|
|
169
|
+
const apiPath = '/account/billing-addresses';
|
|
170
|
+
const payload: Payload = {};
|
|
171
|
+
if (typeof country !== 'undefined') {
|
|
172
|
+
payload['country'] = country;
|
|
173
|
+
}
|
|
174
|
+
if (typeof streetAddress !== 'undefined') {
|
|
175
|
+
payload['streetAddress'] = streetAddress;
|
|
176
|
+
}
|
|
177
|
+
if (typeof city !== 'undefined') {
|
|
178
|
+
payload['city'] = city;
|
|
179
|
+
}
|
|
180
|
+
if (typeof state !== 'undefined') {
|
|
181
|
+
payload['state'] = state;
|
|
182
|
+
}
|
|
183
|
+
if (typeof postalCode !== 'undefined') {
|
|
184
|
+
payload['postalCode'] = postalCode;
|
|
185
|
+
}
|
|
186
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
187
|
+
payload['addressLine2'] = addressLine2;
|
|
188
|
+
}
|
|
189
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
190
|
+
|
|
191
|
+
const apiHeaders: { [header: string]: string } = {
|
|
192
|
+
'content-type': 'application/json',
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
return await this.client.call(
|
|
197
|
+
'post',
|
|
198
|
+
uri,
|
|
199
|
+
apiHeaders,
|
|
200
|
+
payload
|
|
201
|
+
);
|
|
202
|
+
}
|
|
143
203
|
/**
|
|
144
204
|
* Get billing address
|
|
145
205
|
*
|
|
@@ -168,6 +228,98 @@ export class Account {
|
|
|
168
228
|
payload
|
|
169
229
|
);
|
|
170
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Update billing address
|
|
233
|
+
*
|
|
234
|
+
*
|
|
235
|
+
* @param {string} billingAddressId
|
|
236
|
+
* @param {string} country
|
|
237
|
+
* @param {string} streetAddress
|
|
238
|
+
* @param {string} city
|
|
239
|
+
* @param {string} state
|
|
240
|
+
* @param {string} postalCode
|
|
241
|
+
* @param {string} addressLine2
|
|
242
|
+
* @throws {AppwriteException}
|
|
243
|
+
* @returns {Promise<{}>}
|
|
244
|
+
*/
|
|
245
|
+
async updateBillingAddress(billingAddressId: string, country: string, streetAddress: string, city: string, state: string, postalCode?: string, addressLine2?: string): Promise<{}> {
|
|
246
|
+
if (typeof billingAddressId === 'undefined') {
|
|
247
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
248
|
+
}
|
|
249
|
+
if (typeof country === 'undefined') {
|
|
250
|
+
throw new AppwriteException('Missing required parameter: "country"');
|
|
251
|
+
}
|
|
252
|
+
if (typeof streetAddress === 'undefined') {
|
|
253
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
254
|
+
}
|
|
255
|
+
if (typeof city === 'undefined') {
|
|
256
|
+
throw new AppwriteException('Missing required parameter: "city"');
|
|
257
|
+
}
|
|
258
|
+
if (typeof state === 'undefined') {
|
|
259
|
+
throw new AppwriteException('Missing required parameter: "state"');
|
|
260
|
+
}
|
|
261
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
262
|
+
const payload: Payload = {};
|
|
263
|
+
if (typeof country !== 'undefined') {
|
|
264
|
+
payload['country'] = country;
|
|
265
|
+
}
|
|
266
|
+
if (typeof streetAddress !== 'undefined') {
|
|
267
|
+
payload['streetAddress'] = streetAddress;
|
|
268
|
+
}
|
|
269
|
+
if (typeof city !== 'undefined') {
|
|
270
|
+
payload['city'] = city;
|
|
271
|
+
}
|
|
272
|
+
if (typeof state !== 'undefined') {
|
|
273
|
+
payload['state'] = state;
|
|
274
|
+
}
|
|
275
|
+
if (typeof postalCode !== 'undefined') {
|
|
276
|
+
payload['postalCode'] = postalCode;
|
|
277
|
+
}
|
|
278
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
279
|
+
payload['addressLine2'] = addressLine2;
|
|
280
|
+
}
|
|
281
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
282
|
+
|
|
283
|
+
const apiHeaders: { [header: string]: string } = {
|
|
284
|
+
'content-type': 'application/json',
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
return await this.client.call(
|
|
289
|
+
'put',
|
|
290
|
+
uri,
|
|
291
|
+
apiHeaders,
|
|
292
|
+
payload
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Delete billing address
|
|
297
|
+
*
|
|
298
|
+
*
|
|
299
|
+
* @param {string} billingAddressId
|
|
300
|
+
* @throws {AppwriteException}
|
|
301
|
+
* @returns {Promise<{}>}
|
|
302
|
+
*/
|
|
303
|
+
async deleteBillingAddress(billingAddressId: string): Promise<{}> {
|
|
304
|
+
if (typeof billingAddressId === 'undefined') {
|
|
305
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
306
|
+
}
|
|
307
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
308
|
+
const payload: Payload = {};
|
|
309
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
310
|
+
|
|
311
|
+
const apiHeaders: { [header: string]: string } = {
|
|
312
|
+
'content-type': 'application/json',
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
return await this.client.call(
|
|
317
|
+
'delete',
|
|
318
|
+
uri,
|
|
319
|
+
apiHeaders,
|
|
320
|
+
payload
|
|
321
|
+
);
|
|
322
|
+
}
|
|
171
323
|
/**
|
|
172
324
|
* Update email
|
|
173
325
|
*
|
|
@@ -1940,36 +2092,4 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1940
2092
|
payload
|
|
1941
2093
|
);
|
|
1942
2094
|
}
|
|
1943
|
-
/**
|
|
1944
|
-
* List credits
|
|
1945
|
-
*
|
|
1946
|
-
*
|
|
1947
|
-
* @param {string} organizationId
|
|
1948
|
-
* @param {string[]} queries
|
|
1949
|
-
* @throws {AppwriteException}
|
|
1950
|
-
* @returns {Promise<Models.CreditList>}
|
|
1951
|
-
*/
|
|
1952
|
-
async listCredits(organizationId: string, queries?: string[]): Promise<Models.CreditList> {
|
|
1953
|
-
if (typeof organizationId === 'undefined') {
|
|
1954
|
-
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
1955
|
-
}
|
|
1956
|
-
const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
|
|
1957
|
-
const payload: Payload = {};
|
|
1958
|
-
if (typeof queries !== 'undefined') {
|
|
1959
|
-
payload['queries'] = queries;
|
|
1960
|
-
}
|
|
1961
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1962
|
-
|
|
1963
|
-
const apiHeaders: { [header: string]: string } = {
|
|
1964
|
-
'content-type': 'application/json',
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
return await this.client.call(
|
|
1969
|
-
'get',
|
|
1970
|
-
uri,
|
|
1971
|
-
apiHeaders,
|
|
1972
|
-
payload
|
|
1973
|
-
);
|
|
1974
|
-
}
|
|
1975
2095
|
}
|
package/src/services/console.ts
CHANGED
|
@@ -45,7 +45,7 @@ export class Console {
|
|
|
45
45
|
* @throws {AppwriteException}
|
|
46
46
|
* @returns {Promise<Models.Coupon>}
|
|
47
47
|
*/
|
|
48
|
-
async
|
|
48
|
+
async getCoupon(couponId: string): Promise<Models.Coupon> {
|
|
49
49
|
if (typeof couponId === 'undefined') {
|
|
50
50
|
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
51
51
|
}
|