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