@scaleway/sdk 2.0.0-alpha.13 → 2.0.0-alpha.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 (215) hide show
  1. package/dist/api/account/index.js +4 -0
  2. package/dist/api/account/v2/api.gen.js +147 -0
  3. package/dist/api/account/v2/index.gen.js +4 -0
  4. package/dist/api/account/v2/marshalling.gen.js +39 -0
  5. package/dist/api/account/v3/api.gen.js +129 -0
  6. package/dist/api/account/v3/index.gen.js +6 -0
  7. package/dist/api/account/v3/marshalling.gen.js +39 -0
  8. package/dist/api/account/v3/validation-rules.gen.js +39 -0
  9. package/dist/api/applesilicon/index.js +2 -0
  10. package/dist/api/applesilicon/v1alpha1/api.gen.js +220 -0
  11. package/dist/api/applesilicon/v1alpha1/content.gen.js +7 -0
  12. package/dist/api/applesilicon/v1alpha1/index.gen.js +5 -0
  13. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +113 -0
  14. package/dist/api/baremetal/index.js +2 -0
  15. package/dist/api/baremetal/v1/api.gen.js +523 -0
  16. package/dist/api/baremetal/v1/api.utils.js +27 -0
  17. package/dist/api/baremetal/v1/content.gen.js +13 -0
  18. package/dist/api/baremetal/v1/index.js +5 -0
  19. package/dist/api/baremetal/v1/marshalling.gen.js +406 -0
  20. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  21. package/dist/api/billing/index.js +2 -0
  22. package/dist/api/billing/v2alpha1/api.gen.js +80 -0
  23. package/dist/api/billing/v2alpha1/index.gen.js +4 -0
  24. package/dist/api/billing/v2alpha1/marshalling.gen.js +53 -0
  25. package/dist/api/block/index.js +2 -0
  26. package/dist/api/block/v1alpha1/api.gen.js +249 -0
  27. package/dist/api/block/v1alpha1/content.gen.js +13 -0
  28. package/dist/api/block/v1alpha1/index.gen.js +7 -0
  29. package/dist/api/block/v1alpha1/marshalling.gen.js +182 -0
  30. package/dist/api/block/v1alpha1/validation-rules.gen.js +52 -0
  31. package/dist/api/cockpit/index.js +2 -0
  32. package/dist/api/cockpit/v1beta1/api.gen.js +543 -0
  33. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  34. package/dist/api/cockpit/v1beta1/index.gen.js +5 -0
  35. package/dist/api/cockpit/v1beta1/marshalling.gen.js +271 -0
  36. package/dist/api/container/index.js +2 -0
  37. package/dist/api/container/v1beta1/api.gen.js +549 -0
  38. package/dist/api/container/v1beta1/content.gen.js +22 -0
  39. package/dist/api/container/v1beta1/index.gen.js +7 -0
  40. package/dist/api/container/v1beta1/marshalling.gen.js +358 -0
  41. package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
  42. package/dist/api/document_db/index.js +2 -0
  43. package/dist/api/document_db/v1beta1/api.gen.js +830 -0
  44. package/dist/api/document_db/v1beta1/content.gen.js +19 -0
  45. package/dist/api/document_db/v1beta1/index.gen.js +7 -0
  46. package/dist/api/document_db/v1beta1/marshalling.gen.js +636 -0
  47. package/dist/api/document_db/v1beta1/validation-rules.gen.js +10 -0
  48. package/dist/api/domain/index.js +2 -0
  49. package/dist/api/domain/v2beta1/api.gen.js +867 -0
  50. package/dist/api/domain/v2beta1/content.gen.js +28 -0
  51. package/dist/api/domain/v2beta1/index.gen.js +5 -0
  52. package/dist/api/domain/v2beta1/marshalling.gen.js +1172 -0
  53. package/dist/api/flexibleip/index.js +2 -0
  54. package/dist/api/flexibleip/v1alpha1/api.gen.js +195 -0
  55. package/dist/api/flexibleip/v1alpha1/content.gen.js +10 -0
  56. package/dist/api/flexibleip/v1alpha1/index.gen.js +7 -0
  57. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +97 -0
  58. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  59. package/dist/api/function/index.js +2 -0
  60. package/dist/api/function/v1beta1/api.gen.js +560 -0
  61. package/dist/api/function/v1beta1/content.gen.js +22 -0
  62. package/dist/api/function/v1beta1/index.gen.js +7 -0
  63. package/dist/api/function/v1beta1/marshalling.gen.js +396 -0
  64. package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
  65. package/dist/api/iam/index.js +2 -0
  66. package/dist/api/iam/v1alpha1/api.gen.js +783 -0
  67. package/dist/api/iam/v1alpha1/index.gen.js +6 -0
  68. package/dist/api/iam/v1alpha1/marshalling.gen.js +384 -0
  69. package/dist/api/iam/v1alpha1/validation-rules.gen.js +207 -0
  70. package/dist/api/instance/index.js +2 -0
  71. package/dist/api/instance/v1/api.gen.js +1003 -0
  72. package/dist/api/instance/v1/api.utils.js +369 -0
  73. package/dist/api/instance/v1/content.gen.js +31 -0
  74. package/dist/api/instance/v1/index.js +2 -0
  75. package/dist/api/instance/v1/marshalling.gen.js +1415 -0
  76. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  77. package/dist/api/iot/index.js +2 -0
  78. package/dist/api/iot/v1/api.gen.js +573 -0
  79. package/dist/api/iot/v1/content.gen.js +7 -0
  80. package/dist/api/iot/v1/index.gen.js +5 -0
  81. package/dist/api/iot/v1/marshalling.gen.js +439 -0
  82. package/dist/api/ipam/index.js +2 -0
  83. package/dist/api/ipam/v1/api.gen.js +113 -0
  84. package/dist/api/ipam/v1/index.gen.js +6 -0
  85. package/dist/api/ipam/v1/marshalling.gen.js +77 -0
  86. package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
  87. package/dist/api/ipfs/index.js +2 -0
  88. package/dist/api/ipfs/v1alpha1/api.gen.js +314 -0
  89. package/dist/api/ipfs/v1alpha1/content.gen.js +10 -0
  90. package/dist/api/ipfs/v1alpha1/index.gen.js +5 -0
  91. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +180 -0
  92. package/dist/api/k8s/index.js +2 -0
  93. package/dist/api/k8s/v1/api.gen.js +454 -0
  94. package/dist/api/k8s/v1/api.utils.js +13 -0
  95. package/dist/api/k8s/v1/content.gen.js +13 -0
  96. package/dist/api/k8s/v1/index.js +4 -0
  97. package/dist/api/k8s/v1/marshalling.gen.js +421 -0
  98. package/dist/api/k8s/v1/validation-rules.gen.js +101 -0
  99. package/dist/api/lb/index.js +2 -0
  100. package/dist/api/lb/v1/api.gen.js +1669 -0
  101. package/dist/api/lb/v1/api.utils.js +81 -0
  102. package/dist/api/lb/v1/content.gen.js +16 -0
  103. package/dist/api/lb/v1/index.js +2 -0
  104. package/dist/api/lb/v1/marshalling.gen.js +1039 -0
  105. package/dist/api/marketplace/index.js +4 -0
  106. package/dist/api/marketplace/v1/api.gen.js +60 -0
  107. package/dist/api/marketplace/v1/index.gen.js +4 -0
  108. package/dist/api/marketplace/v1/marshalling.gen.js +92 -0
  109. package/dist/api/marketplace/v2/api.gen.js +162 -0
  110. package/dist/api/marketplace/v2/index.gen.js +4 -0
  111. package/dist/api/marketplace/v2/marshalling.gen.js +94 -0
  112. package/dist/api/mnq/index.js +4 -0
  113. package/dist/api/mnq/v1alpha1/api.gen.js +197 -0
  114. package/dist/api/mnq/v1alpha1/index.gen.js +4 -0
  115. package/dist/api/mnq/v1alpha1/marshalling.gen.js +126 -0
  116. package/dist/api/mnq/v1beta1/api.gen.js +529 -0
  117. package/dist/api/mnq/v1beta1/index.gen.js +6 -0
  118. package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
  119. package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
  120. package/dist/api/rdb/index.js +2 -0
  121. package/dist/api/rdb/v1/api.gen.js +972 -0
  122. package/dist/api/rdb/v1/content.gen.js +22 -0
  123. package/dist/api/rdb/v1/index.gen.js +7 -0
  124. package/dist/api/rdb/v1/marshalling.gen.js +694 -0
  125. package/dist/api/rdb/v1/validation-rules.gen.js +10 -0
  126. package/dist/api/redis/index.js +2 -0
  127. package/dist/api/redis/v1/api.gen.js +389 -0
  128. package/dist/api/redis/v1/content.gen.js +7 -0
  129. package/dist/api/redis/v1/index.gen.js +5 -0
  130. package/dist/api/redis/v1/marshalling.gen.js +283 -0
  131. package/dist/api/registry/index.js +2 -0
  132. package/dist/api/registry/v1/api.gen.js +252 -0
  133. package/dist/api/registry/v1/content.gen.js +13 -0
  134. package/dist/api/registry/v1/index.gen.js +5 -0
  135. package/dist/api/registry/v1/marshalling.gen.js +108 -0
  136. package/dist/api/secret/index.js +2 -0
  137. package/dist/api/secret/v1alpha1/api.gen.js +415 -0
  138. package/dist/api/secret/v1alpha1/index.gen.js +4 -0
  139. package/dist/api/secret/v1alpha1/marshalling.gen.js +150 -0
  140. package/dist/api/tem/index.js +2 -0
  141. package/dist/api/tem/v1alpha1/api.gen.js +229 -0
  142. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  143. package/dist/api/tem/v1alpha1/index.gen.js +5 -0
  144. package/dist/api/tem/v1alpha1/marshalling.gen.js +168 -0
  145. package/dist/api/test/index.js +2 -0
  146. package/dist/api/test/v1/api.gen.js +152 -0
  147. package/dist/api/test/v1/content.gen.js +7 -0
  148. package/dist/api/test/v1/index.gen.js +5 -0
  149. package/dist/api/test/v1/marshalling.gen.js +81 -0
  150. package/dist/api/vpc/index.js +4 -0
  151. package/dist/api/vpc/v1/api.gen.js +110 -0
  152. package/dist/api/vpc/v1/index.gen.js +4 -0
  153. package/dist/api/vpc/v1/marshalling.gen.js +44 -0
  154. package/dist/api/vpc/v2/api.gen.js +276 -0
  155. package/dist/api/vpc/v2/index.gen.js +4 -0
  156. package/dist/api/vpc/v2/marshalling.gen.js +137 -0
  157. package/dist/api/vpcgw/index.js +2 -0
  158. package/dist/api/vpcgw/v1/api.gen.js +669 -0
  159. package/dist/api/vpcgw/v1/content.gen.js +10 -0
  160. package/dist/api/vpcgw/v1/index.gen.js +5 -0
  161. package/dist/api/vpcgw/v1/marshalling.gen.js +359 -0
  162. package/dist/api/webhosting/index.js +2 -0
  163. package/dist/api/webhosting/v1alpha1/api.gen.js +158 -0
  164. package/dist/api/webhosting/v1alpha1/content.gen.js +7 -0
  165. package/dist/api/webhosting/v1alpha1/index.gen.js +7 -0
  166. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +146 -0
  167. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +14 -0
  168. package/dist/helpers/is-browser.js +5 -0
  169. package/dist/helpers/is-response.js +10 -0
  170. package/dist/helpers/json.js +11 -0
  171. package/dist/helpers/marshalling.js +130 -0
  172. package/dist/index.cjs +26484 -0
  173. package/dist/index.d.ts +31184 -0
  174. package/dist/index.js +71 -0
  175. package/dist/internal/async/interval-retrier.js +105 -0
  176. package/dist/internal/async/sleep.js +13 -0
  177. package/dist/internal/interceptors/composer.js +46 -0
  178. package/dist/internal/interceptors/helpers.js +32 -0
  179. package/dist/internal/logger/console-logger.js +38 -0
  180. package/dist/internal/logger/index.js +41 -0
  181. package/dist/internal/logger/level-resolver.js +13 -0
  182. package/dist/internal/validations/string-validation.js +38 -0
  183. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +13 -0
  184. package/dist/scw/api.js +12 -0
  185. package/dist/scw/auth.js +68 -0
  186. package/dist/scw/client-ini-factory.js +174 -0
  187. package/dist/scw/client-ini-profile.js +54 -0
  188. package/dist/scw/client-settings.js +78 -0
  189. package/dist/scw/client.js +98 -0
  190. package/dist/scw/constants.js +4 -0
  191. package/dist/scw/custom-marshalling.js +131 -0
  192. package/dist/scw/errors/error-parser.js +107 -0
  193. package/dist/scw/errors/non-standard/invalid-request-mapper.js +36 -0
  194. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +27 -0
  195. package/dist/scw/errors/scw-error.js +66 -0
  196. package/dist/scw/errors/standard/already-exists-error.js +26 -0
  197. package/dist/scw/errors/standard/denied-authentication-error.js +52 -0
  198. package/dist/scw/errors/standard/index.js +13 -0
  199. package/dist/scw/errors/standard/invalid-arguments-error.js +67 -0
  200. package/dist/scw/errors/standard/out-of-stock-error.js +22 -0
  201. package/dist/scw/errors/standard/permissions-denied-error.js +48 -0
  202. package/dist/scw/errors/standard/precondition-failed-error.js +42 -0
  203. package/dist/scw/errors/standard/quotas-exceeded-error.js +68 -0
  204. package/dist/scw/errors/standard/resource-expired-error.js +26 -0
  205. package/dist/scw/errors/standard/resource-locked-error.js +25 -0
  206. package/dist/scw/errors/standard/resource-not-found-error.js +25 -0
  207. package/dist/scw/errors/standard/too-many-requests-error.js +70 -0
  208. package/dist/scw/errors/standard/transient-state-error.js +26 -0
  209. package/dist/scw/errors/types.js +23 -0
  210. package/dist/scw/fetch/build-fetcher.js +72 -0
  211. package/dist/scw/fetch/http-dumper.js +54 -0
  212. package/dist/scw/fetch/http-interceptors.js +99 -0
  213. package/dist/scw/fetch/resource-paginator.js +84 -0
  214. package/dist/scw/fetch/response-parser.js +72 -0
  215. package/package.json +2 -2
@@ -0,0 +1,229 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { EMAIL_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateEmailRequest, unmarshalCreateEmailResponse, unmarshalEmail, unmarshalListEmailsResponse, unmarshalStatistics, marshalCreateDomainRequest, unmarshalDomain, unmarshalListDomainsResponse, unmarshalDomainLastStatus } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ // If you have any remark or suggestion do not hesitate to open an issue.
10
+ const jsonContentHeaders = {
11
+ 'Content-Type': 'application/json; charset=utf-8'
12
+ };
13
+
14
+ /** Transactional Email API. */
15
+ class API extends API$1 {
16
+ /** Lists the available regions of the API. */
17
+ static LOCALITIES = ['fr-par'];
18
+
19
+ /**
20
+ * Send an email. You must specify the `region`, the sender and the
21
+ * recipient's information and the `project_id` to send an email from a
22
+ * checked domain. The subject of the email must contain at least 6
23
+ * characters.
24
+ *
25
+ * @param request - The request {@link CreateEmailRequest}
26
+ * @returns A Promise of CreateEmailResponse
27
+ */
28
+ createEmail = request => this.client.fetch({
29
+ body: JSON.stringify(marshalCreateEmailRequest(request, this.client.settings)),
30
+ headers: jsonContentHeaders,
31
+ method: 'POST',
32
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails`
33
+ }, unmarshalCreateEmailResponse);
34
+
35
+ /**
36
+ * Get an email. Retrieve information about a specific email using the
37
+ * `email_id` and `region` parameters.
38
+ *
39
+ * @param request - The request {@link GetEmailRequest}
40
+ * @returns A Promise of Email
41
+ */
42
+ getEmail = request => this.client.fetch({
43
+ method: 'GET',
44
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails/${validatePathParam('emailId', request.emailId)}`
45
+ }, unmarshalEmail);
46
+
47
+ /**
48
+ * Waits for {@link Email} to be in a final state.
49
+ *
50
+ * @param request - The request {@link GetEmailRequest}
51
+ * @param options - The waiting options
52
+ * @returns A Promise of Email
53
+ */
54
+ waitForEmail = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!EMAIL_TRANSIENT_STATUSES.includes(res.status))), this.getEmail, request, options);
55
+ pageOfListEmails = (() => {
56
+ var _this = this;
57
+ return function (request) {
58
+ if (request === void 0) {
59
+ request = {};
60
+ }
61
+ return _this.client.fetch({
62
+ method: 'GET',
63
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/emails`,
64
+ urlParams: urlParams(['domain_id', request.domainId], ['flags', request.flags], ['mail_from', request.mailFrom], ['mail_rcpt', request.mailRcpt], ['mail_to', request.mailTo], ['message_id', request.messageId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['search', request.search], ['since', request.since], ['statuses', request.statuses], ['subject', request.subject], ['until', request.until])
65
+ }, unmarshalListEmailsResponse);
66
+ };
67
+ })();
68
+
69
+ /**
70
+ * List emails. Retrieve the list of emails sent from a specific domain or for
71
+ * a specific Project or Organization. You must specify the `region`.
72
+ *
73
+ * @param request - The request {@link ListEmailsRequest}
74
+ * @returns A Promise of ListEmailsResponse
75
+ */
76
+ listEmails = (() => {
77
+ var _this2 = this;
78
+ return function (request) {
79
+ if (request === void 0) {
80
+ request = {};
81
+ }
82
+ return enrichForPagination('emails', _this2.pageOfListEmails, request);
83
+ };
84
+ })();
85
+
86
+ /**
87
+ * Email statuses. Get information on your emails' statuses.
88
+ *
89
+ * @param request - The request {@link GetStatisticsRequest}
90
+ * @returns A Promise of Statistics
91
+ */
92
+ getStatistics = (() => {
93
+ var _this3 = this;
94
+ return function (request) {
95
+ if (request === void 0) {
96
+ request = {};
97
+ }
98
+ return _this3.client.fetch({
99
+ method: 'GET',
100
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/statistics`,
101
+ urlParams: urlParams(['domain_id', request.domainId], ['mail_from', request.mailFrom], ['project_id', request.projectId], ['since', request.since], ['until', request.until])
102
+ }, unmarshalStatistics);
103
+ };
104
+ })();
105
+
106
+ /**
107
+ * Cancel an email. You can cancel the sending of an email if it has not been
108
+ * sent yet. You must specify the `region` and the `email_id` of the email you
109
+ * want to cancel.
110
+ *
111
+ * @param request - The request {@link CancelEmailRequest}
112
+ * @returns A Promise of Email
113
+ */
114
+ cancelEmail = request => this.client.fetch({
115
+ body: '{}',
116
+ headers: jsonContentHeaders,
117
+ method: 'POST',
118
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails/${validatePathParam('emailId', request.emailId)}/cancel`
119
+ }, unmarshalEmail);
120
+
121
+ /**
122
+ * Register a domain in a project. You must specify the `region`, `project_id`
123
+ * and `domain_name` to register a domain in a specific Project.
124
+ *
125
+ * @param request - The request {@link CreateDomainRequest}
126
+ * @returns A Promise of Domain
127
+ */
128
+ createDomain = request => this.client.fetch({
129
+ body: JSON.stringify(marshalCreateDomainRequest(request, this.client.settings)),
130
+ headers: jsonContentHeaders,
131
+ method: 'POST',
132
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains`
133
+ }, unmarshalDomain);
134
+
135
+ /**
136
+ * Get information about a domain. Retrieve information about a specific
137
+ * domain using the `region` and `domain_id` parameters.
138
+ *
139
+ * @param request - The request {@link GetDomainRequest}
140
+ * @returns A Promise of Domain
141
+ */
142
+ getDomain = request => this.client.fetch({
143
+ method: 'GET',
144
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}`
145
+ }, unmarshalDomain);
146
+
147
+ /**
148
+ * Waits for {@link Domain} to be in a final state.
149
+ *
150
+ * @param request - The request {@link GetDomainRequest}
151
+ * @param options - The waiting options
152
+ * @returns A Promise of Domain
153
+ */
154
+ waitForDomain = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
155
+ pageOfListDomains = (() => {
156
+ var _this4 = this;
157
+ return function (request) {
158
+ if (request === void 0) {
159
+ request = {};
160
+ }
161
+ return _this4.client.fetch({
162
+ method: 'GET',
163
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? _this4.client.settings.defaultRegion)}/domains`,
164
+ urlParams: urlParams(['name', request.name], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this4.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status])
165
+ }, unmarshalListDomainsResponse);
166
+ };
167
+ })();
168
+
169
+ /**
170
+ * List domains. Retrieve domains in a specific project or in a specific
171
+ * Organization using the `region` parameter.
172
+ *
173
+ * @param request - The request {@link ListDomainsRequest}
174
+ * @returns A Promise of ListDomainsResponse
175
+ */
176
+ listDomains = (() => {
177
+ var _this5 = this;
178
+ return function (request) {
179
+ if (request === void 0) {
180
+ request = {};
181
+ }
182
+ return enrichForPagination('domains', _this5.pageOfListDomains, request);
183
+ };
184
+ })();
185
+
186
+ /**
187
+ * Delete a domain. You must specify the domain you want to delete by the
188
+ * `region` and `domain_id`. Deleting a domain is permanent and cannot be
189
+ * undone.
190
+ *
191
+ * @param request - The request {@link RevokeDomainRequest}
192
+ * @returns A Promise of Domain
193
+ */
194
+ revokeDomain = request => this.client.fetch({
195
+ body: '{}',
196
+ headers: jsonContentHeaders,
197
+ method: 'POST',
198
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}/revoke`
199
+ }, unmarshalDomain);
200
+
201
+ /**
202
+ * Domain DNS check. Perform an immediate DNS check of a domain using the
203
+ * `region` and `domain_id` parameters.
204
+ *
205
+ * @param request - The request {@link CheckDomainRequest}
206
+ * @returns A Promise of Domain
207
+ */
208
+ checkDomain = request => this.client.fetch({
209
+ body: '{}',
210
+ headers: jsonContentHeaders,
211
+ method: 'POST',
212
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}/check`
213
+ }, unmarshalDomain);
214
+
215
+ /**
216
+ * Display SPF and DKIM records status and potential errors. Display SPF and
217
+ * DKIM records status and potential errors, including the found records to
218
+ * make debugging easier.
219
+ *
220
+ * @param request - The request {@link GetDomainLastStatusRequest}
221
+ * @returns A Promise of DomainLastStatus
222
+ */
223
+ getDomainLastStatus = request => this.client.fetch({
224
+ method: 'GET',
225
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}/verification`
226
+ }, unmarshalDomainLastStatus);
227
+ }
228
+
229
+ export { API };
@@ -0,0 +1,10 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ /** Lists transient statutes of the enum {@link DomainStatus}. */
5
+ const DOMAIN_TRANSIENT_STATUSES = ['pending'];
6
+
7
+ /** Lists transient statutes of the enum {@link EmailStatus}. */
8
+ const EMAIL_TRANSIENT_STATUSES = ['new', 'sending'];
9
+
10
+ export { DOMAIN_TRANSIENT_STATUSES, EMAIL_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen.js';
2
+ export { DOMAIN_TRANSIENT_STATUSES, EMAIL_TRANSIENT_STATUSES } from './content.gen.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,168 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalEmailTry = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'EmailTry' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ code: data.code,
12
+ message: data.message,
13
+ rank: data.rank,
14
+ triedAt: unmarshalDate(data.tried_at)
15
+ };
16
+ };
17
+ const unmarshalEmail = data => {
18
+ if (!isJSONObject(data)) {
19
+ throw new TypeError(`Unmarshalling the type 'Email' failed as data isn't a dictionary.`);
20
+ }
21
+ return {
22
+ createdAt: unmarshalDate(data.created_at),
23
+ flags: data.flags,
24
+ id: data.id,
25
+ lastTries: unmarshalArrayOfObject(data.last_tries, unmarshalEmailTry),
26
+ mailFrom: data.mail_from,
27
+ mailRcpt: data.mail_rcpt,
28
+ messageId: data.message_id,
29
+ projectId: data.project_id,
30
+ rcptTo: data.rcpt_to,
31
+ rcptType: data.rcpt_type,
32
+ status: data.status,
33
+ statusDetails: data.status_details,
34
+ subject: data.subject,
35
+ tryCount: data.try_count,
36
+ updatedAt: unmarshalDate(data.updated_at)
37
+ };
38
+ };
39
+ const unmarshalDomainStatistics = data => {
40
+ if (!isJSONObject(data)) {
41
+ throw new TypeError(`Unmarshalling the type 'DomainStatistics' failed as data isn't a dictionary.`);
42
+ }
43
+ return {
44
+ canceledCount: data.canceled_count,
45
+ failedCount: data.failed_count,
46
+ sentCount: data.sent_count,
47
+ totalCount: data.total_count
48
+ };
49
+ };
50
+ const unmarshalDomain = data => {
51
+ if (!isJSONObject(data)) {
52
+ throw new TypeError(`Unmarshalling the type 'Domain' failed as data isn't a dictionary.`);
53
+ }
54
+ return {
55
+ createdAt: unmarshalDate(data.created_at),
56
+ dkimConfig: data.dkim_config,
57
+ id: data.id,
58
+ lastError: data.last_error,
59
+ lastValidAt: unmarshalDate(data.last_valid_at),
60
+ name: data.name,
61
+ nextCheckAt: unmarshalDate(data.next_check_at),
62
+ organizationId: data.organization_id,
63
+ projectId: data.project_id,
64
+ region: data.region,
65
+ revokedAt: unmarshalDate(data.revoked_at),
66
+ spfConfig: data.spf_config,
67
+ statistics: data.statistics ? unmarshalDomainStatistics(data.statistics) : undefined,
68
+ status: data.status
69
+ };
70
+ };
71
+ const unmarshalCreateEmailResponse = data => {
72
+ if (!isJSONObject(data)) {
73
+ throw new TypeError(`Unmarshalling the type 'CreateEmailResponse' failed as data isn't a dictionary.`);
74
+ }
75
+ return {
76
+ emails: unmarshalArrayOfObject(data.emails, unmarshalEmail)
77
+ };
78
+ };
79
+ const unmarshalDomainLastStatusDkimRecord = data => {
80
+ if (!isJSONObject(data)) {
81
+ throw new TypeError(`Unmarshalling the type 'DomainLastStatusDkimRecord' failed as data isn't a dictionary.`);
82
+ }
83
+ return {
84
+ error: data.error,
85
+ lastValidAt: unmarshalDate(data.last_valid_at),
86
+ status: data.status
87
+ };
88
+ };
89
+ const unmarshalDomainLastStatusSpfRecord = data => {
90
+ if (!isJSONObject(data)) {
91
+ throw new TypeError(`Unmarshalling the type 'DomainLastStatusSpfRecord' failed as data isn't a dictionary.`);
92
+ }
93
+ return {
94
+ error: data.error,
95
+ lastValidAt: unmarshalDate(data.last_valid_at),
96
+ status: data.status
97
+ };
98
+ };
99
+ const unmarshalDomainLastStatus = data => {
100
+ if (!isJSONObject(data)) {
101
+ throw new TypeError(`Unmarshalling the type 'DomainLastStatus' failed as data isn't a dictionary.`);
102
+ }
103
+ return {
104
+ dkimRecord: data.dkim_record ? unmarshalDomainLastStatusDkimRecord(data.dkim_record) : undefined,
105
+ domainId: data.domain_id,
106
+ domainName: data.domain_name,
107
+ spfRecord: data.spf_record ? unmarshalDomainLastStatusSpfRecord(data.spf_record) : undefined
108
+ };
109
+ };
110
+ const unmarshalListDomainsResponse = data => {
111
+ if (!isJSONObject(data)) {
112
+ throw new TypeError(`Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`);
113
+ }
114
+ return {
115
+ domains: unmarshalArrayOfObject(data.domains, unmarshalDomain),
116
+ totalCount: data.total_count
117
+ };
118
+ };
119
+ const unmarshalListEmailsResponse = data => {
120
+ if (!isJSONObject(data)) {
121
+ throw new TypeError(`Unmarshalling the type 'ListEmailsResponse' failed as data isn't a dictionary.`);
122
+ }
123
+ return {
124
+ emails: unmarshalArrayOfObject(data.emails, unmarshalEmail),
125
+ totalCount: data.total_count
126
+ };
127
+ };
128
+ const unmarshalStatistics = data => {
129
+ if (!isJSONObject(data)) {
130
+ throw new TypeError(`Unmarshalling the type 'Statistics' failed as data isn't a dictionary.`);
131
+ }
132
+ return {
133
+ canceledCount: data.canceled_count,
134
+ failedCount: data.failed_count,
135
+ newCount: data.new_count,
136
+ sendingCount: data.sending_count,
137
+ sentCount: data.sent_count,
138
+ totalCount: data.total_count
139
+ };
140
+ };
141
+ const marshalCreateDomainRequest = (request, defaults) => ({
142
+ accept_tos: request.acceptTos,
143
+ domain_name: request.domainName,
144
+ project_id: request.projectId ?? defaults.defaultProjectId
145
+ });
146
+ const marshalCreateEmailRequestAddress = (request, defaults) => ({
147
+ email: request.email,
148
+ name: request.name
149
+ });
150
+ const marshalCreateEmailRequestAttachment = (request, defaults) => ({
151
+ content: request.content,
152
+ name: request.name,
153
+ type: request.type
154
+ });
155
+ const marshalCreateEmailRequest = (request, defaults) => ({
156
+ attachments: request.attachments !== undefined ? request.attachments.map(elt => marshalCreateEmailRequestAttachment(elt)) : undefined,
157
+ bcc: request.bcc !== undefined ? request.bcc.map(elt => marshalCreateEmailRequestAddress(elt)) : undefined,
158
+ cc: request.cc !== undefined ? request.cc.map(elt => marshalCreateEmailRequestAddress(elt)) : undefined,
159
+ from: request.from !== undefined ? marshalCreateEmailRequestAddress(request.from) : undefined,
160
+ html: request.html,
161
+ project_id: request.projectId ?? defaults.defaultProjectId,
162
+ send_before: request.sendBefore,
163
+ subject: request.subject,
164
+ text: request.text,
165
+ to: request.to !== undefined ? request.to.map(elt => marshalCreateEmailRequestAddress(elt)) : undefined
166
+ });
167
+
168
+ export { marshalCreateDomainRequest, marshalCreateEmailRequest, unmarshalCreateEmailResponse, unmarshalDomain, unmarshalDomainLastStatus, unmarshalEmail, unmarshalListDomainsResponse, unmarshalListEmailsResponse, unmarshalStatistics };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };
@@ -0,0 +1,152 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { HUMAN_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalRegisterRequest, unmarshalRegisterResponse, unmarshalListHumansResponse, unmarshalHuman, marshalCreateHumanRequest, marshalUpdateHumanRequest } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ // If you have any remark or suggestion do not hesitate to open an issue.
10
+ const jsonContentHeaders = {
11
+ 'Content-Type': 'application/json; charset=utf-8'
12
+ };
13
+
14
+ /**
15
+ * Fake API.
16
+ *
17
+ * No Auth Service for end-to-end testing.
18
+ */
19
+ class API extends API$1 {
20
+ /**
21
+ * Register a user. Register a human and return a access-key and a secret-key
22
+ * that must be used in all other commands.
23
+ *
24
+ * Hint: you can use other test commands by setting the SCW_SECRET_KEY env
25
+ * variable.
26
+ *
27
+ * @param request - The request {@link RegisterRequest}
28
+ * @returns A Promise of RegisterResponse
29
+ */
30
+ register = request => this.client.fetch({
31
+ body: JSON.stringify(marshalRegisterRequest(request, this.client.settings)),
32
+ headers: jsonContentHeaders,
33
+ method: 'POST',
34
+ path: `/test/v1/register`
35
+ }, unmarshalRegisterResponse);
36
+ pageOfListHumans = (() => {
37
+ var _this = this;
38
+ return function (request) {
39
+ if (request === void 0) {
40
+ request = {};
41
+ }
42
+ return _this.client.fetch({
43
+ method: 'GET',
44
+ path: `/test/v1/humans`,
45
+ urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId])
46
+ }, unmarshalListHumansResponse);
47
+ };
48
+ })();
49
+
50
+ /**
51
+ * List all your humans.
52
+ *
53
+ * @param request - The request {@link ListHumansRequest}
54
+ * @returns A Promise of ListHumansResponse
55
+ */
56
+ listHumans = (() => {
57
+ var _this2 = this;
58
+ return function (request) {
59
+ if (request === void 0) {
60
+ request = {};
61
+ }
62
+ return enrichForPagination('humans', _this2.pageOfListHumans, request);
63
+ };
64
+ })();
65
+
66
+ /**
67
+ * Get human details. Get the human details associated with the given id.
68
+ *
69
+ * @param request - The request {@link GetHumanRequest}
70
+ * @returns A Promise of Human
71
+ */
72
+ getHuman = request => this.client.fetch({
73
+ method: 'GET',
74
+ path: `/test/v1/humans/${validatePathParam('humanId', request.humanId)}`
75
+ }, unmarshalHuman);
76
+
77
+ /**
78
+ * Waits for {@link Human} to be in a final state.
79
+ *
80
+ * @param request - The request {@link GetHumanRequest}
81
+ * @param options - The waiting options
82
+ * @returns A Promise of Human
83
+ */
84
+ waitForHuman = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HUMAN_TRANSIENT_STATUSES.includes(res.status))), this.getHuman, request, options);
85
+
86
+ /**
87
+ * Create a new human.
88
+ *
89
+ * @param request - The request {@link CreateHumanRequest}
90
+ * @returns A Promise of Human
91
+ */
92
+ createHuman = request => this.client.fetch({
93
+ body: JSON.stringify(marshalCreateHumanRequest(request, this.client.settings)),
94
+ headers: jsonContentHeaders,
95
+ method: 'POST',
96
+ path: `/test/v1/humans`
97
+ }, unmarshalHuman);
98
+
99
+ /**
100
+ * Update an existing human. Update the human associated with the given id.
101
+ *
102
+ * @param request - The request {@link UpdateHumanRequest}
103
+ * @returns A Promise of Human
104
+ */
105
+ updateHuman = request => this.client.fetch({
106
+ body: JSON.stringify(marshalUpdateHumanRequest(request, this.client.settings)),
107
+ headers: jsonContentHeaders,
108
+ method: 'PATCH',
109
+ path: `/test/v1/humans/${validatePathParam('humanId', request.humanId)}`
110
+ }, unmarshalHuman);
111
+
112
+ /**
113
+ * Delete an existing human. Delete the human associated with the given id.
114
+ *
115
+ * @param request - The request {@link DeleteHumanRequest}
116
+ * @returns A Promise of Human
117
+ */
118
+ deleteHuman = request => this.client.fetch({
119
+ method: 'DELETE',
120
+ path: `/test/v1/humans/${validatePathParam('humanId', request.humanId)}`
121
+ }, unmarshalHuman);
122
+
123
+ /**
124
+ * Start a 1h running for the given human. Start a one hour running for the
125
+ * given human.
126
+ *
127
+ * @param request - The request {@link RunHumanRequest}
128
+ * @returns A Promise of Human
129
+ */
130
+ runHuman = request => this.client.fetch({
131
+ body: '{}',
132
+ headers: jsonContentHeaders,
133
+ method: 'POST',
134
+ path: `/test/v1/humans/${validatePathParam('humanId', request.humanId)}/run`
135
+ }, unmarshalHuman);
136
+
137
+ /**
138
+ * Make a human smoke.
139
+ *
140
+ * @deprecated
141
+ * @param request - The request {@link SmokeHumanRequest}
142
+ * @returns A Promise of Human
143
+ */
144
+ smokeHuman = request => this.client.fetch({
145
+ body: '{}',
146
+ headers: jsonContentHeaders,
147
+ method: 'POST',
148
+ path: `/test/v1/humans/${validatePathParam('humanId', request.humanId)}/smoke`
149
+ }, unmarshalHuman);
150
+ }
151
+
152
+ export { API };
@@ -0,0 +1,7 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ /** Lists transient statutes of the enum {@link HumanStatus}. */
5
+ const HUMAN_TRANSIENT_STATUSES = ['running'];
6
+
7
+ export { HUMAN_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen.js';
2
+ export { HUMAN_TRANSIENT_STATUSES } from './content.gen.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,81 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalHuman = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'Human' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ altitudeInMeter: data.altitude_in_meter,
12
+ altitudeInMillimeter: data.altitude_in_millimeter,
13
+ createdAt: unmarshalDate(data.created_at),
14
+ eyesColor: data.eyes_color,
15
+ fingersCount: data.fingers_count,
16
+ hairCount: data.hair_count,
17
+ height: data.height,
18
+ id: data.id,
19
+ isHappy: data.is_happy,
20
+ name: data.name,
21
+ organizationId: data.organization_id,
22
+ projectId: data.project_id,
23
+ shoeSize: data.shoe_size,
24
+ status: data.status,
25
+ updatedAt: unmarshalDate(data.updated_at)
26
+ };
27
+ };
28
+ const unmarshalListHumansResponse = data => {
29
+ if (!isJSONObject(data)) {
30
+ throw new TypeError(`Unmarshalling the type 'ListHumansResponse' failed as data isn't a dictionary.`);
31
+ }
32
+ return {
33
+ humans: unmarshalArrayOfObject(data.humans, unmarshalHuman),
34
+ totalCount: data.total_count
35
+ };
36
+ };
37
+ const unmarshalRegisterResponse = data => {
38
+ if (!isJSONObject(data)) {
39
+ throw new TypeError(`Unmarshalling the type 'RegisterResponse' failed as data isn't a dictionary.`);
40
+ }
41
+ return {
42
+ accessKey: data.access_key,
43
+ secretKey: data.secret_key
44
+ };
45
+ };
46
+ const marshalCreateHumanRequest = (request, defaults) => ({
47
+ altitude_in_meter: request.altitudeInMeter,
48
+ altitude_in_millimeter: request.altitudeInMillimeter,
49
+ eyes_color: request.eyesColor,
50
+ fingers_count: request.fingersCount,
51
+ hair_count: request.hairCount,
52
+ height: request.height,
53
+ is_happy: request.isHappy,
54
+ name: request.name,
55
+ shoe_size: request.shoeSize,
56
+ ...resolveOneOf([{
57
+ default: defaults.defaultOrganizationId,
58
+ param: 'organization_id',
59
+ value: request.organizationId
60
+ }, {
61
+ default: defaults.defaultProjectId,
62
+ param: 'project_id',
63
+ value: request.projectId
64
+ }])
65
+ });
66
+ const marshalRegisterRequest = (request, defaults) => ({
67
+ username: request.username
68
+ });
69
+ const marshalUpdateHumanRequest = (request, defaults) => ({
70
+ altitude_in_meter: request.altitudeInMeter,
71
+ altitude_in_millimeter: request.altitudeInMillimeter,
72
+ eyes_color: request.eyesColor,
73
+ fingers_count: request.fingersCount,
74
+ hair_count: request.hairCount,
75
+ height: request.height,
76
+ is_happy: request.isHappy,
77
+ name: request.name,
78
+ shoe_size: request.shoeSize
79
+ });
80
+
81
+ export { marshalCreateHumanRequest, marshalRegisterRequest, marshalUpdateHumanRequest, unmarshalHuman, unmarshalListHumansResponse, unmarshalRegisterResponse };
@@ -0,0 +1,4 @@
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };
3
+ import * as index_gen$1 from './v2/index.gen.js';
4
+ export { index_gen$1 as v2 };