@appconda/nextjs 1.0.12 → 1.0.14

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