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