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