@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/esm/sdk.js
CHANGED
|
@@ -278,7 +278,7 @@ class Client {
|
|
|
278
278
|
'x-sdk-name': 'Console',
|
|
279
279
|
'x-sdk-platform': 'console',
|
|
280
280
|
'x-sdk-language': 'web',
|
|
281
|
-
'x-sdk-version': '1.
|
|
281
|
+
'x-sdk-version': '1.4.0',
|
|
282
282
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
283
283
|
};
|
|
284
284
|
this.realtime = {
|
|
@@ -623,6 +623,11 @@ class Client {
|
|
|
623
623
|
return response;
|
|
624
624
|
});
|
|
625
625
|
}
|
|
626
|
+
ping() {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
628
|
+
return this.call('GET', new URL(this.config.endpoint + '/ping'));
|
|
629
|
+
});
|
|
630
|
+
}
|
|
626
631
|
call(method, url, headers = {}, params = {}, responseType = 'json') {
|
|
627
632
|
var _a;
|
|
628
633
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -786,7 +791,7 @@ class Account {
|
|
|
786
791
|
*
|
|
787
792
|
* @param {string[]} queries
|
|
788
793
|
* @throws {AppwriteException}
|
|
789
|
-
* @returns {Promise<Models.
|
|
794
|
+
* @returns {Promise<Models.BillingAddressList>}
|
|
790
795
|
*/
|
|
791
796
|
listBillingAddresses(queries) {
|
|
792
797
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -802,6 +807,60 @@ class Account {
|
|
|
802
807
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
803
808
|
});
|
|
804
809
|
}
|
|
810
|
+
/**
|
|
811
|
+
* Create new billing address
|
|
812
|
+
*
|
|
813
|
+
*
|
|
814
|
+
* @param {string} country
|
|
815
|
+
* @param {string} streetAddress
|
|
816
|
+
* @param {string} city
|
|
817
|
+
* @param {string} state
|
|
818
|
+
* @param {string} postalCode
|
|
819
|
+
* @param {string} addressLine2
|
|
820
|
+
* @throws {AppwriteException}
|
|
821
|
+
* @returns {Promise<{}>}
|
|
822
|
+
*/
|
|
823
|
+
createBillingAddress(country, streetAddress, city, state, postalCode, addressLine2) {
|
|
824
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
825
|
+
if (typeof country === 'undefined') {
|
|
826
|
+
throw new AppwriteException('Missing required parameter: "country"');
|
|
827
|
+
}
|
|
828
|
+
if (typeof streetAddress === 'undefined') {
|
|
829
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
830
|
+
}
|
|
831
|
+
if (typeof city === 'undefined') {
|
|
832
|
+
throw new AppwriteException('Missing required parameter: "city"');
|
|
833
|
+
}
|
|
834
|
+
if (typeof state === 'undefined') {
|
|
835
|
+
throw new AppwriteException('Missing required parameter: "state"');
|
|
836
|
+
}
|
|
837
|
+
const apiPath = '/account/billing-addresses';
|
|
838
|
+
const payload = {};
|
|
839
|
+
if (typeof country !== 'undefined') {
|
|
840
|
+
payload['country'] = country;
|
|
841
|
+
}
|
|
842
|
+
if (typeof streetAddress !== 'undefined') {
|
|
843
|
+
payload['streetAddress'] = streetAddress;
|
|
844
|
+
}
|
|
845
|
+
if (typeof city !== 'undefined') {
|
|
846
|
+
payload['city'] = city;
|
|
847
|
+
}
|
|
848
|
+
if (typeof state !== 'undefined') {
|
|
849
|
+
payload['state'] = state;
|
|
850
|
+
}
|
|
851
|
+
if (typeof postalCode !== 'undefined') {
|
|
852
|
+
payload['postalCode'] = postalCode;
|
|
853
|
+
}
|
|
854
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
855
|
+
payload['addressLine2'] = addressLine2;
|
|
856
|
+
}
|
|
857
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
858
|
+
const apiHeaders = {
|
|
859
|
+
'content-type': 'application/json',
|
|
860
|
+
};
|
|
861
|
+
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
862
|
+
});
|
|
863
|
+
}
|
|
805
864
|
/**
|
|
806
865
|
* Get billing address
|
|
807
866
|
*
|
|
@@ -824,6 +883,86 @@ class Account {
|
|
|
824
883
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
825
884
|
});
|
|
826
885
|
}
|
|
886
|
+
/**
|
|
887
|
+
* Update billing address
|
|
888
|
+
*
|
|
889
|
+
*
|
|
890
|
+
* @param {string} billingAddressId
|
|
891
|
+
* @param {string} country
|
|
892
|
+
* @param {string} streetAddress
|
|
893
|
+
* @param {string} city
|
|
894
|
+
* @param {string} state
|
|
895
|
+
* @param {string} postalCode
|
|
896
|
+
* @param {string} addressLine2
|
|
897
|
+
* @throws {AppwriteException}
|
|
898
|
+
* @returns {Promise<{}>}
|
|
899
|
+
*/
|
|
900
|
+
updateBillingAddress(billingAddressId, country, streetAddress, city, state, postalCode, addressLine2) {
|
|
901
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
902
|
+
if (typeof billingAddressId === 'undefined') {
|
|
903
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
904
|
+
}
|
|
905
|
+
if (typeof country === 'undefined') {
|
|
906
|
+
throw new AppwriteException('Missing required parameter: "country"');
|
|
907
|
+
}
|
|
908
|
+
if (typeof streetAddress === 'undefined') {
|
|
909
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
910
|
+
}
|
|
911
|
+
if (typeof city === 'undefined') {
|
|
912
|
+
throw new AppwriteException('Missing required parameter: "city"');
|
|
913
|
+
}
|
|
914
|
+
if (typeof state === 'undefined') {
|
|
915
|
+
throw new AppwriteException('Missing required parameter: "state"');
|
|
916
|
+
}
|
|
917
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
918
|
+
const payload = {};
|
|
919
|
+
if (typeof country !== 'undefined') {
|
|
920
|
+
payload['country'] = country;
|
|
921
|
+
}
|
|
922
|
+
if (typeof streetAddress !== 'undefined') {
|
|
923
|
+
payload['streetAddress'] = streetAddress;
|
|
924
|
+
}
|
|
925
|
+
if (typeof city !== 'undefined') {
|
|
926
|
+
payload['city'] = city;
|
|
927
|
+
}
|
|
928
|
+
if (typeof state !== 'undefined') {
|
|
929
|
+
payload['state'] = state;
|
|
930
|
+
}
|
|
931
|
+
if (typeof postalCode !== 'undefined') {
|
|
932
|
+
payload['postalCode'] = postalCode;
|
|
933
|
+
}
|
|
934
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
935
|
+
payload['addressLine2'] = addressLine2;
|
|
936
|
+
}
|
|
937
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
938
|
+
const apiHeaders = {
|
|
939
|
+
'content-type': 'application/json',
|
|
940
|
+
};
|
|
941
|
+
return yield this.client.call('put', uri, apiHeaders, payload);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Delete billing address
|
|
946
|
+
*
|
|
947
|
+
*
|
|
948
|
+
* @param {string} billingAddressId
|
|
949
|
+
* @throws {AppwriteException}
|
|
950
|
+
* @returns {Promise<{}>}
|
|
951
|
+
*/
|
|
952
|
+
deleteBillingAddress(billingAddressId) {
|
|
953
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
954
|
+
if (typeof billingAddressId === 'undefined') {
|
|
955
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
956
|
+
}
|
|
957
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
958
|
+
const payload = {};
|
|
959
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
960
|
+
const apiHeaders = {
|
|
961
|
+
'content-type': 'application/json',
|
|
962
|
+
};
|
|
963
|
+
return yield this.client.call('delete', uri, apiHeaders, payload);
|
|
964
|
+
});
|
|
965
|
+
}
|
|
827
966
|
/**
|
|
828
967
|
* Update email
|
|
829
968
|
*
|
|
@@ -2284,32 +2423,6 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
2284
2423
|
return yield this.client.call('put', uri, apiHeaders, payload);
|
|
2285
2424
|
});
|
|
2286
2425
|
}
|
|
2287
|
-
/**
|
|
2288
|
-
* List credits
|
|
2289
|
-
*
|
|
2290
|
-
*
|
|
2291
|
-
* @param {string} organizationId
|
|
2292
|
-
* @param {string[]} queries
|
|
2293
|
-
* @throws {AppwriteException}
|
|
2294
|
-
* @returns {Promise<Models.CreditList>}
|
|
2295
|
-
*/
|
|
2296
|
-
listCredits(organizationId, queries) {
|
|
2297
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2298
|
-
if (typeof organizationId === 'undefined') {
|
|
2299
|
-
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
2300
|
-
}
|
|
2301
|
-
const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
|
|
2302
|
-
const payload = {};
|
|
2303
|
-
if (typeof queries !== 'undefined') {
|
|
2304
|
-
payload['queries'] = queries;
|
|
2305
|
-
}
|
|
2306
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2307
|
-
const apiHeaders = {
|
|
2308
|
-
'content-type': 'application/json',
|
|
2309
|
-
};
|
|
2310
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
2426
|
}
|
|
2314
2427
|
|
|
2315
2428
|
class Avatars {
|
|
@@ -3009,7 +3122,7 @@ class Console {
|
|
|
3009
3122
|
* @throws {AppwriteException}
|
|
3010
3123
|
* @returns {Promise<Models.Coupon>}
|
|
3011
3124
|
*/
|
|
3012
|
-
|
|
3125
|
+
getCoupon(couponId) {
|
|
3013
3126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3014
3127
|
if (typeof couponId === 'undefined') {
|
|
3015
3128
|
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
@@ -9493,7 +9606,7 @@ class Organizations {
|
|
|
9493
9606
|
* @param {string[]} queries
|
|
9494
9607
|
* @param {string} search
|
|
9495
9608
|
* @throws {AppwriteException}
|
|
9496
|
-
* @returns {Promise<Models.
|
|
9609
|
+
* @returns {Promise<Models.OrganizationList<Preferences>>}
|
|
9497
9610
|
*/
|
|
9498
9611
|
list(queries, search) {
|
|
9499
9612
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9616,7 +9729,7 @@ class Organizations {
|
|
|
9616
9729
|
* @param {string} organizationId
|
|
9617
9730
|
* @param {string} aggregationId
|
|
9618
9731
|
* @throws {AppwriteException}
|
|
9619
|
-
* @returns {Promise<Models.
|
|
9732
|
+
* @returns {Promise<Models.AggregationTeam>}
|
|
9620
9733
|
*/
|
|
9621
9734
|
getAggregation(organizationId, aggregationId) {
|
|
9622
9735
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9774,6 +9887,32 @@ class Organizations {
|
|
|
9774
9887
|
return yield this.client.call('patch', uri, apiHeaders, payload);
|
|
9775
9888
|
});
|
|
9776
9889
|
}
|
|
9890
|
+
/**
|
|
9891
|
+
* List credits
|
|
9892
|
+
*
|
|
9893
|
+
*
|
|
9894
|
+
* @param {string} organizationId
|
|
9895
|
+
* @param {string[]} queries
|
|
9896
|
+
* @throws {AppwriteException}
|
|
9897
|
+
* @returns {Promise<Models.CreditList>}
|
|
9898
|
+
*/
|
|
9899
|
+
listCredits(organizationId, queries) {
|
|
9900
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9901
|
+
if (typeof organizationId === 'undefined') {
|
|
9902
|
+
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
9903
|
+
}
|
|
9904
|
+
const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
|
|
9905
|
+
const payload = {};
|
|
9906
|
+
if (typeof queries !== 'undefined') {
|
|
9907
|
+
payload['queries'] = queries;
|
|
9908
|
+
}
|
|
9909
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9910
|
+
const apiHeaders = {
|
|
9911
|
+
'content-type': 'application/json',
|
|
9912
|
+
};
|
|
9913
|
+
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9914
|
+
});
|
|
9915
|
+
}
|
|
9777
9916
|
/**
|
|
9778
9917
|
* Add credits from coupon
|
|
9779
9918
|
*
|