@appwrite.io/console 1.2.2 → 1.3.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/.github/workflows/autoclose.yml +1 -1
- package/README.md +1 -1
- package/dist/cjs/sdk.js +4875 -3335
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +4874 -3336
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +4875 -3335
- package/docs/examples/account/create-payment-method.md +11 -0
- package/docs/examples/account/delete-payment-method.md +13 -0
- package/docs/examples/account/get-billing-address.md +13 -0
- package/docs/examples/account/get-payment-method.md +13 -0
- package/docs/examples/account/list-billing-addresses.md +13 -0
- package/docs/examples/account/list-credits.md +14 -0
- package/docs/examples/account/list-invoices.md +13 -0
- package/docs/examples/account/list-payment-methods.md +13 -0
- package/docs/examples/account/update-payment-method-mandate-options.md +13 -0
- package/docs/examples/account/update-payment-method-provider.md +15 -0
- package/docs/examples/account/update-payment-method.md +15 -0
- package/docs/examples/backups/create-archive.md +14 -0
- package/docs/examples/backups/create-policy.md +19 -0
- package/docs/examples/backups/create-restoration.md +16 -0
- package/docs/examples/backups/delete-archive.md +13 -0
- package/docs/examples/backups/delete-policy.md +13 -0
- package/docs/examples/backups/get-archive.md +13 -0
- package/docs/examples/backups/get-policy.md +13 -0
- package/docs/examples/backups/get-restoration.md +13 -0
- package/docs/examples/backups/list-archives.md +13 -0
- package/docs/examples/backups/list-policies.md +13 -0
- package/docs/examples/backups/list-restorations.md +13 -0
- package/docs/examples/backups/update-policy.md +17 -0
- package/docs/examples/console/create-source.md +17 -0
- package/docs/examples/console/get-campaign.md +13 -0
- package/docs/examples/console/get-copon.md +13 -0
- package/docs/examples/console/plans.md +11 -0
- package/docs/examples/console/regions.md +11 -0
- package/docs/examples/health/get-queue-billing-aggregation.md +13 -0
- package/docs/examples/health/get-queue-priority-builds.md +13 -0
- package/docs/examples/organizations/add-credit.md +14 -0
- package/docs/examples/organizations/create-invoice-payment.md +15 -0
- package/docs/examples/organizations/create.md +17 -0
- package/docs/examples/organizations/delete-backup-payment-method.md +13 -0
- package/docs/examples/organizations/delete-billing-address.md +13 -0
- package/docs/examples/organizations/delete-default-payment-method.md +13 -0
- package/docs/examples/organizations/delete.md +13 -0
- package/docs/examples/organizations/get-aggregation.md +14 -0
- package/docs/examples/organizations/get-billing-address.md +14 -0
- package/docs/examples/organizations/get-credit.md +14 -0
- package/docs/examples/organizations/get-invoice-download.md +14 -0
- package/docs/examples/organizations/get-invoice-view.md +14 -0
- package/docs/examples/organizations/get-invoice.md +14 -0
- package/docs/examples/organizations/get-payment-method.md +14 -0
- package/docs/examples/organizations/get-plan.md +13 -0
- package/docs/examples/organizations/get-scopes.md +13 -0
- package/docs/examples/organizations/get-usage.md +15 -0
- package/docs/examples/organizations/list-aggregations.md +14 -0
- package/docs/examples/organizations/list-invoices.md +14 -0
- package/docs/examples/organizations/list.md +14 -0
- package/docs/examples/organizations/set-backup-payment-method.md +14 -0
- package/docs/examples/organizations/set-billing-address.md +14 -0
- package/docs/examples/organizations/set-billing-email.md +14 -0
- package/docs/examples/organizations/set-billing-tax-id.md +14 -0
- package/docs/examples/organizations/set-default-payment-method.md +14 -0
- package/docs/examples/organizations/update-budget.md +15 -0
- package/docs/examples/organizations/update-plan.md +16 -0
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/billing-plan.ts +5 -0
- package/src/enums/runtime.ts +0 -3
- package/src/index.ts +3 -0
- package/src/models.ts +1112 -1
- package/src/services/account.ts +336 -0
- package/src/services/backups.ts +425 -0
- package/src/services/console.ts +148 -0
- package/src/services/health.ts +56 -0
- package/src/services/organizations.ts +924 -0
- package/types/enums/billing-plan.d.ts +5 -0
- package/types/enums/runtime.d.ts +0 -3
- package/types/index.d.ts +3 -0
- package/types/models.d.ts +1112 -1
- package/types/services/account.d.ts +103 -0
- package/types/services/backups.d.ts +128 -0
- package/types/services/console.d.ts +47 -0
- package/types/services/health.d.ts +18 -0
- package/types/services/organizations.d.ts +282 -0
- package/.travis.yml +0 -32
package/src/services/account.ts
CHANGED
|
@@ -112,6 +112,62 @@ export class Account {
|
|
|
112
112
|
payload
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* List billing addresses
|
|
117
|
+
*
|
|
118
|
+
*
|
|
119
|
+
* @param {string[]} queries
|
|
120
|
+
* @throws {AppwriteException}
|
|
121
|
+
* @returns {Promise<Models.BillingAddress>}
|
|
122
|
+
*/
|
|
123
|
+
async listBillingAddresses(queries?: string[]): Promise<Models.BillingAddress> {
|
|
124
|
+
const apiPath = '/account/billing-addresses';
|
|
125
|
+
const payload: Payload = {};
|
|
126
|
+
if (typeof queries !== 'undefined') {
|
|
127
|
+
payload['queries'] = queries;
|
|
128
|
+
}
|
|
129
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
130
|
+
|
|
131
|
+
const apiHeaders: { [header: string]: string } = {
|
|
132
|
+
'content-type': 'application/json',
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
return await this.client.call(
|
|
137
|
+
'get',
|
|
138
|
+
uri,
|
|
139
|
+
apiHeaders,
|
|
140
|
+
payload
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get billing address
|
|
145
|
+
*
|
|
146
|
+
*
|
|
147
|
+
* @param {string} billingAddressId
|
|
148
|
+
* @throws {AppwriteException}
|
|
149
|
+
* @returns {Promise<Models.BillingAddress>}
|
|
150
|
+
*/
|
|
151
|
+
async getBillingAddress(billingAddressId: string): Promise<Models.BillingAddress> {
|
|
152
|
+
if (typeof billingAddressId === 'undefined') {
|
|
153
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
154
|
+
}
|
|
155
|
+
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
156
|
+
const payload: Payload = {};
|
|
157
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
158
|
+
|
|
159
|
+
const apiHeaders: { [header: string]: string } = {
|
|
160
|
+
'content-type': 'application/json',
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
return await this.client.call(
|
|
165
|
+
'get',
|
|
166
|
+
uri,
|
|
167
|
+
apiHeaders,
|
|
168
|
+
payload
|
|
169
|
+
);
|
|
170
|
+
}
|
|
115
171
|
/**
|
|
116
172
|
* Update email
|
|
117
173
|
*
|
|
@@ -211,6 +267,34 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
211
267
|
payload
|
|
212
268
|
);
|
|
213
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* List invoices
|
|
272
|
+
*
|
|
273
|
+
*
|
|
274
|
+
* @param {string[]} queries
|
|
275
|
+
* @throws {AppwriteException}
|
|
276
|
+
* @returns {Promise<Models.InvoiceList>}
|
|
277
|
+
*/
|
|
278
|
+
async listInvoices(queries?: string[]): Promise<Models.InvoiceList> {
|
|
279
|
+
const apiPath = '/account/invoices';
|
|
280
|
+
const payload: Payload = {};
|
|
281
|
+
if (typeof queries !== 'undefined') {
|
|
282
|
+
payload['queries'] = queries;
|
|
283
|
+
}
|
|
284
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
285
|
+
|
|
286
|
+
const apiHeaders: { [header: string]: string } = {
|
|
287
|
+
'content-type': 'application/json',
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
return await this.client.call(
|
|
292
|
+
'get',
|
|
293
|
+
uri,
|
|
294
|
+
apiHeaders,
|
|
295
|
+
payload
|
|
296
|
+
);
|
|
297
|
+
}
|
|
214
298
|
/**
|
|
215
299
|
* Create JWT
|
|
216
300
|
*
|
|
@@ -623,6 +707,226 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
623
707
|
}
|
|
624
708
|
|
|
625
709
|
|
|
710
|
+
return await this.client.call(
|
|
711
|
+
'patch',
|
|
712
|
+
uri,
|
|
713
|
+
apiHeaders,
|
|
714
|
+
payload
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* List payment methods
|
|
719
|
+
*
|
|
720
|
+
*
|
|
721
|
+
* @param {string[]} queries
|
|
722
|
+
* @throws {AppwriteException}
|
|
723
|
+
* @returns {Promise<Models.PaymentMethodList>}
|
|
724
|
+
*/
|
|
725
|
+
async listPaymentMethods(queries?: string[]): Promise<Models.PaymentMethodList> {
|
|
726
|
+
const apiPath = '/account/payment-methods';
|
|
727
|
+
const payload: Payload = {};
|
|
728
|
+
if (typeof queries !== 'undefined') {
|
|
729
|
+
payload['queries'] = queries;
|
|
730
|
+
}
|
|
731
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
732
|
+
|
|
733
|
+
const apiHeaders: { [header: string]: string } = {
|
|
734
|
+
'content-type': 'application/json',
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
return await this.client.call(
|
|
739
|
+
'get',
|
|
740
|
+
uri,
|
|
741
|
+
apiHeaders,
|
|
742
|
+
payload
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Create new payment method
|
|
747
|
+
*
|
|
748
|
+
*
|
|
749
|
+
* @throws {AppwriteException}
|
|
750
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
751
|
+
*/
|
|
752
|
+
async createPaymentMethod(): Promise<Models.PaymentMethod> {
|
|
753
|
+
const apiPath = '/account/payment-methods';
|
|
754
|
+
const payload: Payload = {};
|
|
755
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
756
|
+
|
|
757
|
+
const apiHeaders: { [header: string]: string } = {
|
|
758
|
+
'content-type': 'application/json',
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
return await this.client.call(
|
|
763
|
+
'post',
|
|
764
|
+
uri,
|
|
765
|
+
apiHeaders,
|
|
766
|
+
payload
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Get payment method
|
|
771
|
+
*
|
|
772
|
+
*
|
|
773
|
+
* @param {string} paymentMethodId
|
|
774
|
+
* @throws {AppwriteException}
|
|
775
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
776
|
+
*/
|
|
777
|
+
async getPaymentMethod(paymentMethodId: string): Promise<Models.PaymentMethod> {
|
|
778
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
779
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
780
|
+
}
|
|
781
|
+
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
782
|
+
const payload: Payload = {};
|
|
783
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
784
|
+
|
|
785
|
+
const apiHeaders: { [header: string]: string } = {
|
|
786
|
+
'content-type': 'application/json',
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
return await this.client.call(
|
|
791
|
+
'get',
|
|
792
|
+
uri,
|
|
793
|
+
apiHeaders,
|
|
794
|
+
payload
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Update payment method
|
|
799
|
+
*
|
|
800
|
+
*
|
|
801
|
+
* @param {string} paymentMethodId
|
|
802
|
+
* @param {number} expiryMonth
|
|
803
|
+
* @param {number} expiryYear
|
|
804
|
+
* @throws {AppwriteException}
|
|
805
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
806
|
+
*/
|
|
807
|
+
async updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number): Promise<Models.PaymentMethod> {
|
|
808
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
809
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
810
|
+
}
|
|
811
|
+
if (typeof expiryMonth === 'undefined') {
|
|
812
|
+
throw new AppwriteException('Missing required parameter: "expiryMonth"');
|
|
813
|
+
}
|
|
814
|
+
if (typeof expiryYear === 'undefined') {
|
|
815
|
+
throw new AppwriteException('Missing required parameter: "expiryYear"');
|
|
816
|
+
}
|
|
817
|
+
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
818
|
+
const payload: Payload = {};
|
|
819
|
+
if (typeof expiryMonth !== 'undefined') {
|
|
820
|
+
payload['expiryMonth'] = expiryMonth;
|
|
821
|
+
}
|
|
822
|
+
if (typeof expiryYear !== 'undefined') {
|
|
823
|
+
payload['expiryYear'] = expiryYear;
|
|
824
|
+
}
|
|
825
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
826
|
+
|
|
827
|
+
const apiHeaders: { [header: string]: string } = {
|
|
828
|
+
'content-type': 'application/json',
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
return await this.client.call(
|
|
833
|
+
'patch',
|
|
834
|
+
uri,
|
|
835
|
+
apiHeaders,
|
|
836
|
+
payload
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Delete payment method
|
|
841
|
+
*
|
|
842
|
+
*
|
|
843
|
+
* @param {string} paymentMethodId
|
|
844
|
+
* @throws {AppwriteException}
|
|
845
|
+
* @returns {Promise<{}>}
|
|
846
|
+
*/
|
|
847
|
+
async deletePaymentMethod(paymentMethodId: string): Promise<{}> {
|
|
848
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
849
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
850
|
+
}
|
|
851
|
+
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
852
|
+
const payload: Payload = {};
|
|
853
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
854
|
+
|
|
855
|
+
const apiHeaders: { [header: string]: string } = {
|
|
856
|
+
'content-type': 'application/json',
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
return await this.client.call(
|
|
861
|
+
'delete',
|
|
862
|
+
uri,
|
|
863
|
+
apiHeaders,
|
|
864
|
+
payload
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Update payment method provider id
|
|
869
|
+
*
|
|
870
|
+
*
|
|
871
|
+
* @param {string} paymentMethodId
|
|
872
|
+
* @param {string} providerMethodId
|
|
873
|
+
* @param {string} name
|
|
874
|
+
* @throws {AppwriteException}
|
|
875
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
876
|
+
*/
|
|
877
|
+
async updatePaymentMethodProvider(paymentMethodId: string, providerMethodId: string, name: string): Promise<Models.PaymentMethod> {
|
|
878
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
879
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
880
|
+
}
|
|
881
|
+
if (typeof providerMethodId === 'undefined') {
|
|
882
|
+
throw new AppwriteException('Missing required parameter: "providerMethodId"');
|
|
883
|
+
}
|
|
884
|
+
if (typeof name === 'undefined') {
|
|
885
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
886
|
+
}
|
|
887
|
+
const apiPath = '/account/payment-methods/{paymentMethodId}/provider'.replace('{paymentMethodId}', paymentMethodId);
|
|
888
|
+
const payload: Payload = {};
|
|
889
|
+
if (typeof providerMethodId !== 'undefined') {
|
|
890
|
+
payload['providerMethodId'] = providerMethodId;
|
|
891
|
+
}
|
|
892
|
+
if (typeof name !== 'undefined') {
|
|
893
|
+
payload['name'] = name;
|
|
894
|
+
}
|
|
895
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
896
|
+
|
|
897
|
+
const apiHeaders: { [header: string]: string } = {
|
|
898
|
+
'content-type': 'application/json',
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
return await this.client.call(
|
|
903
|
+
'patch',
|
|
904
|
+
uri,
|
|
905
|
+
apiHeaders,
|
|
906
|
+
payload
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Update payment method with new setup with mandates for indian cards
|
|
911
|
+
*
|
|
912
|
+
*
|
|
913
|
+
* @param {string} paymentMethodId
|
|
914
|
+
* @throws {AppwriteException}
|
|
915
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
916
|
+
*/
|
|
917
|
+
async updatePaymentMethodMandateOptions(paymentMethodId: string): Promise<Models.PaymentMethod> {
|
|
918
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
919
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
920
|
+
}
|
|
921
|
+
const apiPath = '/account/payment-methods/{paymentMethodId}/setup'.replace('{paymentMethodId}', paymentMethodId);
|
|
922
|
+
const payload: Payload = {};
|
|
923
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
924
|
+
|
|
925
|
+
const apiHeaders: { [header: string]: string } = {
|
|
926
|
+
'content-type': 'application/json',
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
|
|
626
930
|
return await this.client.call(
|
|
627
931
|
'patch',
|
|
628
932
|
uri,
|
|
@@ -1636,4 +1940,36 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1636
1940
|
payload
|
|
1637
1941
|
);
|
|
1638
1942
|
}
|
|
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
|
+
}
|
|
1639
1975
|
}
|