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