@appwrite.io/console 1.3.2 → 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 +165 -31
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +165 -31
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +165 -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 +1 -1
- package/src/models.ts +35 -1
- package/src/services/account.ts +154 -34
- package/src/services/console.ts +1 -1
- package/src/services/organizations.ts +36 -4
- package/types/models.d.ts +35 -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 = {
|
|
@@ -794,7 +794,7 @@
|
|
|
794
794
|
*
|
|
795
795
|
* @param {string[]} queries
|
|
796
796
|
* @throws {AppwriteException}
|
|
797
|
-
* @returns {Promise<Models.
|
|
797
|
+
* @returns {Promise<Models.BillingAddressList>}
|
|
798
798
|
*/
|
|
799
799
|
listBillingAddresses(queries) {
|
|
800
800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -810,6 +810,60 @@
|
|
|
810
810
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
811
811
|
});
|
|
812
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
|
+
}
|
|
813
867
|
/**
|
|
814
868
|
* Get billing address
|
|
815
869
|
*
|
|
@@ -832,6 +886,86 @@
|
|
|
832
886
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
833
887
|
});
|
|
834
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
|
+
}
|
|
835
969
|
/**
|
|
836
970
|
* Update email
|
|
837
971
|
*
|
|
@@ -2292,32 +2426,6 @@
|
|
|
2292
2426
|
return yield this.client.call('put', uri, apiHeaders, payload);
|
|
2293
2427
|
});
|
|
2294
2428
|
}
|
|
2295
|
-
/**
|
|
2296
|
-
* List credits
|
|
2297
|
-
*
|
|
2298
|
-
*
|
|
2299
|
-
* @param {string} organizationId
|
|
2300
|
-
* @param {string[]} queries
|
|
2301
|
-
* @throws {AppwriteException}
|
|
2302
|
-
* @returns {Promise<Models.CreditList>}
|
|
2303
|
-
*/
|
|
2304
|
-
listCredits(organizationId, queries) {
|
|
2305
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2306
|
-
if (typeof organizationId === 'undefined') {
|
|
2307
|
-
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
2308
|
-
}
|
|
2309
|
-
const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
|
|
2310
|
-
const payload = {};
|
|
2311
|
-
if (typeof queries !== 'undefined') {
|
|
2312
|
-
payload['queries'] = queries;
|
|
2313
|
-
}
|
|
2314
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2315
|
-
const apiHeaders = {
|
|
2316
|
-
'content-type': 'application/json',
|
|
2317
|
-
};
|
|
2318
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
2319
|
-
});
|
|
2320
|
-
}
|
|
2321
2429
|
}
|
|
2322
2430
|
|
|
2323
2431
|
class Avatars {
|
|
@@ -3017,7 +3125,7 @@
|
|
|
3017
3125
|
* @throws {AppwriteException}
|
|
3018
3126
|
* @returns {Promise<Models.Coupon>}
|
|
3019
3127
|
*/
|
|
3020
|
-
|
|
3128
|
+
getCoupon(couponId) {
|
|
3021
3129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3022
3130
|
if (typeof couponId === 'undefined') {
|
|
3023
3131
|
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
@@ -9501,7 +9609,7 @@
|
|
|
9501
9609
|
* @param {string[]} queries
|
|
9502
9610
|
* @param {string} search
|
|
9503
9611
|
* @throws {AppwriteException}
|
|
9504
|
-
* @returns {Promise<Models.
|
|
9612
|
+
* @returns {Promise<Models.OrganizationList<Preferences>>}
|
|
9505
9613
|
*/
|
|
9506
9614
|
list(queries, search) {
|
|
9507
9615
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9624,7 +9732,7 @@
|
|
|
9624
9732
|
* @param {string} organizationId
|
|
9625
9733
|
* @param {string} aggregationId
|
|
9626
9734
|
* @throws {AppwriteException}
|
|
9627
|
-
* @returns {Promise<Models.
|
|
9735
|
+
* @returns {Promise<Models.AggregationTeam>}
|
|
9628
9736
|
*/
|
|
9629
9737
|
getAggregation(organizationId, aggregationId) {
|
|
9630
9738
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9782,6 +9890,32 @@
|
|
|
9782
9890
|
return yield this.client.call('patch', uri, apiHeaders, payload);
|
|
9783
9891
|
});
|
|
9784
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
|
+
}
|
|
9785
9919
|
/**
|
|
9786
9920
|
* Add credits from coupon
|
|
9787
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
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
|
*/
|
|
@@ -5143,6 +5151,19 @@ export namespace Models {
|
|
|
5143
5151
|
*/
|
|
5144
5152
|
invoices: Invoice[];
|
|
5145
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
|
+
}
|
|
5146
5167
|
/**
|
|
5147
5168
|
* Billing plan list
|
|
5148
5169
|
*/
|
|
@@ -5156,6 +5177,19 @@ export namespace Models {
|
|
|
5156
5177
|
*/
|
|
5157
5178
|
plans: BillingPlan[];
|
|
5158
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
|
+
}
|
|
5159
5193
|
/**
|
|
5160
5194
|
* Payment Methods List
|
|
5161
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
|
}
|