@appconda/nextjs 1.0.12 → 1.0.13

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/dist/esm/sdk.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { FormData, File, fetch } from 'node-fetch-native-with-agent';
2
2
  import { createAgent } from 'node-fetch-native-with-agent/agent';
3
+ import { cookies } from 'next/headers';
4
+ import { createClient } from 'redis';
3
5
 
4
6
  /******************************************************************************
5
7
  Copyright (c) Microsoft Corporation.
@@ -16,6 +18,17 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
18
  PERFORMANCE OF THIS SOFTWARE.
17
19
  ***************************************************************************** */
18
20
 
21
+ function __decorate(decorators, target, key, desc) {
22
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
24
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
26
+ }
27
+
28
+ function __metadata(metadataKey, metadataValue) {
29
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
30
+ }
31
+
19
32
  function __awaiter(thisArg, _arguments, P, generator) {
20
33
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
34
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10585,5 +10598,2625 @@ var MessagingProviderType;
10585
10598
  MessagingProviderType["Push"] = "push";
10586
10599
  })(MessagingProviderType || (MessagingProviderType = {}));
10587
10600
 
10588
- export { Account, AppcondaException, Applets, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, Compression, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, Health, ID, ImageFormat, ImageGravity, IndexType, Locale, Messaging, MessagingProviderType, Name, OAuthProvider, PasswordHash, Permission, Query, RelationMutate, RelationshipType, Role, Runtime, SmtpEncryption, Storage, Teams, Users };
10601
+ function getPortAndHostname(urlString) {
10602
+ try {
10603
+ const url = new URL(urlString);
10604
+ return {
10605
+ hostname: url.hostname,
10606
+ port: url.port || (url.protocol === 'https:' ? '443' : '80'), // Default ports if not specified
10607
+ protocol: url.protocol
10608
+ };
10609
+ }
10610
+ catch (error) {
10611
+ console.error('Invalid URL:', error);
10612
+ return { hostname: '', port: '', protocol: '' };
10613
+ }
10614
+ }
10615
+ function getAppcondaClient() {
10616
+ return __awaiter(this, void 0, void 0, function* () {
10617
+ let url;
10618
+ if (process.env.NEXT_PUBLIC_APPCONDA_CLIENT_ENDPOINT) {
10619
+ url = process.env.NEXT_PUBLIC_APPCONDA_CLIENT_ENDPOINT;
10620
+ }
10621
+ else if (typeof window !== 'undefined') {
10622
+ const hostInfo = getPortAndHostname(window.location.href);
10623
+ if (hostInfo.port) {
10624
+ url = `${hostInfo.protocol}//${hostInfo.hostname}:${hostInfo.port}/v1`;
10625
+ }
10626
+ else {
10627
+ url = `${hostInfo.protocol}//${hostInfo.hostname}/v1`;
10628
+ }
10629
+ }
10630
+ else {
10631
+ url = 'http://appconda/v1';
10632
+ }
10633
+ /* if (ApplicationConfig.Port == null) {
10634
+ url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}:${ApplicationConfig.Port}/v1`
10635
+ } else {
10636
+ url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}/v1`
10637
+ } */
10638
+ const adminClient = new Client()
10639
+ .setEndpoint(url) // Your API Endpoint
10640
+ .setProject('console');
10641
+ return adminClient;
10642
+ });
10643
+ }
10644
+
10645
+ class Community {
10646
+ constructor(client) {
10647
+ this.client = client;
10648
+ }
10649
+ get(tenantId) {
10650
+ return __awaiter(this, void 0, void 0, function* () {
10651
+ if (typeof tenantId === 'undefined') {
10652
+ throw new AppcondaException('Missing required parameter: "tenantId"');
10653
+ }
10654
+ const apiPath = '/tenants/{tenantId}'.replace('{tenantId}', tenantId);
10655
+ const payload = {};
10656
+ const uri = new URL(this.client.config.endpoint + apiPath);
10657
+ const apiHeaders = {
10658
+ 'content-type': 'application/json',
10659
+ };
10660
+ return yield this.client.call('get', uri, apiHeaders, payload);
10661
+ });
10662
+ }
10663
+ /**
10664
+ * Create account
10665
+ *
10666
+ * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appconda.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
10667
+ *
10668
+ * @param {string} tenantId
10669
+ * @param {string} name
10670
+ * @param {string} slug
10671
+ * @throws {AppcondaException}
10672
+ * @returns {Promise<Models.User<Preferences>>}
10673
+ */
10674
+ createSpaceGroup(_a) {
10675
+ return __awaiter(this, arguments, void 0, function* ({ $id, name, description }) {
10676
+ if (typeof $id === 'undefined') {
10677
+ throw new AppcondaException('Missing required parameter: "tenantId"');
10678
+ }
10679
+ if (typeof name === 'undefined') {
10680
+ throw new AppcondaException('Missing required parameter: "name"');
10681
+ }
10682
+ const apiPath = '/community/space-groups';
10683
+ const payload = {};
10684
+ if (typeof $id !== 'undefined') {
10685
+ payload['spaceGroupId'] = $id;
10686
+ }
10687
+ if (typeof name !== 'undefined') {
10688
+ payload['name'] = name;
10689
+ }
10690
+ if (typeof description !== 'undefined') {
10691
+ payload['description'] = description;
10692
+ }
10693
+ const uri = new URL(this.client.config.endpoint + apiPath);
10694
+ const apiHeaders = {
10695
+ 'content-type': 'application/json',
10696
+ };
10697
+ return yield this.client.call('post', uri, apiHeaders, payload);
10698
+ });
10699
+ }
10700
+ listSpaceGroups(queries, search) {
10701
+ return __awaiter(this, void 0, void 0, function* () {
10702
+ const apiPath = '/community/space-groups';
10703
+ const payload = {};
10704
+ if (typeof queries !== 'undefined') {
10705
+ payload['queries'] = queries;
10706
+ }
10707
+ if (typeof search !== 'undefined') {
10708
+ payload['search'] = search;
10709
+ }
10710
+ const uri = new URL(this.client.config.endpoint + apiPath);
10711
+ const apiHeaders = {
10712
+ 'content-type': 'application/json',
10713
+ };
10714
+ return yield this.client.call('get', uri, apiHeaders, payload);
10715
+ });
10716
+ }
10717
+ }
10718
+
10719
+ class ServiceClient {
10720
+ constructor(client) {
10721
+ this.client = client;
10722
+ }
10723
+ actionCall(actionName, payload) {
10724
+ return __awaiter(this, void 0, void 0, function* () {
10725
+ const apiPath = `/service/registry/${this.getServiceName()}/${actionName}`;
10726
+ const uri = new URL(this.client.config.endpoint + apiPath);
10727
+ const apiHeaders = {
10728
+ 'content-type': 'application/json',
10729
+ };
10730
+ return yield this.client.call('post', uri, apiHeaders, payload);
10731
+ });
10732
+ }
10733
+ }
10734
+
10735
+ class Configuration extends ServiceClient {
10736
+ getServiceName() {
10737
+ return 'com.appconda.service.configuration';
10738
+ }
10739
+ getAppConfiguration() {
10740
+ return __awaiter(this, void 0, void 0, function* () {
10741
+ const payload = {};
10742
+ return yield this.actionCall('GetAppConfiguration', payload);
10743
+ });
10744
+ }
10745
+ }
10746
+
10747
+ class Pricing extends ServiceClient {
10748
+ getServiceName() {
10749
+ return 'com.appconda.service.pricing';
10750
+ }
10751
+ getAllSubscriptionProducts(isPublic) {
10752
+ return __awaiter(this, void 0, void 0, function* () {
10753
+ const payload = {};
10754
+ return yield this.actionCall('ListSubscriptionProducts', payload);
10755
+ });
10756
+ }
10757
+ getActiveTenantsSubscriptions(isPublic) {
10758
+ return __awaiter(this, void 0, void 0, function* () {
10759
+ const payload = {};
10760
+ return yield this.actionCall('GetActiveTenantsSubscriptions', payload);
10761
+ });
10762
+ }
10763
+ createPlan(payload) {
10764
+ return __awaiter(this, void 0, void 0, function* () {
10765
+ return yield this.actionCall('CreatePlan', payload);
10766
+ });
10767
+ }
10768
+ createPlans(payload) {
10769
+ return __awaiter(this, void 0, void 0, function* () {
10770
+ return yield this.actionCall('CreatePlans', payload);
10771
+ });
10772
+ }
10773
+ }
10774
+
10775
+ class Projects {
10776
+ constructor(client) {
10777
+ this.client = client;
10778
+ }
10779
+ /**
10780
+ * List projects
10781
+ *
10782
+ *
10783
+ * @param {string[]} queries
10784
+ * @param {string} search
10785
+ * @throws {AppcondaException}
10786
+ * @returns {Promise<Models.ProjectList>}
10787
+ */
10788
+ list(queries, search) {
10789
+ return __awaiter(this, void 0, void 0, function* () {
10790
+ const apiPath = '/projects';
10791
+ const payload = {};
10792
+ if (typeof queries !== 'undefined') {
10793
+ payload['queries'] = queries;
10794
+ }
10795
+ if (typeof search !== 'undefined') {
10796
+ payload['search'] = search;
10797
+ }
10798
+ const uri = new URL(this.client.config.endpoint + apiPath);
10799
+ const apiHeaders = {
10800
+ 'content-type': 'application/json',
10801
+ };
10802
+ return yield this.client.call('get', uri, apiHeaders, payload);
10803
+ });
10804
+ }
10805
+ /**
10806
+ * Create project
10807
+ *
10808
+ *
10809
+ * @param {string} projectId
10810
+ * @param {string} name
10811
+ * @param {string} teamId
10812
+ * @param {Region} region
10813
+ * @param {string} description
10814
+ * @param {string} logo
10815
+ * @param {string} url
10816
+ * @param {string} legalName
10817
+ * @param {string} legalCountry
10818
+ * @param {string} legalState
10819
+ * @param {string} legalCity
10820
+ * @param {string} legalAddress
10821
+ * @param {string} legalTaxId
10822
+ * @throws {AppcondaException}
10823
+ * @returns {Promise<Models.Project>}
10824
+ */
10825
+ create(projectId, name, teamId, region, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) {
10826
+ return __awaiter(this, void 0, void 0, function* () {
10827
+ if (typeof projectId === 'undefined') {
10828
+ throw new AppcondaException('Missing required parameter: "projectId"');
10829
+ }
10830
+ if (typeof name === 'undefined') {
10831
+ throw new AppcondaException('Missing required parameter: "name"');
10832
+ }
10833
+ if (typeof teamId === 'undefined') {
10834
+ throw new AppcondaException('Missing required parameter: "teamId"');
10835
+ }
10836
+ const apiPath = '/projects';
10837
+ const payload = {};
10838
+ if (typeof projectId !== 'undefined') {
10839
+ payload['projectId'] = projectId;
10840
+ }
10841
+ if (typeof name !== 'undefined') {
10842
+ payload['name'] = name;
10843
+ }
10844
+ if (typeof teamId !== 'undefined') {
10845
+ payload['teamId'] = teamId;
10846
+ }
10847
+ if (typeof region !== 'undefined') {
10848
+ payload['region'] = region;
10849
+ }
10850
+ if (typeof description !== 'undefined') {
10851
+ payload['description'] = description;
10852
+ }
10853
+ if (typeof logo !== 'undefined') {
10854
+ payload['logo'] = logo;
10855
+ }
10856
+ if (typeof url !== 'undefined') {
10857
+ payload['url'] = url;
10858
+ }
10859
+ if (typeof legalName !== 'undefined') {
10860
+ payload['legalName'] = legalName;
10861
+ }
10862
+ if (typeof legalCountry !== 'undefined') {
10863
+ payload['legalCountry'] = legalCountry;
10864
+ }
10865
+ if (typeof legalState !== 'undefined') {
10866
+ payload['legalState'] = legalState;
10867
+ }
10868
+ if (typeof legalCity !== 'undefined') {
10869
+ payload['legalCity'] = legalCity;
10870
+ }
10871
+ if (typeof legalAddress !== 'undefined') {
10872
+ payload['legalAddress'] = legalAddress;
10873
+ }
10874
+ if (typeof legalTaxId !== 'undefined') {
10875
+ payload['legalTaxId'] = legalTaxId;
10876
+ }
10877
+ const uri = new URL(this.client.config.endpoint + apiPath);
10878
+ const apiHeaders = {
10879
+ 'content-type': 'application/json',
10880
+ };
10881
+ return yield this.client.call('post', uri, apiHeaders, payload);
10882
+ });
10883
+ }
10884
+ /**
10885
+ * Get project
10886
+ *
10887
+ *
10888
+ * @param {string} projectId
10889
+ * @throws {AppcondaException}
10890
+ * @returns {Promise<Models.Project>}
10891
+ */
10892
+ get(projectId) {
10893
+ return __awaiter(this, void 0, void 0, function* () {
10894
+ if (typeof projectId === 'undefined') {
10895
+ throw new AppcondaException('Missing required parameter: "projectId"');
10896
+ }
10897
+ const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId);
10898
+ const payload = {};
10899
+ const uri = new URL(this.client.config.endpoint + apiPath);
10900
+ const apiHeaders = {
10901
+ 'content-type': 'application/json',
10902
+ };
10903
+ return yield this.client.call('get', uri, apiHeaders, payload);
10904
+ });
10905
+ }
10906
+ /**
10907
+ * Update project
10908
+ *
10909
+ *
10910
+ * @param {string} projectId
10911
+ * @param {string} name
10912
+ * @param {string} description
10913
+ * @param {string} logo
10914
+ * @param {string} url
10915
+ * @param {string} legalName
10916
+ * @param {string} legalCountry
10917
+ * @param {string} legalState
10918
+ * @param {string} legalCity
10919
+ * @param {string} legalAddress
10920
+ * @param {string} legalTaxId
10921
+ * @throws {AppcondaException}
10922
+ * @returns {Promise<Models.Project>}
10923
+ */
10924
+ update(projectId, name, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) {
10925
+ return __awaiter(this, void 0, void 0, function* () {
10926
+ if (typeof projectId === 'undefined') {
10927
+ throw new AppcondaException('Missing required parameter: "projectId"');
10928
+ }
10929
+ if (typeof name === 'undefined') {
10930
+ throw new AppcondaException('Missing required parameter: "name"');
10931
+ }
10932
+ const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId);
10933
+ const payload = {};
10934
+ if (typeof name !== 'undefined') {
10935
+ payload['name'] = name;
10936
+ }
10937
+ if (typeof description !== 'undefined') {
10938
+ payload['description'] = description;
10939
+ }
10940
+ if (typeof logo !== 'undefined') {
10941
+ payload['logo'] = logo;
10942
+ }
10943
+ if (typeof url !== 'undefined') {
10944
+ payload['url'] = url;
10945
+ }
10946
+ if (typeof legalName !== 'undefined') {
10947
+ payload['legalName'] = legalName;
10948
+ }
10949
+ if (typeof legalCountry !== 'undefined') {
10950
+ payload['legalCountry'] = legalCountry;
10951
+ }
10952
+ if (typeof legalState !== 'undefined') {
10953
+ payload['legalState'] = legalState;
10954
+ }
10955
+ if (typeof legalCity !== 'undefined') {
10956
+ payload['legalCity'] = legalCity;
10957
+ }
10958
+ if (typeof legalAddress !== 'undefined') {
10959
+ payload['legalAddress'] = legalAddress;
10960
+ }
10961
+ if (typeof legalTaxId !== 'undefined') {
10962
+ payload['legalTaxId'] = legalTaxId;
10963
+ }
10964
+ const uri = new URL(this.client.config.endpoint + apiPath);
10965
+ const apiHeaders = {
10966
+ 'content-type': 'application/json',
10967
+ };
10968
+ return yield this.client.call('patch', uri, apiHeaders, payload);
10969
+ });
10970
+ }
10971
+ /**
10972
+ * Delete project
10973
+ *
10974
+ *
10975
+ * @param {string} projectId
10976
+ * @throws {AppcondaException}
10977
+ * @returns {Promise<{}>}
10978
+ */
10979
+ delete(projectId) {
10980
+ return __awaiter(this, void 0, void 0, function* () {
10981
+ if (typeof projectId === 'undefined') {
10982
+ throw new AppcondaException('Missing required parameter: "projectId"');
10983
+ }
10984
+ const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId);
10985
+ const payload = {};
10986
+ const uri = new URL(this.client.config.endpoint + apiPath);
10987
+ const apiHeaders = {
10988
+ 'content-type': 'application/json',
10989
+ };
10990
+ return yield this.client.call('delete', uri, apiHeaders, payload);
10991
+ });
10992
+ }
10993
+ /**
10994
+ * Update API status
10995
+ *
10996
+ *
10997
+ * @param {string} projectId
10998
+ * @param {Api} api
10999
+ * @param {boolean} status
11000
+ * @throws {AppcondaException}
11001
+ * @returns {Promise<Models.Project>}
11002
+ */
11003
+ updateApiStatus(projectId, api, status) {
11004
+ return __awaiter(this, void 0, void 0, function* () {
11005
+ if (typeof projectId === 'undefined') {
11006
+ throw new AppcondaException('Missing required parameter: "projectId"');
11007
+ }
11008
+ if (typeof api === 'undefined') {
11009
+ throw new AppcondaException('Missing required parameter: "api"');
11010
+ }
11011
+ if (typeof status === 'undefined') {
11012
+ throw new AppcondaException('Missing required parameter: "status"');
11013
+ }
11014
+ const apiPath = '/projects/{projectId}/api'.replace('{projectId}', projectId);
11015
+ const payload = {};
11016
+ if (typeof api !== 'undefined') {
11017
+ payload['api'] = api;
11018
+ }
11019
+ if (typeof status !== 'undefined') {
11020
+ payload['status'] = status;
11021
+ }
11022
+ const uri = new URL(this.client.config.endpoint + apiPath);
11023
+ const apiHeaders = {
11024
+ 'content-type': 'application/json',
11025
+ };
11026
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11027
+ });
11028
+ }
11029
+ /**
11030
+ * Update all API status
11031
+ *
11032
+ *
11033
+ * @param {string} projectId
11034
+ * @param {boolean} status
11035
+ * @throws {AppcondaException}
11036
+ * @returns {Promise<Models.Project>}
11037
+ */
11038
+ updateApiStatusAll(projectId, status) {
11039
+ return __awaiter(this, void 0, void 0, function* () {
11040
+ if (typeof projectId === 'undefined') {
11041
+ throw new AppcondaException('Missing required parameter: "projectId"');
11042
+ }
11043
+ if (typeof status === 'undefined') {
11044
+ throw new AppcondaException('Missing required parameter: "status"');
11045
+ }
11046
+ const apiPath = '/projects/{projectId}/api/all'.replace('{projectId}', projectId);
11047
+ const payload = {};
11048
+ if (typeof status !== 'undefined') {
11049
+ payload['status'] = status;
11050
+ }
11051
+ const uri = new URL(this.client.config.endpoint + apiPath);
11052
+ const apiHeaders = {
11053
+ 'content-type': 'application/json',
11054
+ };
11055
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11056
+ });
11057
+ }
11058
+ /**
11059
+ * Update project authentication duration
11060
+ *
11061
+ *
11062
+ * @param {string} projectId
11063
+ * @param {number} duration
11064
+ * @throws {AppcondaException}
11065
+ * @returns {Promise<Models.Project>}
11066
+ */
11067
+ updateAuthDuration(projectId, duration) {
11068
+ return __awaiter(this, void 0, void 0, function* () {
11069
+ if (typeof projectId === 'undefined') {
11070
+ throw new AppcondaException('Missing required parameter: "projectId"');
11071
+ }
11072
+ if (typeof duration === 'undefined') {
11073
+ throw new AppcondaException('Missing required parameter: "duration"');
11074
+ }
11075
+ const apiPath = '/projects/{projectId}/auth/duration'.replace('{projectId}', projectId);
11076
+ const payload = {};
11077
+ if (typeof duration !== 'undefined') {
11078
+ payload['duration'] = duration;
11079
+ }
11080
+ const uri = new URL(this.client.config.endpoint + apiPath);
11081
+ const apiHeaders = {
11082
+ 'content-type': 'application/json',
11083
+ };
11084
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11085
+ });
11086
+ }
11087
+ /**
11088
+ * Update project users limit
11089
+ *
11090
+ *
11091
+ * @param {string} projectId
11092
+ * @param {number} limit
11093
+ * @throws {AppcondaException}
11094
+ * @returns {Promise<Models.Project>}
11095
+ */
11096
+ updateAuthLimit(projectId, limit) {
11097
+ return __awaiter(this, void 0, void 0, function* () {
11098
+ if (typeof projectId === 'undefined') {
11099
+ throw new AppcondaException('Missing required parameter: "projectId"');
11100
+ }
11101
+ if (typeof limit === 'undefined') {
11102
+ throw new AppcondaException('Missing required parameter: "limit"');
11103
+ }
11104
+ const apiPath = '/projects/{projectId}/auth/limit'.replace('{projectId}', projectId);
11105
+ const payload = {};
11106
+ if (typeof limit !== 'undefined') {
11107
+ payload['limit'] = limit;
11108
+ }
11109
+ const uri = new URL(this.client.config.endpoint + apiPath);
11110
+ const apiHeaders = {
11111
+ 'content-type': 'application/json',
11112
+ };
11113
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11114
+ });
11115
+ }
11116
+ /**
11117
+ * Update project user sessions limit
11118
+ *
11119
+ *
11120
+ * @param {string} projectId
11121
+ * @param {number} limit
11122
+ * @throws {AppcondaException}
11123
+ * @returns {Promise<Models.Project>}
11124
+ */
11125
+ updateAuthSessionsLimit(projectId, limit) {
11126
+ return __awaiter(this, void 0, void 0, function* () {
11127
+ if (typeof projectId === 'undefined') {
11128
+ throw new AppcondaException('Missing required parameter: "projectId"');
11129
+ }
11130
+ if (typeof limit === 'undefined') {
11131
+ throw new AppcondaException('Missing required parameter: "limit"');
11132
+ }
11133
+ const apiPath = '/projects/{projectId}/auth/max-sessions'.replace('{projectId}', projectId);
11134
+ const payload = {};
11135
+ if (typeof limit !== 'undefined') {
11136
+ payload['limit'] = limit;
11137
+ }
11138
+ const uri = new URL(this.client.config.endpoint + apiPath);
11139
+ const apiHeaders = {
11140
+ 'content-type': 'application/json',
11141
+ };
11142
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11143
+ });
11144
+ }
11145
+ /**
11146
+ * Update the mock numbers for the project
11147
+ *
11148
+ *
11149
+ * @param {string} projectId
11150
+ * @param {object[]} numbers
11151
+ * @throws {AppcondaException}
11152
+ * @returns {Promise<Models.Project>}
11153
+ */
11154
+ updateMockNumbers(projectId, numbers) {
11155
+ return __awaiter(this, void 0, void 0, function* () {
11156
+ if (typeof projectId === 'undefined') {
11157
+ throw new AppcondaException('Missing required parameter: "projectId"');
11158
+ }
11159
+ if (typeof numbers === 'undefined') {
11160
+ throw new AppcondaException('Missing required parameter: "numbers"');
11161
+ }
11162
+ const apiPath = '/projects/{projectId}/auth/mock-numbers'.replace('{projectId}', projectId);
11163
+ const payload = {};
11164
+ if (typeof numbers !== 'undefined') {
11165
+ payload['numbers'] = numbers;
11166
+ }
11167
+ const uri = new URL(this.client.config.endpoint + apiPath);
11168
+ const apiHeaders = {
11169
+ 'content-type': 'application/json',
11170
+ };
11171
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11172
+ });
11173
+ }
11174
+ /**
11175
+ * Update authentication password dictionary status. Use this endpoint to enable or disable the dicitonary check for user password
11176
+ *
11177
+ *
11178
+ * @param {string} projectId
11179
+ * @param {boolean} enabled
11180
+ * @throws {AppcondaException}
11181
+ * @returns {Promise<Models.Project>}
11182
+ */
11183
+ updateAuthPasswordDictionary(projectId, enabled) {
11184
+ return __awaiter(this, void 0, void 0, function* () {
11185
+ if (typeof projectId === 'undefined') {
11186
+ throw new AppcondaException('Missing required parameter: "projectId"');
11187
+ }
11188
+ if (typeof enabled === 'undefined') {
11189
+ throw new AppcondaException('Missing required parameter: "enabled"');
11190
+ }
11191
+ const apiPath = '/projects/{projectId}/auth/password-dictionary'.replace('{projectId}', projectId);
11192
+ const payload = {};
11193
+ if (typeof enabled !== 'undefined') {
11194
+ payload['enabled'] = enabled;
11195
+ }
11196
+ const uri = new URL(this.client.config.endpoint + apiPath);
11197
+ const apiHeaders = {
11198
+ 'content-type': 'application/json',
11199
+ };
11200
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11201
+ });
11202
+ }
11203
+ /**
11204
+ * Update authentication password history. Use this endpoint to set the number of password history to save and 0 to disable password history.
11205
+ *
11206
+ *
11207
+ * @param {string} projectId
11208
+ * @param {number} limit
11209
+ * @throws {AppcondaException}
11210
+ * @returns {Promise<Models.Project>}
11211
+ */
11212
+ updateAuthPasswordHistory(projectId, limit) {
11213
+ return __awaiter(this, void 0, void 0, function* () {
11214
+ if (typeof projectId === 'undefined') {
11215
+ throw new AppcondaException('Missing required parameter: "projectId"');
11216
+ }
11217
+ if (typeof limit === 'undefined') {
11218
+ throw new AppcondaException('Missing required parameter: "limit"');
11219
+ }
11220
+ const apiPath = '/projects/{projectId}/auth/password-history'.replace('{projectId}', projectId);
11221
+ const payload = {};
11222
+ if (typeof limit !== 'undefined') {
11223
+ payload['limit'] = limit;
11224
+ }
11225
+ const uri = new URL(this.client.config.endpoint + apiPath);
11226
+ const apiHeaders = {
11227
+ 'content-type': 'application/json',
11228
+ };
11229
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11230
+ });
11231
+ }
11232
+ /**
11233
+ * Enable or disable checking user passwords for similarity with their personal data.
11234
+ *
11235
+ *
11236
+ * @param {string} projectId
11237
+ * @param {boolean} enabled
11238
+ * @throws {AppcondaException}
11239
+ * @returns {Promise<Models.Project>}
11240
+ */
11241
+ updatePersonalDataCheck(projectId, enabled) {
11242
+ return __awaiter(this, void 0, void 0, function* () {
11243
+ if (typeof projectId === 'undefined') {
11244
+ throw new AppcondaException('Missing required parameter: "projectId"');
11245
+ }
11246
+ if (typeof enabled === 'undefined') {
11247
+ throw new AppcondaException('Missing required parameter: "enabled"');
11248
+ }
11249
+ const apiPath = '/projects/{projectId}/auth/personal-data'.replace('{projectId}', projectId);
11250
+ const payload = {};
11251
+ if (typeof enabled !== 'undefined') {
11252
+ payload['enabled'] = enabled;
11253
+ }
11254
+ const uri = new URL(this.client.config.endpoint + apiPath);
11255
+ const apiHeaders = {
11256
+ 'content-type': 'application/json',
11257
+ };
11258
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11259
+ });
11260
+ }
11261
+ /**
11262
+ * Update project sessions emails
11263
+ *
11264
+ *
11265
+ * @param {string} projectId
11266
+ * @param {boolean} alerts
11267
+ * @throws {AppcondaException}
11268
+ * @returns {Promise<Models.Project>}
11269
+ */
11270
+ updateSessionAlerts(projectId, alerts) {
11271
+ return __awaiter(this, void 0, void 0, function* () {
11272
+ if (typeof projectId === 'undefined') {
11273
+ throw new AppcondaException('Missing required parameter: "projectId"');
11274
+ }
11275
+ if (typeof alerts === 'undefined') {
11276
+ throw new AppcondaException('Missing required parameter: "alerts"');
11277
+ }
11278
+ const apiPath = '/projects/{projectId}/auth/session-alerts'.replace('{projectId}', projectId);
11279
+ const payload = {};
11280
+ if (typeof alerts !== 'undefined') {
11281
+ payload['alerts'] = alerts;
11282
+ }
11283
+ const uri = new URL(this.client.config.endpoint + apiPath);
11284
+ const apiHeaders = {
11285
+ 'content-type': 'application/json',
11286
+ };
11287
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11288
+ });
11289
+ }
11290
+ /**
11291
+ * Update project auth method status. Use this endpoint to enable or disable a given auth method for this project.
11292
+ *
11293
+ *
11294
+ * @param {string} projectId
11295
+ * @param {AuthMethod} method
11296
+ * @param {boolean} status
11297
+ * @throws {AppcondaException}
11298
+ * @returns {Promise<Models.Project>}
11299
+ */
11300
+ updateAuthStatus(projectId, method, status) {
11301
+ return __awaiter(this, void 0, void 0, function* () {
11302
+ if (typeof projectId === 'undefined') {
11303
+ throw new AppcondaException('Missing required parameter: "projectId"');
11304
+ }
11305
+ if (typeof method === 'undefined') {
11306
+ throw new AppcondaException('Missing required parameter: "method"');
11307
+ }
11308
+ if (typeof status === 'undefined') {
11309
+ throw new AppcondaException('Missing required parameter: "status"');
11310
+ }
11311
+ const apiPath = '/projects/{projectId}/auth/{method}'.replace('{projectId}', projectId).replace('{method}', method);
11312
+ const payload = {};
11313
+ if (typeof status !== 'undefined') {
11314
+ payload['status'] = status;
11315
+ }
11316
+ const uri = new URL(this.client.config.endpoint + apiPath);
11317
+ const apiHeaders = {
11318
+ 'content-type': 'application/json',
11319
+ };
11320
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11321
+ });
11322
+ }
11323
+ /**
11324
+ * Create JWT
11325
+ *
11326
+ *
11327
+ * @param {string} projectId
11328
+ * @param {string[]} scopes
11329
+ * @param {number} duration
11330
+ * @throws {AppcondaException}
11331
+ * @returns {Promise<Models.Jwt>}
11332
+ */
11333
+ createJWT(projectId, scopes, duration) {
11334
+ return __awaiter(this, void 0, void 0, function* () {
11335
+ if (typeof projectId === 'undefined') {
11336
+ throw new AppcondaException('Missing required parameter: "projectId"');
11337
+ }
11338
+ if (typeof scopes === 'undefined') {
11339
+ throw new AppcondaException('Missing required parameter: "scopes"');
11340
+ }
11341
+ const apiPath = '/projects/{projectId}/jwts'.replace('{projectId}', projectId);
11342
+ const payload = {};
11343
+ if (typeof scopes !== 'undefined') {
11344
+ payload['scopes'] = scopes;
11345
+ }
11346
+ if (typeof duration !== 'undefined') {
11347
+ payload['duration'] = duration;
11348
+ }
11349
+ const uri = new URL(this.client.config.endpoint + apiPath);
11350
+ const apiHeaders = {
11351
+ 'content-type': 'application/json',
11352
+ };
11353
+ return yield this.client.call('post', uri, apiHeaders, payload);
11354
+ });
11355
+ }
11356
+ /**
11357
+ * List keys
11358
+ *
11359
+ *
11360
+ * @param {string} projectId
11361
+ * @throws {AppcondaException}
11362
+ * @returns {Promise<Models.KeyList>}
11363
+ */
11364
+ listKeys(projectId) {
11365
+ return __awaiter(this, void 0, void 0, function* () {
11366
+ if (typeof projectId === 'undefined') {
11367
+ throw new AppcondaException('Missing required parameter: "projectId"');
11368
+ }
11369
+ const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
11370
+ const payload = {};
11371
+ const uri = new URL(this.client.config.endpoint + apiPath);
11372
+ const apiHeaders = {
11373
+ 'content-type': 'application/json',
11374
+ };
11375
+ return yield this.client.call('get', uri, apiHeaders, payload);
11376
+ });
11377
+ }
11378
+ /**
11379
+ * Create key
11380
+ *
11381
+ *
11382
+ * @param {string} projectId
11383
+ * @param {string} name
11384
+ * @param {string[]} scopes
11385
+ * @param {string} expire
11386
+ * @throws {AppcondaException}
11387
+ * @returns {Promise<Models.Key>}
11388
+ */
11389
+ createKey(projectId, name, scopes, expire) {
11390
+ return __awaiter(this, void 0, void 0, function* () {
11391
+ if (typeof projectId === 'undefined') {
11392
+ throw new AppcondaException('Missing required parameter: "projectId"');
11393
+ }
11394
+ if (typeof name === 'undefined') {
11395
+ throw new AppcondaException('Missing required parameter: "name"');
11396
+ }
11397
+ if (typeof scopes === 'undefined') {
11398
+ throw new AppcondaException('Missing required parameter: "scopes"');
11399
+ }
11400
+ const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
11401
+ const payload = {};
11402
+ if (typeof name !== 'undefined') {
11403
+ payload['name'] = name;
11404
+ }
11405
+ if (typeof scopes !== 'undefined') {
11406
+ payload['scopes'] = scopes;
11407
+ }
11408
+ if (typeof expire !== 'undefined') {
11409
+ payload['expire'] = expire;
11410
+ }
11411
+ const uri = new URL(this.client.config.endpoint + apiPath);
11412
+ const apiHeaders = {
11413
+ 'content-type': 'application/json',
11414
+ };
11415
+ return yield this.client.call('post', uri, apiHeaders, payload);
11416
+ });
11417
+ }
11418
+ /**
11419
+ * Get key
11420
+ *
11421
+ *
11422
+ * @param {string} projectId
11423
+ * @param {string} keyId
11424
+ * @throws {AppcondaException}
11425
+ * @returns {Promise<Models.Key>}
11426
+ */
11427
+ getKey(projectId, keyId) {
11428
+ return __awaiter(this, void 0, void 0, function* () {
11429
+ if (typeof projectId === 'undefined') {
11430
+ throw new AppcondaException('Missing required parameter: "projectId"');
11431
+ }
11432
+ if (typeof keyId === 'undefined') {
11433
+ throw new AppcondaException('Missing required parameter: "keyId"');
11434
+ }
11435
+ const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
11436
+ const payload = {};
11437
+ const uri = new URL(this.client.config.endpoint + apiPath);
11438
+ const apiHeaders = {
11439
+ 'content-type': 'application/json',
11440
+ };
11441
+ return yield this.client.call('get', uri, apiHeaders, payload);
11442
+ });
11443
+ }
11444
+ /**
11445
+ * Update key
11446
+ *
11447
+ *
11448
+ * @param {string} projectId
11449
+ * @param {string} keyId
11450
+ * @param {string} name
11451
+ * @param {string[]} scopes
11452
+ * @param {string} expire
11453
+ * @throws {AppcondaException}
11454
+ * @returns {Promise<Models.Key>}
11455
+ */
11456
+ updateKey(projectId, keyId, name, scopes, expire) {
11457
+ return __awaiter(this, void 0, void 0, function* () {
11458
+ if (typeof projectId === 'undefined') {
11459
+ throw new AppcondaException('Missing required parameter: "projectId"');
11460
+ }
11461
+ if (typeof keyId === 'undefined') {
11462
+ throw new AppcondaException('Missing required parameter: "keyId"');
11463
+ }
11464
+ if (typeof name === 'undefined') {
11465
+ throw new AppcondaException('Missing required parameter: "name"');
11466
+ }
11467
+ if (typeof scopes === 'undefined') {
11468
+ throw new AppcondaException('Missing required parameter: "scopes"');
11469
+ }
11470
+ const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
11471
+ const payload = {};
11472
+ if (typeof name !== 'undefined') {
11473
+ payload['name'] = name;
11474
+ }
11475
+ if (typeof scopes !== 'undefined') {
11476
+ payload['scopes'] = scopes;
11477
+ }
11478
+ if (typeof expire !== 'undefined') {
11479
+ payload['expire'] = expire;
11480
+ }
11481
+ const uri = new URL(this.client.config.endpoint + apiPath);
11482
+ const apiHeaders = {
11483
+ 'content-type': 'application/json',
11484
+ };
11485
+ return yield this.client.call('put', uri, apiHeaders, payload);
11486
+ });
11487
+ }
11488
+ /**
11489
+ * Delete key
11490
+ *
11491
+ *
11492
+ * @param {string} projectId
11493
+ * @param {string} keyId
11494
+ * @throws {AppcondaException}
11495
+ * @returns {Promise<{}>}
11496
+ */
11497
+ deleteKey(projectId, keyId) {
11498
+ return __awaiter(this, void 0, void 0, function* () {
11499
+ if (typeof projectId === 'undefined') {
11500
+ throw new AppcondaException('Missing required parameter: "projectId"');
11501
+ }
11502
+ if (typeof keyId === 'undefined') {
11503
+ throw new AppcondaException('Missing required parameter: "keyId"');
11504
+ }
11505
+ const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
11506
+ const payload = {};
11507
+ const uri = new URL(this.client.config.endpoint + apiPath);
11508
+ const apiHeaders = {
11509
+ 'content-type': 'application/json',
11510
+ };
11511
+ return yield this.client.call('delete', uri, apiHeaders, payload);
11512
+ });
11513
+ }
11514
+ /**
11515
+ * Update project OAuth2
11516
+ *
11517
+ *
11518
+ * @param {string} projectId
11519
+ * @param {OAuthProvider} provider
11520
+ * @param {string} appId
11521
+ * @param {string} secret
11522
+ * @param {boolean} enabled
11523
+ * @throws {AppcondaException}
11524
+ * @returns {Promise<Models.Project>}
11525
+ */
11526
+ updateOAuth2(projectId, provider, appId, secret, enabled) {
11527
+ return __awaiter(this, void 0, void 0, function* () {
11528
+ if (typeof projectId === 'undefined') {
11529
+ throw new AppcondaException('Missing required parameter: "projectId"');
11530
+ }
11531
+ if (typeof provider === 'undefined') {
11532
+ throw new AppcondaException('Missing required parameter: "provider"');
11533
+ }
11534
+ const apiPath = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId);
11535
+ const payload = {};
11536
+ if (typeof provider !== 'undefined') {
11537
+ payload['provider'] = provider;
11538
+ }
11539
+ if (typeof appId !== 'undefined') {
11540
+ payload['appId'] = appId;
11541
+ }
11542
+ if (typeof secret !== 'undefined') {
11543
+ payload['secret'] = secret;
11544
+ }
11545
+ if (typeof enabled !== 'undefined') {
11546
+ payload['enabled'] = enabled;
11547
+ }
11548
+ const uri = new URL(this.client.config.endpoint + apiPath);
11549
+ const apiHeaders = {
11550
+ 'content-type': 'application/json',
11551
+ };
11552
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11553
+ });
11554
+ }
11555
+ /**
11556
+ * List platforms
11557
+ *
11558
+ *
11559
+ * @param {string} projectId
11560
+ * @throws {AppcondaException}
11561
+ * @returns {Promise<Models.PlatformList>}
11562
+ */
11563
+ listPlatforms(projectId) {
11564
+ return __awaiter(this, void 0, void 0, function* () {
11565
+ if (typeof projectId === 'undefined') {
11566
+ throw new AppcondaException('Missing required parameter: "projectId"');
11567
+ }
11568
+ const apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId);
11569
+ const payload = {};
11570
+ const uri = new URL(this.client.config.endpoint + apiPath);
11571
+ const apiHeaders = {
11572
+ 'content-type': 'application/json',
11573
+ };
11574
+ return yield this.client.call('get', uri, apiHeaders, payload);
11575
+ });
11576
+ }
11577
+ /**
11578
+ * Create platform
11579
+ *
11580
+ *
11581
+ * @param {string} projectId
11582
+ * @param {PlatformType} type
11583
+ * @param {string} name
11584
+ * @param {string} key
11585
+ * @param {string} store
11586
+ * @param {string} hostname
11587
+ * @throws {AppcondaException}
11588
+ * @returns {Promise<Models.Platform>}
11589
+ */
11590
+ createPlatform(projectId, type, name, key, store, hostname) {
11591
+ return __awaiter(this, void 0, void 0, function* () {
11592
+ if (typeof projectId === 'undefined') {
11593
+ throw new AppcondaException('Missing required parameter: "projectId"');
11594
+ }
11595
+ if (typeof type === 'undefined') {
11596
+ throw new AppcondaException('Missing required parameter: "type"');
11597
+ }
11598
+ if (typeof name === 'undefined') {
11599
+ throw new AppcondaException('Missing required parameter: "name"');
11600
+ }
11601
+ const apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId);
11602
+ const payload = {};
11603
+ if (typeof type !== 'undefined') {
11604
+ payload['type'] = type;
11605
+ }
11606
+ if (typeof name !== 'undefined') {
11607
+ payload['name'] = name;
11608
+ }
11609
+ if (typeof key !== 'undefined') {
11610
+ payload['key'] = key;
11611
+ }
11612
+ if (typeof store !== 'undefined') {
11613
+ payload['store'] = store;
11614
+ }
11615
+ if (typeof hostname !== 'undefined') {
11616
+ payload['hostname'] = hostname;
11617
+ }
11618
+ const uri = new URL(this.client.config.endpoint + apiPath);
11619
+ const apiHeaders = {
11620
+ 'content-type': 'application/json',
11621
+ };
11622
+ return yield this.client.call('post', uri, apiHeaders, payload);
11623
+ });
11624
+ }
11625
+ /**
11626
+ * Get platform
11627
+ *
11628
+ *
11629
+ * @param {string} projectId
11630
+ * @param {string} platformId
11631
+ * @throws {AppcondaException}
11632
+ * @returns {Promise<Models.Platform>}
11633
+ */
11634
+ getPlatform(projectId, platformId) {
11635
+ return __awaiter(this, void 0, void 0, function* () {
11636
+ if (typeof projectId === 'undefined') {
11637
+ throw new AppcondaException('Missing required parameter: "projectId"');
11638
+ }
11639
+ if (typeof platformId === 'undefined') {
11640
+ throw new AppcondaException('Missing required parameter: "platformId"');
11641
+ }
11642
+ const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
11643
+ const payload = {};
11644
+ const uri = new URL(this.client.config.endpoint + apiPath);
11645
+ const apiHeaders = {
11646
+ 'content-type': 'application/json',
11647
+ };
11648
+ return yield this.client.call('get', uri, apiHeaders, payload);
11649
+ });
11650
+ }
11651
+ /**
11652
+ * Update platform
11653
+ *
11654
+ *
11655
+ * @param {string} projectId
11656
+ * @param {string} platformId
11657
+ * @param {string} name
11658
+ * @param {string} key
11659
+ * @param {string} store
11660
+ * @param {string} hostname
11661
+ * @throws {AppcondaException}
11662
+ * @returns {Promise<Models.Platform>}
11663
+ */
11664
+ updatePlatform(projectId, platformId, name, key, store, hostname) {
11665
+ return __awaiter(this, void 0, void 0, function* () {
11666
+ if (typeof projectId === 'undefined') {
11667
+ throw new AppcondaException('Missing required parameter: "projectId"');
11668
+ }
11669
+ if (typeof platformId === 'undefined') {
11670
+ throw new AppcondaException('Missing required parameter: "platformId"');
11671
+ }
11672
+ if (typeof name === 'undefined') {
11673
+ throw new AppcondaException('Missing required parameter: "name"');
11674
+ }
11675
+ const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
11676
+ const payload = {};
11677
+ if (typeof name !== 'undefined') {
11678
+ payload['name'] = name;
11679
+ }
11680
+ if (typeof key !== 'undefined') {
11681
+ payload['key'] = key;
11682
+ }
11683
+ if (typeof store !== 'undefined') {
11684
+ payload['store'] = store;
11685
+ }
11686
+ if (typeof hostname !== 'undefined') {
11687
+ payload['hostname'] = hostname;
11688
+ }
11689
+ const uri = new URL(this.client.config.endpoint + apiPath);
11690
+ const apiHeaders = {
11691
+ 'content-type': 'application/json',
11692
+ };
11693
+ return yield this.client.call('put', uri, apiHeaders, payload);
11694
+ });
11695
+ }
11696
+ /**
11697
+ * Delete platform
11698
+ *
11699
+ *
11700
+ * @param {string} projectId
11701
+ * @param {string} platformId
11702
+ * @throws {AppcondaException}
11703
+ * @returns {Promise<{}>}
11704
+ */
11705
+ deletePlatform(projectId, platformId) {
11706
+ return __awaiter(this, void 0, void 0, function* () {
11707
+ if (typeof projectId === 'undefined') {
11708
+ throw new AppcondaException('Missing required parameter: "projectId"');
11709
+ }
11710
+ if (typeof platformId === 'undefined') {
11711
+ throw new AppcondaException('Missing required parameter: "platformId"');
11712
+ }
11713
+ const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
11714
+ const payload = {};
11715
+ const uri = new URL(this.client.config.endpoint + apiPath);
11716
+ const apiHeaders = {
11717
+ 'content-type': 'application/json',
11718
+ };
11719
+ return yield this.client.call('delete', uri, apiHeaders, payload);
11720
+ });
11721
+ }
11722
+ /**
11723
+ * Update service status
11724
+ *
11725
+ *
11726
+ * @param {string} projectId
11727
+ * @param {ApiService} service
11728
+ * @param {boolean} status
11729
+ * @throws {AppcondaException}
11730
+ * @returns {Promise<Models.Project>}
11731
+ */
11732
+ updateServiceStatus(projectId, service, status) {
11733
+ return __awaiter(this, void 0, void 0, function* () {
11734
+ if (typeof projectId === 'undefined') {
11735
+ throw new AppcondaException('Missing required parameter: "projectId"');
11736
+ }
11737
+ if (typeof service === 'undefined') {
11738
+ throw new AppcondaException('Missing required parameter: "service"');
11739
+ }
11740
+ if (typeof status === 'undefined') {
11741
+ throw new AppcondaException('Missing required parameter: "status"');
11742
+ }
11743
+ const apiPath = '/projects/{projectId}/service'.replace('{projectId}', projectId);
11744
+ const payload = {};
11745
+ if (typeof service !== 'undefined') {
11746
+ payload['service'] = service;
11747
+ }
11748
+ if (typeof status !== 'undefined') {
11749
+ payload['status'] = status;
11750
+ }
11751
+ const uri = new URL(this.client.config.endpoint + apiPath);
11752
+ const apiHeaders = {
11753
+ 'content-type': 'application/json',
11754
+ };
11755
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11756
+ });
11757
+ }
11758
+ /**
11759
+ * Update all service status
11760
+ *
11761
+ *
11762
+ * @param {string} projectId
11763
+ * @param {boolean} status
11764
+ * @throws {AppcondaException}
11765
+ * @returns {Promise<Models.Project>}
11766
+ */
11767
+ updateServiceStatusAll(projectId, status) {
11768
+ return __awaiter(this, void 0, void 0, function* () {
11769
+ if (typeof projectId === 'undefined') {
11770
+ throw new AppcondaException('Missing required parameter: "projectId"');
11771
+ }
11772
+ if (typeof status === 'undefined') {
11773
+ throw new AppcondaException('Missing required parameter: "status"');
11774
+ }
11775
+ const apiPath = '/projects/{projectId}/service/all'.replace('{projectId}', projectId);
11776
+ const payload = {};
11777
+ if (typeof status !== 'undefined') {
11778
+ payload['status'] = status;
11779
+ }
11780
+ const uri = new URL(this.client.config.endpoint + apiPath);
11781
+ const apiHeaders = {
11782
+ 'content-type': 'application/json',
11783
+ };
11784
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11785
+ });
11786
+ }
11787
+ /**
11788
+ * Update SMTP
11789
+ *
11790
+ *
11791
+ * @param {string} projectId
11792
+ * @param {boolean} enabled
11793
+ * @param {string} senderName
11794
+ * @param {string} senderEmail
11795
+ * @param {string} replyTo
11796
+ * @param {string} host
11797
+ * @param {number} port
11798
+ * @param {string} username
11799
+ * @param {string} password
11800
+ * @param {SMTPSecure} secure
11801
+ * @throws {AppcondaException}
11802
+ * @returns {Promise<Models.Project>}
11803
+ */
11804
+ updateSmtp(projectId, enabled, senderName, senderEmail, replyTo, host, port, username, password, secure) {
11805
+ return __awaiter(this, void 0, void 0, function* () {
11806
+ if (typeof projectId === 'undefined') {
11807
+ throw new AppcondaException('Missing required parameter: "projectId"');
11808
+ }
11809
+ if (typeof enabled === 'undefined') {
11810
+ throw new AppcondaException('Missing required parameter: "enabled"');
11811
+ }
11812
+ const apiPath = '/projects/{projectId}/smtp'.replace('{projectId}', projectId);
11813
+ const payload = {};
11814
+ if (typeof enabled !== 'undefined') {
11815
+ payload['enabled'] = enabled;
11816
+ }
11817
+ if (typeof senderName !== 'undefined') {
11818
+ payload['senderName'] = senderName;
11819
+ }
11820
+ if (typeof senderEmail !== 'undefined') {
11821
+ payload['senderEmail'] = senderEmail;
11822
+ }
11823
+ if (typeof replyTo !== 'undefined') {
11824
+ payload['replyTo'] = replyTo;
11825
+ }
11826
+ if (typeof host !== 'undefined') {
11827
+ payload['host'] = host;
11828
+ }
11829
+ if (typeof port !== 'undefined') {
11830
+ payload['port'] = port;
11831
+ }
11832
+ if (typeof username !== 'undefined') {
11833
+ payload['username'] = username;
11834
+ }
11835
+ if (typeof password !== 'undefined') {
11836
+ payload['password'] = password;
11837
+ }
11838
+ if (typeof secure !== 'undefined') {
11839
+ payload['secure'] = secure;
11840
+ }
11841
+ const uri = new URL(this.client.config.endpoint + apiPath);
11842
+ const apiHeaders = {
11843
+ 'content-type': 'application/json',
11844
+ };
11845
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11846
+ });
11847
+ }
11848
+ /**
11849
+ * Create SMTP test
11850
+ *
11851
+ *
11852
+ * @param {string} projectId
11853
+ * @param {string[]} emails
11854
+ * @param {string} senderName
11855
+ * @param {string} senderEmail
11856
+ * @param {string} host
11857
+ * @param {string} replyTo
11858
+ * @param {number} port
11859
+ * @param {string} username
11860
+ * @param {string} password
11861
+ * @param {SMTPSecure} secure
11862
+ * @throws {AppcondaException}
11863
+ * @returns {Promise<{}>}
11864
+ */
11865
+ createSmtpTest(projectId, emails, senderName, senderEmail, host, replyTo, port, username, password, secure) {
11866
+ return __awaiter(this, void 0, void 0, function* () {
11867
+ if (typeof projectId === 'undefined') {
11868
+ throw new AppcondaException('Missing required parameter: "projectId"');
11869
+ }
11870
+ if (typeof emails === 'undefined') {
11871
+ throw new AppcondaException('Missing required parameter: "emails"');
11872
+ }
11873
+ if (typeof senderName === 'undefined') {
11874
+ throw new AppcondaException('Missing required parameter: "senderName"');
11875
+ }
11876
+ if (typeof senderEmail === 'undefined') {
11877
+ throw new AppcondaException('Missing required parameter: "senderEmail"');
11878
+ }
11879
+ if (typeof host === 'undefined') {
11880
+ throw new AppcondaException('Missing required parameter: "host"');
11881
+ }
11882
+ const apiPath = '/projects/{projectId}/smtp/tests'.replace('{projectId}', projectId);
11883
+ const payload = {};
11884
+ if (typeof emails !== 'undefined') {
11885
+ payload['emails'] = emails;
11886
+ }
11887
+ if (typeof senderName !== 'undefined') {
11888
+ payload['senderName'] = senderName;
11889
+ }
11890
+ if (typeof senderEmail !== 'undefined') {
11891
+ payload['senderEmail'] = senderEmail;
11892
+ }
11893
+ if (typeof replyTo !== 'undefined') {
11894
+ payload['replyTo'] = replyTo;
11895
+ }
11896
+ if (typeof host !== 'undefined') {
11897
+ payload['host'] = host;
11898
+ }
11899
+ if (typeof port !== 'undefined') {
11900
+ payload['port'] = port;
11901
+ }
11902
+ if (typeof username !== 'undefined') {
11903
+ payload['username'] = username;
11904
+ }
11905
+ if (typeof password !== 'undefined') {
11906
+ payload['password'] = password;
11907
+ }
11908
+ if (typeof secure !== 'undefined') {
11909
+ payload['secure'] = secure;
11910
+ }
11911
+ const uri = new URL(this.client.config.endpoint + apiPath);
11912
+ const apiHeaders = {
11913
+ 'content-type': 'application/json',
11914
+ };
11915
+ return yield this.client.call('post', uri, apiHeaders, payload);
11916
+ });
11917
+ }
11918
+ /**
11919
+ * Update project team
11920
+ *
11921
+ *
11922
+ * @param {string} projectId
11923
+ * @param {string} teamId
11924
+ * @throws {AppcondaException}
11925
+ * @returns {Promise<Models.Project>}
11926
+ */
11927
+ updateTeam(projectId, teamId) {
11928
+ return __awaiter(this, void 0, void 0, function* () {
11929
+ if (typeof projectId === 'undefined') {
11930
+ throw new AppcondaException('Missing required parameter: "projectId"');
11931
+ }
11932
+ if (typeof teamId === 'undefined') {
11933
+ throw new AppcondaException('Missing required parameter: "teamId"');
11934
+ }
11935
+ const apiPath = '/projects/{projectId}/team'.replace('{projectId}', projectId);
11936
+ const payload = {};
11937
+ if (typeof teamId !== 'undefined') {
11938
+ payload['teamId'] = teamId;
11939
+ }
11940
+ const uri = new URL(this.client.config.endpoint + apiPath);
11941
+ const apiHeaders = {
11942
+ 'content-type': 'application/json',
11943
+ };
11944
+ return yield this.client.call('patch', uri, apiHeaders, payload);
11945
+ });
11946
+ }
11947
+ /**
11948
+ * Get custom email template
11949
+ *
11950
+ *
11951
+ * @param {string} projectId
11952
+ * @param {EmailTemplateType} type
11953
+ * @param {EmailTemplateLocale} locale
11954
+ * @throws {AppcondaException}
11955
+ * @returns {Promise<Models.EmailTemplate>}
11956
+ */
11957
+ getEmailTemplate(projectId, type, locale) {
11958
+ return __awaiter(this, void 0, void 0, function* () {
11959
+ if (typeof projectId === 'undefined') {
11960
+ throw new AppcondaException('Missing required parameter: "projectId"');
11961
+ }
11962
+ if (typeof type === 'undefined') {
11963
+ throw new AppcondaException('Missing required parameter: "type"');
11964
+ }
11965
+ if (typeof locale === 'undefined') {
11966
+ throw new AppcondaException('Missing required parameter: "locale"');
11967
+ }
11968
+ const apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
11969
+ const payload = {};
11970
+ const uri = new URL(this.client.config.endpoint + apiPath);
11971
+ const apiHeaders = {
11972
+ 'content-type': 'application/json',
11973
+ };
11974
+ return yield this.client.call('get', uri, apiHeaders, payload);
11975
+ });
11976
+ }
11977
+ /**
11978
+ * Update custom email templates
11979
+ *
11980
+ *
11981
+ * @param {string} projectId
11982
+ * @param {EmailTemplateType} type
11983
+ * @param {EmailTemplateLocale} locale
11984
+ * @param {string} subject
11985
+ * @param {string} message
11986
+ * @param {string} senderName
11987
+ * @param {string} senderEmail
11988
+ * @param {string} replyTo
11989
+ * @throws {AppcondaException}
11990
+ * @returns {Promise<Models.Project>}
11991
+ */
11992
+ updateEmailTemplate(projectId, type, locale, subject, message, senderName, senderEmail, replyTo) {
11993
+ return __awaiter(this, void 0, void 0, function* () {
11994
+ if (typeof projectId === 'undefined') {
11995
+ throw new AppcondaException('Missing required parameter: "projectId"');
11996
+ }
11997
+ if (typeof type === 'undefined') {
11998
+ throw new AppcondaException('Missing required parameter: "type"');
11999
+ }
12000
+ if (typeof locale === 'undefined') {
12001
+ throw new AppcondaException('Missing required parameter: "locale"');
12002
+ }
12003
+ if (typeof subject === 'undefined') {
12004
+ throw new AppcondaException('Missing required parameter: "subject"');
12005
+ }
12006
+ if (typeof message === 'undefined') {
12007
+ throw new AppcondaException('Missing required parameter: "message"');
12008
+ }
12009
+ const apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
12010
+ const payload = {};
12011
+ if (typeof subject !== 'undefined') {
12012
+ payload['subject'] = subject;
12013
+ }
12014
+ if (typeof message !== 'undefined') {
12015
+ payload['message'] = message;
12016
+ }
12017
+ if (typeof senderName !== 'undefined') {
12018
+ payload['senderName'] = senderName;
12019
+ }
12020
+ if (typeof senderEmail !== 'undefined') {
12021
+ payload['senderEmail'] = senderEmail;
12022
+ }
12023
+ if (typeof replyTo !== 'undefined') {
12024
+ payload['replyTo'] = replyTo;
12025
+ }
12026
+ const uri = new URL(this.client.config.endpoint + apiPath);
12027
+ const apiHeaders = {
12028
+ 'content-type': 'application/json',
12029
+ };
12030
+ return yield this.client.call('patch', uri, apiHeaders, payload);
12031
+ });
12032
+ }
12033
+ /**
12034
+ * Reset custom email template
12035
+ *
12036
+ *
12037
+ * @param {string} projectId
12038
+ * @param {EmailTemplateType} type
12039
+ * @param {EmailTemplateLocale} locale
12040
+ * @throws {AppcondaException}
12041
+ * @returns {Promise<Models.EmailTemplate>}
12042
+ */
12043
+ deleteEmailTemplate(projectId, type, locale) {
12044
+ return __awaiter(this, void 0, void 0, function* () {
12045
+ if (typeof projectId === 'undefined') {
12046
+ throw new AppcondaException('Missing required parameter: "projectId"');
12047
+ }
12048
+ if (typeof type === 'undefined') {
12049
+ throw new AppcondaException('Missing required parameter: "type"');
12050
+ }
12051
+ if (typeof locale === 'undefined') {
12052
+ throw new AppcondaException('Missing required parameter: "locale"');
12053
+ }
12054
+ const apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
12055
+ const payload = {};
12056
+ const uri = new URL(this.client.config.endpoint + apiPath);
12057
+ const apiHeaders = {
12058
+ 'content-type': 'application/json',
12059
+ };
12060
+ return yield this.client.call('delete', uri, apiHeaders, payload);
12061
+ });
12062
+ }
12063
+ /**
12064
+ * Get custom SMS template
12065
+ *
12066
+ *
12067
+ * @param {string} projectId
12068
+ * @param {SmsTemplateType} type
12069
+ * @param {SmsTemplateLocale} locale
12070
+ * @throws {AppcondaException}
12071
+ * @returns {Promise<Models.SmsTemplate>}
12072
+ */
12073
+ getSmsTemplate(projectId, type, locale) {
12074
+ return __awaiter(this, void 0, void 0, function* () {
12075
+ if (typeof projectId === 'undefined') {
12076
+ throw new AppcondaException('Missing required parameter: "projectId"');
12077
+ }
12078
+ if (typeof type === 'undefined') {
12079
+ throw new AppcondaException('Missing required parameter: "type"');
12080
+ }
12081
+ if (typeof locale === 'undefined') {
12082
+ throw new AppcondaException('Missing required parameter: "locale"');
12083
+ }
12084
+ const apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
12085
+ const payload = {};
12086
+ const uri = new URL(this.client.config.endpoint + apiPath);
12087
+ const apiHeaders = {
12088
+ 'content-type': 'application/json',
12089
+ };
12090
+ return yield this.client.call('get', uri, apiHeaders, payload);
12091
+ });
12092
+ }
12093
+ /**
12094
+ * Update custom SMS template
12095
+ *
12096
+ *
12097
+ * @param {string} projectId
12098
+ * @param {SmsTemplateType} type
12099
+ * @param {SmsTemplateLocale} locale
12100
+ * @param {string} message
12101
+ * @throws {AppcondaException}
12102
+ * @returns {Promise<Models.SmsTemplate>}
12103
+ */
12104
+ updateSmsTemplate(projectId, type, locale, message) {
12105
+ return __awaiter(this, void 0, void 0, function* () {
12106
+ if (typeof projectId === 'undefined') {
12107
+ throw new AppcondaException('Missing required parameter: "projectId"');
12108
+ }
12109
+ if (typeof type === 'undefined') {
12110
+ throw new AppcondaException('Missing required parameter: "type"');
12111
+ }
12112
+ if (typeof locale === 'undefined') {
12113
+ throw new AppcondaException('Missing required parameter: "locale"');
12114
+ }
12115
+ if (typeof message === 'undefined') {
12116
+ throw new AppcondaException('Missing required parameter: "message"');
12117
+ }
12118
+ const apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
12119
+ const payload = {};
12120
+ if (typeof message !== 'undefined') {
12121
+ payload['message'] = message;
12122
+ }
12123
+ const uri = new URL(this.client.config.endpoint + apiPath);
12124
+ const apiHeaders = {
12125
+ 'content-type': 'application/json',
12126
+ };
12127
+ return yield this.client.call('patch', uri, apiHeaders, payload);
12128
+ });
12129
+ }
12130
+ /**
12131
+ * Reset custom SMS template
12132
+ *
12133
+ *
12134
+ * @param {string} projectId
12135
+ * @param {SmsTemplateType} type
12136
+ * @param {SmsTemplateLocale} locale
12137
+ * @throws {AppcondaException}
12138
+ * @returns {Promise<Models.SmsTemplate>}
12139
+ */
12140
+ deleteSmsTemplate(projectId, type, locale) {
12141
+ return __awaiter(this, void 0, void 0, function* () {
12142
+ if (typeof projectId === 'undefined') {
12143
+ throw new AppcondaException('Missing required parameter: "projectId"');
12144
+ }
12145
+ if (typeof type === 'undefined') {
12146
+ throw new AppcondaException('Missing required parameter: "type"');
12147
+ }
12148
+ if (typeof locale === 'undefined') {
12149
+ throw new AppcondaException('Missing required parameter: "locale"');
12150
+ }
12151
+ const apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
12152
+ const payload = {};
12153
+ const uri = new URL(this.client.config.endpoint + apiPath);
12154
+ const apiHeaders = {
12155
+ 'content-type': 'application/json',
12156
+ };
12157
+ return yield this.client.call('delete', uri, apiHeaders, payload);
12158
+ });
12159
+ }
12160
+ /**
12161
+ * List webhooks
12162
+ *
12163
+ *
12164
+ * @param {string} projectId
12165
+ * @throws {AppcondaException}
12166
+ * @returns {Promise<Models.WebhookList>}
12167
+ */
12168
+ listWebhooks(projectId) {
12169
+ return __awaiter(this, void 0, void 0, function* () {
12170
+ if (typeof projectId === 'undefined') {
12171
+ throw new AppcondaException('Missing required parameter: "projectId"');
12172
+ }
12173
+ const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId);
12174
+ const payload = {};
12175
+ const uri = new URL(this.client.config.endpoint + apiPath);
12176
+ const apiHeaders = {
12177
+ 'content-type': 'application/json',
12178
+ };
12179
+ return yield this.client.call('get', uri, apiHeaders, payload);
12180
+ });
12181
+ }
12182
+ /**
12183
+ * Create webhook
12184
+ *
12185
+ *
12186
+ * @param {string} projectId
12187
+ * @param {string} name
12188
+ * @param {string[]} events
12189
+ * @param {string} url
12190
+ * @param {boolean} security
12191
+ * @param {boolean} enabled
12192
+ * @param {string} httpUser
12193
+ * @param {string} httpPass
12194
+ * @throws {AppcondaException}
12195
+ * @returns {Promise<Models.Webhook>}
12196
+ */
12197
+ createWebhook(projectId, name, events, url, security, enabled, httpUser, httpPass) {
12198
+ return __awaiter(this, void 0, void 0, function* () {
12199
+ if (typeof projectId === 'undefined') {
12200
+ throw new AppcondaException('Missing required parameter: "projectId"');
12201
+ }
12202
+ if (typeof name === 'undefined') {
12203
+ throw new AppcondaException('Missing required parameter: "name"');
12204
+ }
12205
+ if (typeof events === 'undefined') {
12206
+ throw new AppcondaException('Missing required parameter: "events"');
12207
+ }
12208
+ if (typeof url === 'undefined') {
12209
+ throw new AppcondaException('Missing required parameter: "url"');
12210
+ }
12211
+ if (typeof security === 'undefined') {
12212
+ throw new AppcondaException('Missing required parameter: "security"');
12213
+ }
12214
+ const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId);
12215
+ const payload = {};
12216
+ if (typeof name !== 'undefined') {
12217
+ payload['name'] = name;
12218
+ }
12219
+ if (typeof enabled !== 'undefined') {
12220
+ payload['enabled'] = enabled;
12221
+ }
12222
+ if (typeof events !== 'undefined') {
12223
+ payload['events'] = events;
12224
+ }
12225
+ if (typeof url !== 'undefined') {
12226
+ payload['url'] = url;
12227
+ }
12228
+ if (typeof security !== 'undefined') {
12229
+ payload['security'] = security;
12230
+ }
12231
+ if (typeof httpUser !== 'undefined') {
12232
+ payload['httpUser'] = httpUser;
12233
+ }
12234
+ if (typeof httpPass !== 'undefined') {
12235
+ payload['httpPass'] = httpPass;
12236
+ }
12237
+ const uri = new URL(this.client.config.endpoint + apiPath);
12238
+ const apiHeaders = {
12239
+ 'content-type': 'application/json',
12240
+ };
12241
+ return yield this.client.call('post', uri, apiHeaders, payload);
12242
+ });
12243
+ }
12244
+ /**
12245
+ * Get webhook
12246
+ *
12247
+ *
12248
+ * @param {string} projectId
12249
+ * @param {string} webhookId
12250
+ * @throws {AppcondaException}
12251
+ * @returns {Promise<Models.Webhook>}
12252
+ */
12253
+ getWebhook(projectId, webhookId) {
12254
+ return __awaiter(this, void 0, void 0, function* () {
12255
+ if (typeof projectId === 'undefined') {
12256
+ throw new AppcondaException('Missing required parameter: "projectId"');
12257
+ }
12258
+ if (typeof webhookId === 'undefined') {
12259
+ throw new AppcondaException('Missing required parameter: "webhookId"');
12260
+ }
12261
+ const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
12262
+ const payload = {};
12263
+ const uri = new URL(this.client.config.endpoint + apiPath);
12264
+ const apiHeaders = {
12265
+ 'content-type': 'application/json',
12266
+ };
12267
+ return yield this.client.call('get', uri, apiHeaders, payload);
12268
+ });
12269
+ }
12270
+ /**
12271
+ * Update webhook
12272
+ *
12273
+ *
12274
+ * @param {string} projectId
12275
+ * @param {string} webhookId
12276
+ * @param {string} name
12277
+ * @param {string[]} events
12278
+ * @param {string} url
12279
+ * @param {boolean} security
12280
+ * @param {boolean} enabled
12281
+ * @param {string} httpUser
12282
+ * @param {string} httpPass
12283
+ * @throws {AppcondaException}
12284
+ * @returns {Promise<Models.Webhook>}
12285
+ */
12286
+ updateWebhook(projectId, webhookId, name, events, url, security, enabled, httpUser, httpPass) {
12287
+ return __awaiter(this, void 0, void 0, function* () {
12288
+ if (typeof projectId === 'undefined') {
12289
+ throw new AppcondaException('Missing required parameter: "projectId"');
12290
+ }
12291
+ if (typeof webhookId === 'undefined') {
12292
+ throw new AppcondaException('Missing required parameter: "webhookId"');
12293
+ }
12294
+ if (typeof name === 'undefined') {
12295
+ throw new AppcondaException('Missing required parameter: "name"');
12296
+ }
12297
+ if (typeof events === 'undefined') {
12298
+ throw new AppcondaException('Missing required parameter: "events"');
12299
+ }
12300
+ if (typeof url === 'undefined') {
12301
+ throw new AppcondaException('Missing required parameter: "url"');
12302
+ }
12303
+ if (typeof security === 'undefined') {
12304
+ throw new AppcondaException('Missing required parameter: "security"');
12305
+ }
12306
+ const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
12307
+ const payload = {};
12308
+ if (typeof name !== 'undefined') {
12309
+ payload['name'] = name;
12310
+ }
12311
+ if (typeof enabled !== 'undefined') {
12312
+ payload['enabled'] = enabled;
12313
+ }
12314
+ if (typeof events !== 'undefined') {
12315
+ payload['events'] = events;
12316
+ }
12317
+ if (typeof url !== 'undefined') {
12318
+ payload['url'] = url;
12319
+ }
12320
+ if (typeof security !== 'undefined') {
12321
+ payload['security'] = security;
12322
+ }
12323
+ if (typeof httpUser !== 'undefined') {
12324
+ payload['httpUser'] = httpUser;
12325
+ }
12326
+ if (typeof httpPass !== 'undefined') {
12327
+ payload['httpPass'] = httpPass;
12328
+ }
12329
+ const uri = new URL(this.client.config.endpoint + apiPath);
12330
+ const apiHeaders = {
12331
+ 'content-type': 'application/json',
12332
+ };
12333
+ return yield this.client.call('put', uri, apiHeaders, payload);
12334
+ });
12335
+ }
12336
+ /**
12337
+ * Delete webhook
12338
+ *
12339
+ *
12340
+ * @param {string} projectId
12341
+ * @param {string} webhookId
12342
+ * @throws {AppcondaException}
12343
+ * @returns {Promise<{}>}
12344
+ */
12345
+ deleteWebhook(projectId, webhookId) {
12346
+ return __awaiter(this, void 0, void 0, function* () {
12347
+ if (typeof projectId === 'undefined') {
12348
+ throw new AppcondaException('Missing required parameter: "projectId"');
12349
+ }
12350
+ if (typeof webhookId === 'undefined') {
12351
+ throw new AppcondaException('Missing required parameter: "webhookId"');
12352
+ }
12353
+ const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
12354
+ const payload = {};
12355
+ const uri = new URL(this.client.config.endpoint + apiPath);
12356
+ const apiHeaders = {
12357
+ 'content-type': 'application/json',
12358
+ };
12359
+ return yield this.client.call('delete', uri, apiHeaders, payload);
12360
+ });
12361
+ }
12362
+ /**
12363
+ * Update webhook signature key
12364
+ *
12365
+ *
12366
+ * @param {string} projectId
12367
+ * @param {string} webhookId
12368
+ * @throws {AppcondaException}
12369
+ * @returns {Promise<Models.Webhook>}
12370
+ */
12371
+ updateWebhookSignature(projectId, webhookId) {
12372
+ return __awaiter(this, void 0, void 0, function* () {
12373
+ if (typeof projectId === 'undefined') {
12374
+ throw new AppcondaException('Missing required parameter: "projectId"');
12375
+ }
12376
+ if (typeof webhookId === 'undefined') {
12377
+ throw new AppcondaException('Missing required parameter: "webhookId"');
12378
+ }
12379
+ const apiPath = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
12380
+ const payload = {};
12381
+ const uri = new URL(this.client.config.endpoint + apiPath);
12382
+ const apiHeaders = {
12383
+ 'content-type': 'application/json',
12384
+ };
12385
+ return yield this.client.call('patch', uri, apiHeaders, payload);
12386
+ });
12387
+ }
12388
+ }
12389
+
12390
+ class Roles {
12391
+ constructor(client) {
12392
+ this.client = client;
12393
+ }
12394
+ get(roleId) {
12395
+ return __awaiter(this, void 0, void 0, function* () {
12396
+ if (typeof roleId === 'undefined') {
12397
+ throw new AppcondaException('Missing required parameter: "tenantId"');
12398
+ }
12399
+ const apiPath = '/roles/{roleId}'.replace('{roleId}', roleId);
12400
+ const payload = {};
12401
+ const uri = new URL(this.client.config.endpoint + apiPath);
12402
+ const apiHeaders = {
12403
+ 'content-type': 'application/json',
12404
+ };
12405
+ return yield this.client.call('get', uri, apiHeaders, payload);
12406
+ });
12407
+ }
12408
+ /**
12409
+ * Create account
12410
+ *
12411
+ * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appconda.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
12412
+ *
12413
+ * @param {string} tenantId
12414
+ * @param {string} name
12415
+ * @param {string} slug
12416
+ * @throws {AppcondaException}
12417
+ * @returns {Promise<Models.User<Preferences>>}
12418
+ */
12419
+ create(_a) {
12420
+ return __awaiter(this, arguments, void 0, function* ({ $id, name, description }) {
12421
+ if (typeof $id === 'undefined') {
12422
+ throw new AppcondaException('Missing required parameter: "roleId"');
12423
+ }
12424
+ if (typeof name === 'undefined') {
12425
+ throw new AppcondaException('Missing required parameter: "name"');
12426
+ }
12427
+ if (typeof description === 'undefined') {
12428
+ throw new AppcondaException('Missing required parameter: "description"');
12429
+ }
12430
+ const apiPath = '/roles';
12431
+ const payload = {};
12432
+ if (typeof $id !== 'undefined') {
12433
+ payload['roleId'] = $id;
12434
+ }
12435
+ if (typeof name !== 'undefined') {
12436
+ payload['name'] = name;
12437
+ }
12438
+ if (typeof description !== 'undefined') {
12439
+ payload['description'] = description;
12440
+ }
12441
+ const uri = new URL(this.client.config.endpoint + apiPath);
12442
+ const apiHeaders = {
12443
+ 'content-type': 'application/json',
12444
+ };
12445
+ return yield this.client.call('post', uri, apiHeaders, payload);
12446
+ });
12447
+ }
12448
+ list(queries, search) {
12449
+ return __awaiter(this, void 0, void 0, function* () {
12450
+ const apiPath = '/roles';
12451
+ const payload = {};
12452
+ if (typeof queries !== 'undefined') {
12453
+ payload['queries'] = queries;
12454
+ }
12455
+ if (typeof search !== 'undefined') {
12456
+ payload['search'] = search;
12457
+ }
12458
+ const uri = new URL(this.client.config.endpoint + apiPath);
12459
+ const apiHeaders = {
12460
+ 'content-type': 'application/json',
12461
+ };
12462
+ return yield this.client.call('get', uri, apiHeaders, payload);
12463
+ });
12464
+ }
12465
+ }
12466
+
12467
+ class Schemas {
12468
+ constructor(client) {
12469
+ this.client = client;
12470
+ }
12471
+ /**
12472
+ * Create account
12473
+ *
12474
+ * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appconda.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
12475
+ *
12476
+ * @param {string} tenantId
12477
+ * @param {string} name
12478
+ * @param {string} slug
12479
+ * @throws {AppcondaException}
12480
+ * @returns {Promise<Models.User<Preferences>>}
12481
+ */
12482
+ import(projectId, databaseId, databaseName, schema) {
12483
+ return __awaiter(this, void 0, void 0, function* () {
12484
+ if (typeof projectId === 'undefined') {
12485
+ throw new AppcondaException('Missing required parameter: "projectId"');
12486
+ }
12487
+ if (typeof databaseId === 'undefined') {
12488
+ throw new AppcondaException('Missing required parameter: "databaseId"');
12489
+ }
12490
+ if (typeof schema === 'undefined') {
12491
+ throw new AppcondaException('Missing required parameter: "schema"');
12492
+ }
12493
+ const apiPath = `/schema/${projectId}/${databaseId}`;
12494
+ const payload = {};
12495
+ if (typeof projectId !== 'undefined') {
12496
+ payload['projectId'] = projectId;
12497
+ }
12498
+ if (typeof databaseId !== 'undefined') {
12499
+ payload['databaseId'] = databaseId;
12500
+ }
12501
+ if (typeof databaseName !== 'undefined') {
12502
+ payload['databaseName'] = databaseName;
12503
+ }
12504
+ if (typeof schema !== 'undefined') {
12505
+ payload['schema'] = schema;
12506
+ }
12507
+ const uri = new URL(this.client.config.endpoint + apiPath);
12508
+ const apiHeaders = {
12509
+ 'content-type': 'application/json',
12510
+ };
12511
+ return yield this.client.call('post', uri, apiHeaders, payload);
12512
+ });
12513
+ }
12514
+ }
12515
+
12516
+ class Registry {
12517
+ constructor() {
12518
+ /**
12519
+ * List of all callbacks
12520
+ */
12521
+ this.callbacks = {};
12522
+ /**
12523
+ * List of all fresh resources
12524
+ */
12525
+ this.fresh = {};
12526
+ /**
12527
+ * List of all connections
12528
+ */
12529
+ this.registry = {
12530
+ 'default': {},
12531
+ };
12532
+ /**
12533
+ * Current context
12534
+ */
12535
+ this._context = 'default';
12536
+ }
12537
+ /**
12538
+ * Set a new connection callback
12539
+ */
12540
+ set(name, callback, fresh = false) {
12541
+ if (this.registry[this._context].hasOwnProperty(name)) {
12542
+ delete this.registry[this._context][name];
12543
+ }
12544
+ this.fresh[name] = fresh;
12545
+ this.callbacks[name] = callback;
12546
+ return this;
12547
+ }
12548
+ /**
12549
+ * If connection has been created returns it, otherwise create and then return it
12550
+ */
12551
+ get(name, fresh = false) {
12552
+ if (!this.registry[this._context].hasOwnProperty(name) || fresh || this.fresh[name]) {
12553
+ if (!this.callbacks.hasOwnProperty(name)) {
12554
+ throw new Error(`No callback named "${name}" found when trying to create connection`);
12555
+ }
12556
+ this.registry[this._context][name] = this.callbacks[name]();
12557
+ }
12558
+ return this.registry[this._context][name];
12559
+ }
12560
+ /**
12561
+ * Set the current context
12562
+ */
12563
+ context(name) {
12564
+ if (!this.registry.hasOwnProperty(name)) {
12565
+ this.registry[name] = {};
12566
+ }
12567
+ this._context = name;
12568
+ return this;
12569
+ }
12570
+ }
12571
+
12572
+ class Redis {
12573
+ constructor(redis) {
12574
+ this.redis = redis;
12575
+ }
12576
+ load(key_1, ttl_1) {
12577
+ return __awaiter(this, arguments, void 0, function* (key, ttl, hash = '') {
12578
+ if (!hash) {
12579
+ hash = key;
12580
+ }
12581
+ return new Promise((resolve) => {
12582
+ try {
12583
+ this.redis.get(key).then((redisString) => {
12584
+ if (!redisString) {
12585
+ resolve(null);
12586
+ }
12587
+ const cache = JSON.parse(redisString);
12588
+ if (cache != null && cache.time + ttl > Date.now() / 1000) {
12589
+ resolve(cache.data);
12590
+ }
12591
+ else {
12592
+ resolve(null);
12593
+ }
12594
+ })
12595
+ .catch((e) => {
12596
+ console.error('redis error');
12597
+ });
12598
+ }
12599
+ catch (e) {
12600
+ console.error('redis error');
12601
+ }
12602
+ });
12603
+ });
12604
+ }
12605
+ save(key_1, data_1) {
12606
+ return __awaiter(this, arguments, void 0, function* (key, data, hash = '') {
12607
+ if (!key || !data) {
12608
+ return Promise.resolve(false);
12609
+ }
12610
+ if (!hash) {
12611
+ hash = key;
12612
+ }
12613
+ const value = JSON.stringify({
12614
+ time: Date.now() / 1000,
12615
+ data: data,
12616
+ });
12617
+ return this.redis.set(key, value).then(() => data).catch(() => false);
12618
+ });
12619
+ }
12620
+ list(key) {
12621
+ return this.redis.hKeys(key).then((keys) => keys || []);
12622
+ }
12623
+ purge(key_1) {
12624
+ return __awaiter(this, arguments, void 0, function* (key, hash = '') {
12625
+ if (hash) {
12626
+ return this.redis.del(key).then((result) => !!result);
12627
+ }
12628
+ const result = yield this.redis.del(key);
12629
+ return !!result;
12630
+ });
12631
+ }
12632
+ flush() {
12633
+ //@ts-ignore
12634
+ return this.redis.flushall().then(() => true);
12635
+ }
12636
+ ping() {
12637
+ return this.redis.ping().then(() => true).catch(() => false);
12638
+ }
12639
+ getSize() {
12640
+ //@ts-ignore
12641
+ return this.redis.dbsize();
12642
+ }
12643
+ delWithStart(pattern) {
12644
+ return __awaiter(this, void 0, void 0, function* () {
12645
+ let cur = 0;
12646
+ let totalDeleted = 0;
12647
+ do {
12648
+ const { cursor, keys } = yield this.redis.scan(cur, {
12649
+ MATCH: `${pattern}:*`,
12650
+ COUNT: 100, // Her taramada maksimum 100 anahtar döndür
12651
+ });
12652
+ cur = Number(cursor);
12653
+ yield Promise.all(keys.map((key) => this.redis.del(key)));
12654
+ } while (cur !== 0);
12655
+ return totalDeleted;
12656
+ });
12657
+ }
12658
+ }
12659
+
12660
+ class Cache$1 {
12661
+ constructor(adapter) {
12662
+ this.adapter = adapter;
12663
+ }
12664
+ constructKey(key) {
12665
+ if (Array.isArray(key)) {
12666
+ key = key.join(':');
12667
+ }
12668
+ return key;
12669
+ }
12670
+ static setCaseSensitivity(value) {
12671
+ return this.caseSensitive = value;
12672
+ }
12673
+ load(key_1) {
12674
+ return __awaiter(this, arguments, void 0, function* (key, ttl = 60 * 60 * 24, hash = '') {
12675
+ key = this.constructKey(key);
12676
+ key = Cache$1.caseSensitive ? key : key.toLowerCase();
12677
+ hash = Cache$1.caseSensitive ? hash : hash.toLowerCase();
12678
+ return yield this.adapter.load(key, ttl, hash);
12679
+ });
12680
+ }
12681
+ save(key_1, data_1) {
12682
+ return __awaiter(this, arguments, void 0, function* (key, data, hash = '') {
12683
+ key = this.constructKey(key);
12684
+ key = Cache$1.caseSensitive ? key : key.toLowerCase();
12685
+ hash = Cache$1.caseSensitive ? hash : hash.toLowerCase();
12686
+ return this.adapter.save(key, data, hash);
12687
+ });
12688
+ }
12689
+ list(key) {
12690
+ return __awaiter(this, void 0, void 0, function* () {
12691
+ key = this.constructKey(key);
12692
+ key = Cache$1.caseSensitive ? key : key.toLowerCase();
12693
+ return this.adapter.list(key);
12694
+ });
12695
+ }
12696
+ purge(key_1) {
12697
+ return __awaiter(this, arguments, void 0, function* (key, hash = '') {
12698
+ key = this.constructKey(key);
12699
+ key = Cache$1.caseSensitive ? key : key.toLowerCase();
12700
+ hash = Cache$1.caseSensitive ? hash : hash.toLowerCase();
12701
+ return this.adapter.purge(key, hash);
12702
+ });
12703
+ }
12704
+ flush() {
12705
+ return __awaiter(this, void 0, void 0, function* () {
12706
+ return this.adapter.flush();
12707
+ });
12708
+ }
12709
+ ping() {
12710
+ return __awaiter(this, void 0, void 0, function* () {
12711
+ return this.adapter.ping();
12712
+ });
12713
+ }
12714
+ getSize() {
12715
+ return __awaiter(this, void 0, void 0, function* () {
12716
+ return this.adapter.getSize();
12717
+ });
12718
+ }
12719
+ delWithStart(keys) {
12720
+ return __awaiter(this, void 0, void 0, function* () {
12721
+ const pattern = this.constructKey(keys);
12722
+ return this.adapter.delWithStart(pattern);
12723
+ });
12724
+ }
12725
+ }
12726
+ Cache$1.caseSensitive = false;
12727
+
12728
+ const registry = new Registry();
12729
+ registry.set('cache', () => {
12730
+ var _a, _b;
12731
+ const client = createClient({
12732
+ socket: {
12733
+ host: (_a = process.env._APP_REDIS_HOST) !== null && _a !== void 0 ? _a : 'localhost',
12734
+ port: Number.parseInt((_b = process.env._APP_REDIS_PORT) !== null && _b !== void 0 ? _b : '6379'),
12735
+ },
12736
+ password: undefined,
12737
+ });
12738
+ // Bağlantı hatalarını ele al
12739
+ client.on('error', (err) => {
12740
+ console.error('Redis Client Error', err);
12741
+ });
12742
+ // Connect to Redis
12743
+ client.connect();
12744
+ const redisAdapter = new Redis(client);
12745
+ const cacheProvider = new Cache$1(redisAdapter);
12746
+ return cacheProvider;
12747
+ });
12748
+ class Services {
12749
+ static get Cache() {
12750
+ return registry.get('cache');
12751
+ }
12752
+ }
12753
+
12754
+ // console.log(generateCacheKey("user", 123, true, { role: "admin", permissions: ["read", "write"] }));
12755
+ // console.log(generateCacheKey("user", 123, true, { permissions: ["read", "write"], role: "admin" }));
12756
+ function Cache( /* cacheKey?: string | string[] */) {
12757
+ return function (target, propertyKey, descriptor) {
12758
+ const originalMethod = descriptor.value;
12759
+ descriptor.value = function (...args) {
12760
+ return __awaiter(this, void 0, void 0, function* () {
12761
+ const className = target.constructor.name.toLowerCase();
12762
+ // Metod adı
12763
+ propertyKey.toLowerCase();
12764
+ const cacheKeys = [target.__cacheKeys || []].reverse();
12765
+ console.log("Defined cache keys:", cacheKeys);
12766
+ const cacheKey = ['admin', className, propertyKey];
12767
+ if (cacheKeys.length > 0) {
12768
+ for (let i = 0; i < cacheKeys.length; i++) {
12769
+ const keyIndex = cacheKeys[i]['parameterIndex'];
12770
+ if (args != null && args[keyIndex] != null) {
12771
+ const key = args[keyIndex].toString();
12772
+ cacheKey.push(key);
12773
+ }
12774
+ }
12775
+ }
12776
+ else if (args.length > 0) { //cacheKey belirtilmemisse tum parametreleri kullan
12777
+ for (let i = 0; i < args.length; i++) {
12778
+ const key = args[i].toString();
12779
+ cacheKey.push(key);
12780
+ }
12781
+ }
12782
+ // Cache key'i dizeye dönüştür
12783
+ // const key = Array.isArray(cacheKey) ? cacheKey.join(':') : cacheKey;
12784
+ // Cache'ten veri al
12785
+ let cachedData = yield Services.Cache.load(cacheKey);
12786
+ if (cachedData != null) {
12787
+ return cachedData; // Cache'teki veriyi döndür
12788
+ }
12789
+ // Orijinal metodu çağır ve dönen değeri cache'e kaydet
12790
+ const result = yield originalMethod.apply(this, args);
12791
+ // Cache'e kaydet (asenkron yapılır, beklenmez)
12792
+ Services.Cache.save(cacheKey, result);
12793
+ console.log('------------------------------Cache executed..');
12794
+ return result;
12795
+ });
12796
+ };
12797
+ return descriptor;
12798
+ };
12799
+ }
12800
+ /* const cacheKeys: any[] = target.__cacheKeys || [];
12801
+ console.log("Defined cache keys:", [...cacheKeys].reverse());
12802
+
12803
+ const className = target.constructor.name.toLowerCase();
12804
+
12805
+ // Metod adı
12806
+ const methodName = propertyKey.toLowerCase();
12807
+
12808
+ debugger
12809
+ const cacheKey = ['admin', className, propertyKey];
12810
+ if (cacheKey.length > 0) {
12811
+ for (let i = 0; i < cacheKeys.length; i++) {
12812
+ const keyIndex = cacheKeys[i]['parameterIndex'];
12813
+ if (args != null && args[keyIndex] != null) {
12814
+ const key = args[keyIndex].toString();
12815
+ cacheKey.push(key);
12816
+ }
12817
+ }
12818
+ } else if (args.length > 0) { //cacheKey belirtilmemisse tum parametreleri kullan
12819
+ for (let i = 0; i < args.length; i++) {
12820
+ const key = args[i].toString();
12821
+ cacheKey.push(key);
12822
+ }
12823
+ } */
12824
+
12825
+ class Subscription extends ServiceClient {
12826
+ getServiceName() {
12827
+ return 'com.appconda.service.subscription';
12828
+ }
12829
+ getAllSubscriptionProducts(isPublic) {
12830
+ return __awaiter(this, void 0, void 0, function* () {
12831
+ const payload = {};
12832
+ return yield this.actionCall('ListSubscriptionProducts', payload);
12833
+ });
12834
+ }
12835
+ getActiveTenantsSubscriptions(isPublic) {
12836
+ return __awaiter(this, void 0, void 0, function* () {
12837
+ const payload = {};
12838
+ return yield this.actionCall('GetActiveTenantsSubscriptions', payload);
12839
+ });
12840
+ }
12841
+ getAllSubscriptionProductsWithTenants() {
12842
+ return __awaiter(this, void 0, void 0, function* () {
12843
+ const payload = {};
12844
+ return yield this.actionCall('GetAllSubscriptionProductsWithTenants', payload);
12845
+ });
12846
+ }
12847
+ getSubscriptionProduct(productId) {
12848
+ return __awaiter(this, void 0, void 0, function* () {
12849
+ const payload = {};
12850
+ payload['productId'] = productId;
12851
+ return yield this.actionCall('GetSubscriptionProduct', payload);
12852
+ });
12853
+ }
12854
+ getAllTenantSubscriptionProducts(filters, pagination) {
12855
+ return __awaiter(this, void 0, void 0, function* () {
12856
+ const payload = {};
12857
+ payload['filters'] = filters;
12858
+ payload['pagination'] = pagination;
12859
+ return yield this.actionCall('GetAllTenantSubscriptionProducts', payload);
12860
+ });
12861
+ }
12862
+ }
12863
+ __decorate([
12864
+ Cache(),
12865
+ __metadata("design:type", Function),
12866
+ __metadata("design:paramtypes", [Object, Object]),
12867
+ __metadata("design:returntype", Promise)
12868
+ ], Subscription.prototype, "getAllTenantSubscriptionProducts", null);
12869
+
12870
+ class Tenant extends ServiceClient {
12871
+ getServiceName() {
12872
+ return 'com.appconda.service.tenant';
12873
+ }
12874
+ get(tenantId) {
12875
+ return __awaiter(this, void 0, void 0, function* () {
12876
+ if (typeof tenantId === 'undefined') {
12877
+ throw new AppcondaException('Missing required parameter: "tenantId"');
12878
+ }
12879
+ const apiPath = '/tenants/{tenantId}'.replace('{tenantId}', tenantId);
12880
+ const payload = {};
12881
+ const uri = new URL(this.client.config.endpoint + apiPath);
12882
+ const apiHeaders = {
12883
+ 'content-type': 'application/json',
12884
+ };
12885
+ return yield this.client.call('get', uri, apiHeaders, payload);
12886
+ });
12887
+ }
12888
+ /**
12889
+ * Create account
12890
+ *
12891
+ * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appconda.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
12892
+ *
12893
+ * @param {string} tenantId
12894
+ * @param {string} name
12895
+ * @param {string} slug
12896
+ * @throws {AppcondaException}
12897
+ * @returns {Promise<Models.User<Preferences>>}
12898
+ */
12899
+ create(_a) {
12900
+ return __awaiter(this, arguments, void 0, function* ({ $id, name, slug }) {
12901
+ if (typeof $id === 'undefined') {
12902
+ throw new AppcondaException('Missing required parameter: "tenantId"');
12903
+ }
12904
+ if (typeof name === 'undefined') {
12905
+ throw new AppcondaException('Missing required parameter: "name"');
12906
+ }
12907
+ if (typeof slug === 'undefined') {
12908
+ throw new AppcondaException('Missing required parameter: "slug"');
12909
+ }
12910
+ const apiPath = '/tenants';
12911
+ const payload = {};
12912
+ if (typeof $id !== 'undefined') {
12913
+ payload['tenantId'] = $id;
12914
+ }
12915
+ if (typeof name !== 'undefined') {
12916
+ payload['name'] = name;
12917
+ }
12918
+ if (typeof slug !== 'undefined') {
12919
+ payload['slug'] = slug;
12920
+ }
12921
+ const uri = new URL(this.client.config.endpoint + apiPath);
12922
+ const apiHeaders = {
12923
+ 'content-type': 'application/json',
12924
+ };
12925
+ return yield this.client.call('post', uri, apiHeaders, payload);
12926
+ });
12927
+ }
12928
+ list(queries, search) {
12929
+ return __awaiter(this, void 0, void 0, function* () {
12930
+ const apiPath = '/tenants';
12931
+ const payload = {};
12932
+ if (typeof queries !== 'undefined') {
12933
+ payload['queries'] = queries;
12934
+ }
12935
+ if (typeof search !== 'undefined') {
12936
+ payload['search'] = search;
12937
+ }
12938
+ const uri = new URL(this.client.config.endpoint + apiPath);
12939
+ const apiHeaders = {
12940
+ 'content-type': 'application/json',
12941
+ };
12942
+ return yield this.client.call('get', uri, apiHeaders, payload);
12943
+ });
12944
+ }
12945
+ listUserTenants(userId, queries, search) {
12946
+ return __awaiter(this, void 0, void 0, function* () {
12947
+ const apiPath = `/tenants/${userId}/tenants`;
12948
+ const payload = {};
12949
+ if (typeof queries !== 'undefined') {
12950
+ payload['queries'] = queries;
12951
+ }
12952
+ if (typeof search !== 'undefined') {
12953
+ payload['search'] = search;
12954
+ }
12955
+ const uri = new URL(this.client.config.endpoint + apiPath);
12956
+ const apiHeaders = {
12957
+ 'content-type': 'application/json',
12958
+ };
12959
+ return yield this.client.call('get', uri, apiHeaders, payload);
12960
+ });
12961
+ }
12962
+ listTenantUsers(tenantId, queries, search) {
12963
+ return __awaiter(this, void 0, void 0, function* () {
12964
+ const apiPath = `/tenants/${tenantId}/users`;
12965
+ const payload = {};
12966
+ if (typeof queries !== 'undefined') {
12967
+ payload['queries'] = queries;
12968
+ }
12969
+ if (typeof search !== 'undefined') {
12970
+ payload['search'] = search;
12971
+ }
12972
+ const uri = new URL(this.client.config.endpoint + apiPath);
12973
+ const apiHeaders = {
12974
+ 'content-type': 'application/json',
12975
+ };
12976
+ return yield this.client.call('get', uri, apiHeaders, payload);
12977
+ });
12978
+ }
12979
+ createTenantUser(_a) {
12980
+ return __awaiter(this, arguments, void 0, function* ({ tenantId, userId }) {
12981
+ if (typeof tenantId === 'undefined') {
12982
+ throw new AppcondaException('Missing required parameter: "tenantId"');
12983
+ }
12984
+ if (typeof userId === 'undefined') {
12985
+ throw new AppcondaException('Missing required parameter: "userId"');
12986
+ }
12987
+ const apiPath = `/tenants/${tenantId}/users`;
12988
+ const payload = {};
12989
+ if (typeof userId !== 'undefined') {
12990
+ payload['userId'] = userId;
12991
+ }
12992
+ const uri = new URL(this.client.config.endpoint + apiPath);
12993
+ const apiHeaders = {
12994
+ 'content-type': 'application/json',
12995
+ };
12996
+ return yield this.client.call('post', uri, apiHeaders, payload);
12997
+ });
12998
+ }
12999
+ adminGetAllTenantsIdsAndNames() {
13000
+ return __awaiter(this, void 0, void 0, function* () {
13001
+ const payload = {};
13002
+ return yield this.actionCall('AdminGetAllTenantsIdsAndNames', payload);
13003
+ });
13004
+ }
13005
+ }
13006
+
13007
+ class TenantSubscription {
13008
+ constructor(client) {
13009
+ this.client = client;
13010
+ }
13011
+ getOrPersistTenantSubscription(tenantId) {
13012
+ return __awaiter(this, void 0, void 0, function* () {
13013
+ if (typeof tenantId === 'undefined') {
13014
+ throw new AppcondaException('Missing required parameter: "tenantId"');
13015
+ }
13016
+ const apiPath = `/tenant/subscriptions/${tenantId}`;
13017
+ const payload = {};
13018
+ if (typeof tenantId !== 'undefined') {
13019
+ payload['tenantId'] = tenantId;
13020
+ }
13021
+ const uri = new URL(this.client.config.endpoint + apiPath);
13022
+ const apiHeaders = {
13023
+ 'content-type': 'application/json',
13024
+ };
13025
+ return yield this.client.call('get', uri, apiHeaders, payload, 'arrayBuffer');
13026
+ });
13027
+ }
13028
+ getTenantSubscriptions() {
13029
+ return __awaiter(this, void 0, void 0, function* () {
13030
+ const apiPath = `/tenant/subscriptions`;
13031
+ const payload = {};
13032
+ const uri = new URL(this.client.config.endpoint + apiPath);
13033
+ const apiHeaders = {
13034
+ 'content-type': 'application/json',
13035
+ };
13036
+ return yield this.client.call('get', uri, apiHeaders, payload, 'arrayBuffer');
13037
+ });
13038
+ }
13039
+ createTenantSubscription(tenantId, stripeCustomerId) {
13040
+ return __awaiter(this, void 0, void 0, function* () {
13041
+ if (typeof tenantId === 'undefined') {
13042
+ throw new AppcondaException('Missing required parameter: "tenantId"');
13043
+ }
13044
+ if (typeof stripeCustomerId === 'undefined') {
13045
+ throw new AppcondaException('Missing required parameter: "stripeCustomerId"');
13046
+ }
13047
+ const apiPath = '/tenant/subscriptions';
13048
+ const payload = {};
13049
+ if (typeof tenantId !== 'undefined') {
13050
+ payload['tenantId'] = tenantId;
13051
+ }
13052
+ if (typeof stripeCustomerId !== 'undefined') {
13053
+ payload['stripeCustomerId'] = stripeCustomerId;
13054
+ }
13055
+ const uri = new URL(this.client.config.endpoint + apiPath);
13056
+ const apiHeaders = {
13057
+ 'content-type': 'application/json',
13058
+ };
13059
+ return yield this.client.call('post', uri, apiHeaders, payload);
13060
+ });
13061
+ }
13062
+ }
13063
+
13064
+ class Node extends ServiceClient {
13065
+ getServiceName() {
13066
+ return 'com.appconda.service.node';
13067
+ }
13068
+ GetAllNodes(isPublic) {
13069
+ return __awaiter(this, void 0, void 0, function* () {
13070
+ const payload = {};
13071
+ return yield this.actionCall('GetAllNodes', payload);
13072
+ });
13073
+ }
13074
+ }
13075
+
13076
+ class Permissions {
13077
+ constructor(client) {
13078
+ this.client = client;
13079
+ }
13080
+ get(permissionId) {
13081
+ return __awaiter(this, void 0, void 0, function* () {
13082
+ if (typeof permissionId === 'undefined') {
13083
+ throw new AppcondaException('Missing required parameter: "permissionId"');
13084
+ }
13085
+ const apiPath = '/permissions/{permissionId}'.replace('{permissionId}', permissionId);
13086
+ const payload = {};
13087
+ const uri = new URL(this.client.config.endpoint + apiPath);
13088
+ const apiHeaders = {
13089
+ 'content-type': 'application/json',
13090
+ };
13091
+ return yield this.client.call('get', uri, apiHeaders, payload);
13092
+ });
13093
+ }
13094
+ /**
13095
+ * Create account
13096
+ *
13097
+ * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appconda.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
13098
+ *
13099
+ * @param {string} tenantId
13100
+ * @param {string} name
13101
+ * @param {string} slug
13102
+ * @throws {AppcondaException}
13103
+ * @returns {Promise<Models.User<Preferences>>}
13104
+ */
13105
+ create(_a) {
13106
+ return __awaiter(this, arguments, void 0, function* ({ $id, name, description, type }) {
13107
+ if (typeof $id === 'undefined') {
13108
+ throw new AppcondaException('Missing required parameter: "roleId"');
13109
+ }
13110
+ if (typeof name === 'undefined') {
13111
+ throw new AppcondaException('Missing required parameter: "name"');
13112
+ }
13113
+ if (typeof description === 'undefined') {
13114
+ throw new AppcondaException('Missing required parameter: "description"');
13115
+ }
13116
+ const apiPath = '/permission';
13117
+ const payload = {};
13118
+ if (typeof $id !== 'undefined') {
13119
+ payload['permissionId'] = $id;
13120
+ }
13121
+ if (typeof name !== 'undefined') {
13122
+ payload['name'] = name;
13123
+ }
13124
+ if (typeof description !== 'undefined') {
13125
+ payload['description'] = description;
13126
+ }
13127
+ if (typeof type !== 'undefined') {
13128
+ payload['type'] = type;
13129
+ }
13130
+ const uri = new URL(this.client.config.endpoint + apiPath);
13131
+ const apiHeaders = {
13132
+ 'content-type': 'application/json',
13133
+ };
13134
+ return yield this.client.call('post', uri, apiHeaders, payload);
13135
+ });
13136
+ }
13137
+ list(queries, search) {
13138
+ return __awaiter(this, void 0, void 0, function* () {
13139
+ const apiPath = '/permissions';
13140
+ const payload = {};
13141
+ if (typeof queries !== 'undefined') {
13142
+ payload['queries'] = queries;
13143
+ }
13144
+ if (typeof search !== 'undefined') {
13145
+ payload['search'] = search;
13146
+ }
13147
+ const uri = new URL(this.client.config.endpoint + apiPath);
13148
+ const apiHeaders = {
13149
+ 'content-type': 'application/json',
13150
+ };
13151
+ return yield this.client.call('get', uri, apiHeaders, payload);
13152
+ });
13153
+ }
13154
+ listPermissionInRoles(permissionId) {
13155
+ return __awaiter(this, void 0, void 0, function* () {
13156
+ if (typeof permissionId === 'undefined') {
13157
+ throw new AppcondaException('Missing required parameter: "permissionId"');
13158
+ }
13159
+ const apiPath = '/permission/in-roles/{permissionId}'.replace('{permissionId}', permissionId);
13160
+ const payload = {};
13161
+ if (typeof permissionId !== 'undefined') {
13162
+ payload['permissionId'] = permissionId;
13163
+ }
13164
+ const uri = new URL(this.client.config.endpoint + apiPath);
13165
+ const apiHeaders = {
13166
+ 'content-type': 'application/json',
13167
+ };
13168
+ return yield this.client.call('get', uri, apiHeaders, payload);
13169
+ });
13170
+ }
13171
+ }
13172
+
13173
+ function getSDKForCurrentUser() {
13174
+ return __awaiter(this, void 0, void 0, function* () {
13175
+ const adminClient = yield getAppcondaClient();
13176
+ const c = yield cookies();
13177
+ const s = c.get('a_session') || c.get('a_session_console_legacy');
13178
+ if (!s || !s.value) {
13179
+ throw new Error("No session");
13180
+ }
13181
+ adminClient.setSession(s.value);
13182
+ const accounts = new Account(adminClient);
13183
+ const databases = new Databases(adminClient);
13184
+ const projects = new Projects(adminClient);
13185
+ const currentUser = yield accounts.get();
13186
+ const users = new Users(adminClient);
13187
+ const teams = new Teams(adminClient);
13188
+ const tenants = new Tenant(adminClient);
13189
+ const roles = new Roles(adminClient);
13190
+ const permissions = new Permissions(adminClient);
13191
+ const schemas = new Schemas(adminClient);
13192
+ const community = new Community(adminClient);
13193
+ const tenantSubscriptions = new TenantSubscription(adminClient);
13194
+ const subscription = new Subscription(adminClient);
13195
+ const pricing = new Pricing(adminClient);
13196
+ const configuration = new Configuration(adminClient);
13197
+ //const acl = new Acl(adminClient);
13198
+ const node = new Node(adminClient);
13199
+ return {
13200
+ currentUser,
13201
+ accounts,
13202
+ databases,
13203
+ projects,
13204
+ users,
13205
+ teams,
13206
+ tenants,
13207
+ roles,
13208
+ permissions,
13209
+ schemas,
13210
+ community,
13211
+ tenantSubscriptions,
13212
+ subscription,
13213
+ pricing,
13214
+ configuration,
13215
+ // acl,
13216
+ node
13217
+ };
13218
+ });
13219
+ }
13220
+
13221
+ export { Account, AppcondaException, Applets, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, Compression, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, Health, ID, ImageFormat, ImageGravity, IndexType, Locale, Messaging, MessagingProviderType, Name, OAuthProvider, PasswordHash, Permission, Query, RelationMutate, RelationshipType, Role, Runtime, SmtpEncryption, Storage, Teams, Users, getSDKForCurrentUser };
10589
13222
  //# sourceMappingURL=sdk.js.map