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