@scaleway/sdk-mailbox 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ https://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2019 Scaleway.
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ https://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-mailbox
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-mailbox.svg)](https://www.npmjs.com/package/@scaleway/sdk-mailbox)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-mailbox.svg)](https://www.npmjs.com/package/@scaleway/sdk-mailbox)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-mailbox.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Mailbox API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-mailbox @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-mailbox @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-mailbox @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Mailbox } from '@scaleway/sdk-mailbox'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Mailbox.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Mailbox } from '@scaleway/sdk-mailbox'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Mailbox.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Mailbox API Documentation](https://www.scaleway.com/en/developers/api/mailbox/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+
87
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
88
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
89
+
90
+ ## Contributing
91
+
92
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
93
+
94
+ ## License
95
+
96
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __exportAll = (all, no_symbols) => {
3
+ let target = {};
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
9
+ return target;
10
+ };
11
+ export { __exportAll };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file is automatically generated
3
+ * PLEASE DO NOT EDIT HERE
4
+ */
5
+ export * as Mailboxv1alpha1 from './v1alpha1/index.gen.js';
@@ -0,0 +1,2 @@
1
+ import { index_gen_exports } from "./v1alpha1/index.gen.js";
2
+ export { index_gen_exports as Mailboxv1alpha1 };
@@ -0,0 +1,106 @@
1
+ import type { WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { BatchCreateMailboxesRequest, BatchCreateMailboxesResponse, CreateDomainRequest, DeleteDomainRequest, DeleteMailboxRequest, Domain, GetDomainRecordsRequest, GetDomainRecordsResponse, GetDomainRequest, GetMailboxRequest, ListDomainsRequest, ListDomainsResponse, ListMailboxesRequest, ListMailboxesResponse, Mailbox, RestoreMailboxRequest, UpdateMailboxRequest, ValidateDomainRecordsRequest } from './types.gen.js';
4
+ /**
5
+ * Mailbox API.
6
+
7
+ This API allows you to manage your Mailbox services.
8
+ */
9
+ export declare class API extends ParentAPI {
10
+ /**
11
+ * Register a domain in a project.. You must specify a `project_id` and a `domain_name` to register a domain in a specific Project.
12
+ *
13
+ * @param request - The request {@link CreateDomainRequest}
14
+ * @returns A Promise of Domain
15
+ */
16
+ createDomain: (request: Readonly<CreateDomainRequest>) => Promise<Domain>;
17
+ protected pageOfListDomains: (request?: Readonly<ListDomainsRequest>) => Promise<ListDomainsResponse>;
18
+ /**
19
+ * List domains in an organization.. The return list can be filtered with request parameters.
20
+ *
21
+ * @param request - The request {@link ListDomainsRequest}
22
+ * @returns A Promise of ListDomainsResponse
23
+ */
24
+ listDomains: (request?: Readonly<ListDomainsRequest>) => Promise<ListDomainsResponse> & {
25
+ all: () => Promise<Domain[]>;
26
+ [Symbol.asyncIterator]: () => AsyncGenerator<Domain[], void, void>;
27
+ };
28
+ /**
29
+ * Get a domain by its ID.. Get a domain by its ID.
30
+ *
31
+ * @param request - The request {@link GetDomainRequest}
32
+ * @returns A Promise of Domain
33
+ */
34
+ getDomain: (request: Readonly<GetDomainRequest>) => Promise<Domain>;
35
+ /**
36
+ * Waits for {@link Domain} to be in a final state.
37
+ *
38
+ * @param request - The request {@link GetDomainRequest}
39
+ * @param options - The waiting options
40
+ * @returns A Promise of Domain
41
+ */
42
+ waitForDomain: (request: Readonly<GetDomainRequest>, options?: Readonly<WaitForOptions<Domain>>) => Promise<Domain>;
43
+ /**
44
+ * Delete a domain by its ID.. Delete a domain by its ID.
45
+ *
46
+ * @param request - The request {@link DeleteDomainRequest}
47
+ * @returns A Promise of Domain
48
+ */
49
+ deleteDomain: (request: Readonly<DeleteDomainRequest>) => Promise<Domain>;
50
+ /**
51
+ * Get domain records by its ID.. Get domain records by its ID.
52
+ *
53
+ * @param request - The request {@link GetDomainRecordsRequest}
54
+ * @returns A Promise of GetDomainRecordsResponse
55
+ */
56
+ getDomainRecords: (request: Readonly<GetDomainRecordsRequest>) => Promise<GetDomainRecordsResponse>;
57
+ validateDomainRecords: (request: Readonly<ValidateDomainRecordsRequest>) => Promise<void>;
58
+ batchCreateMailboxes: (request: Readonly<BatchCreateMailboxesRequest>) => Promise<BatchCreateMailboxesResponse>;
59
+ protected pageOfListMailboxes: (request?: Readonly<ListMailboxesRequest>) => Promise<ListMailboxesResponse>;
60
+ /**
61
+ * List mailboxes in an organization.. The return list can be filtered with request parameters.
62
+ *
63
+ * @param request - The request {@link ListMailboxesRequest}
64
+ * @returns A Promise of ListMailboxesResponse
65
+ */
66
+ listMailboxes: (request?: Readonly<ListMailboxesRequest>) => Promise<ListMailboxesResponse> & {
67
+ all: () => Promise<Mailbox[]>;
68
+ [Symbol.asyncIterator]: () => AsyncGenerator<Mailbox[], void, void>;
69
+ };
70
+ /**
71
+ * Get a mailbox by its ID.. Get a mailbox by its ID.
72
+ *
73
+ * @param request - The request {@link GetMailboxRequest}
74
+ * @returns A Promise of Mailbox
75
+ */
76
+ getMailbox: (request: Readonly<GetMailboxRequest>) => Promise<Mailbox>;
77
+ /**
78
+ * Waits for {@link Mailbox} to be in a final state.
79
+ *
80
+ * @param request - The request {@link GetMailboxRequest}
81
+ * @param options - The waiting options
82
+ * @returns A Promise of Mailbox
83
+ */
84
+ waitForMailbox: (request: Readonly<GetMailboxRequest>, options?: Readonly<WaitForOptions<Mailbox>>) => Promise<Mailbox>;
85
+ /**
86
+ * Update a mailbox name, recovery email, subscription period or password with its ID.. Update a mailbox name, recovery email, subscription period or password with its ID.
87
+ *
88
+ * @param request - The request {@link UpdateMailboxRequest}
89
+ * @returns A Promise of Mailbox
90
+ */
91
+ updateMailbox: (request: Readonly<UpdateMailboxRequest>) => Promise<Mailbox>;
92
+ /**
93
+ * Delete a mailbox by its ID.. Delete a mailbox by its ID.
94
+ *
95
+ * @param request - The request {@link DeleteMailboxRequest}
96
+ * @returns A Promise of Mailbox
97
+ */
98
+ deleteMailbox: (request: Readonly<DeleteMailboxRequest>) => Promise<Mailbox>;
99
+ /**
100
+ * Restore a mailbox in deletion scheduled status by its ID.. Restore a mailbox in deletion scheduled status by its ID.
101
+ *
102
+ * @param request - The request {@link RestoreMailboxRequest}
103
+ * @returns A Promise of Mailbox
104
+ */
105
+ restoreMailbox: (request: Readonly<RestoreMailboxRequest>) => Promise<Mailbox>;
106
+ }
@@ -0,0 +1,150 @@
1
+ import { DOMAIN_TRANSIENT_STATUSES, MAILBOX_TRANSIENT_STATUSES } from "./content.gen.js";
2
+ import { marshalBatchCreateMailboxesRequest, marshalCreateDomainRequest, marshalUpdateMailboxRequest, unmarshalBatchCreateMailboxesResponse, unmarshalDomain, unmarshalGetDomainRecordsResponse, unmarshalListDomainsResponse, unmarshalListMailboxesResponse, unmarshalMailbox } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Mailbox API.
7
+
8
+ This API allows you to manage your Mailbox services.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Register a domain in a project.. You must specify a `project_id` and a `domain_name` to register a domain in a specific Project.
13
+ *
14
+ * @param request - The request {@link CreateDomainRequest}
15
+ * @returns A Promise of Domain
16
+ */
17
+ createDomain = (request) => this.client.fetch({
18
+ body: JSON.stringify(marshalCreateDomainRequest(request, this.client.settings)),
19
+ headers: jsonContentHeaders,
20
+ method: "POST",
21
+ path: `/mailbox/v1alpha1/domains`
22
+ }, unmarshalDomain);
23
+ pageOfListDomains = (request = {}) => this.client.fetch({
24
+ method: "GET",
25
+ path: `/mailbox/v1alpha1/domains`,
26
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["search", request.search], ["statuses", request.statuses])
27
+ }, unmarshalListDomainsResponse);
28
+ /**
29
+ * List domains in an organization.. The return list can be filtered with request parameters.
30
+ *
31
+ * @param request - The request {@link ListDomainsRequest}
32
+ * @returns A Promise of ListDomainsResponse
33
+ */
34
+ listDomains = (request = {}) => enrichForPagination("domains", this.pageOfListDomains, request);
35
+ /**
36
+ * Get a domain by its ID.. Get a domain by its ID.
37
+ *
38
+ * @param request - The request {@link GetDomainRequest}
39
+ * @returns A Promise of Domain
40
+ */
41
+ getDomain = (request) => this.client.fetch({
42
+ method: "GET",
43
+ path: `/mailbox/v1alpha1/domains/${validatePathParam("domainId", request.domainId)}`
44
+ }, unmarshalDomain);
45
+ /**
46
+ * Waits for {@link Domain} to be in a final state.
47
+ *
48
+ * @param request - The request {@link GetDomainRequest}
49
+ * @param options - The waiting options
50
+ * @returns A Promise of Domain
51
+ */
52
+ waitForDomain = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
53
+ /**
54
+ * Delete a domain by its ID.. Delete a domain by its ID.
55
+ *
56
+ * @param request - The request {@link DeleteDomainRequest}
57
+ * @returns A Promise of Domain
58
+ */
59
+ deleteDomain = (request) => this.client.fetch({
60
+ method: "DELETE",
61
+ path: `/mailbox/v1alpha1/domains/${validatePathParam("domainId", request.domainId)}`
62
+ }, unmarshalDomain);
63
+ /**
64
+ * Get domain records by its ID.. Get domain records by its ID.
65
+ *
66
+ * @param request - The request {@link GetDomainRecordsRequest}
67
+ * @returns A Promise of GetDomainRecordsResponse
68
+ */
69
+ getDomainRecords = (request) => this.client.fetch({
70
+ method: "GET",
71
+ path: `/mailbox/v1alpha1/domains/${validatePathParam("domainId", request.domainId)}/records`
72
+ }, unmarshalGetDomainRecordsResponse);
73
+ validateDomainRecords = (request) => this.client.fetch({
74
+ body: "{}",
75
+ headers: jsonContentHeaders,
76
+ method: "POST",
77
+ path: `/mailbox/v1alpha1/domains/${validatePathParam("domainId", request.domainId)}/validate-records`
78
+ });
79
+ batchCreateMailboxes = (request) => this.client.fetch({
80
+ body: JSON.stringify(marshalBatchCreateMailboxesRequest(request, this.client.settings)),
81
+ headers: jsonContentHeaders,
82
+ method: "POST",
83
+ path: `/mailbox/v1alpha1/batch-create-mailboxes`
84
+ }, unmarshalBatchCreateMailboxesResponse);
85
+ pageOfListMailboxes = (request = {}) => this.client.fetch({
86
+ method: "GET",
87
+ path: `/mailbox/v1alpha1/mailboxes`,
88
+ urlParams: urlParams(["domain_id", request.domainId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["search", request.search], ["statuses", request.statuses])
89
+ }, unmarshalListMailboxesResponse);
90
+ /**
91
+ * List mailboxes in an organization.. The return list can be filtered with request parameters.
92
+ *
93
+ * @param request - The request {@link ListMailboxesRequest}
94
+ * @returns A Promise of ListMailboxesResponse
95
+ */
96
+ listMailboxes = (request = {}) => enrichForPagination("mailboxes", this.pageOfListMailboxes, request);
97
+ /**
98
+ * Get a mailbox by its ID.. Get a mailbox by its ID.
99
+ *
100
+ * @param request - The request {@link GetMailboxRequest}
101
+ * @returns A Promise of Mailbox
102
+ */
103
+ getMailbox = (request) => this.client.fetch({
104
+ method: "GET",
105
+ path: `/mailbox/v1alpha1/mailboxes/${validatePathParam("mailboxId", request.mailboxId)}`
106
+ }, unmarshalMailbox);
107
+ /**
108
+ * Waits for {@link Mailbox} to be in a final state.
109
+ *
110
+ * @param request - The request {@link GetMailboxRequest}
111
+ * @param options - The waiting options
112
+ * @returns A Promise of Mailbox
113
+ */
114
+ waitForMailbox = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!MAILBOX_TRANSIENT_STATUSES.includes(res.status))), this.getMailbox, request, options);
115
+ /**
116
+ * Update a mailbox name, recovery email, subscription period or password with its ID.. Update a mailbox name, recovery email, subscription period or password with its ID.
117
+ *
118
+ * @param request - The request {@link UpdateMailboxRequest}
119
+ * @returns A Promise of Mailbox
120
+ */
121
+ updateMailbox = (request) => this.client.fetch({
122
+ body: JSON.stringify(marshalUpdateMailboxRequest(request, this.client.settings)),
123
+ headers: jsonContentHeaders,
124
+ method: "PATCH",
125
+ path: `/mailbox/v1alpha1/mailboxes/${validatePathParam("mailboxId", request.mailboxId)}`
126
+ }, unmarshalMailbox);
127
+ /**
128
+ * Delete a mailbox by its ID.. Delete a mailbox by its ID.
129
+ *
130
+ * @param request - The request {@link DeleteMailboxRequest}
131
+ * @returns A Promise of Mailbox
132
+ */
133
+ deleteMailbox = (request) => this.client.fetch({
134
+ method: "DELETE",
135
+ path: `/mailbox/v1alpha1/mailboxes/${validatePathParam("mailboxId", request.mailboxId)}`
136
+ }, unmarshalMailbox);
137
+ /**
138
+ * Restore a mailbox in deletion scheduled status by its ID.. Restore a mailbox in deletion scheduled status by its ID.
139
+ *
140
+ * @param request - The request {@link RestoreMailboxRequest}
141
+ * @returns A Promise of Mailbox
142
+ */
143
+ restoreMailbox = (request) => this.client.fetch({
144
+ body: "{}",
145
+ headers: jsonContentHeaders,
146
+ method: "POST",
147
+ path: `/mailbox/v1alpha1/mailboxes/${validatePathParam("mailboxId", request.mailboxId)}/restore`
148
+ }, unmarshalMailbox);
149
+ };
150
+ export { API$1 as API };
@@ -0,0 +1,7 @@
1
+ import type { DomainRecordStatus, DomainStatus, MailboxStatus } from './types.gen.js';
2
+ /** Lists transient statutes of the enum {@link DomainRecordStatus}. */
3
+ export declare const DOMAIN_RECORD_TRANSIENT_STATUSES: DomainRecordStatus[];
4
+ /** Lists transient statutes of the enum {@link DomainStatus}. */
5
+ export declare const DOMAIN_TRANSIENT_STATUSES: DomainStatus[];
6
+ /** Lists transient statutes of the enum {@link MailboxStatus}. */
7
+ export declare const MAILBOX_TRANSIENT_STATUSES: MailboxStatus[];
@@ -0,0 +1,19 @@
1
+ /** Lists transient statutes of the enum {@link DomainRecordStatus}. */
2
+ const DOMAIN_RECORD_TRANSIENT_STATUSES = ["validating"];
3
+ /** Lists transient statutes of the enum {@link DomainStatus}. */
4
+ const DOMAIN_TRANSIENT_STATUSES = [
5
+ "creating",
6
+ "validating",
7
+ "provisioning",
8
+ "deleting"
9
+ ];
10
+ /** Lists transient statutes of the enum {@link MailboxStatus}. */
11
+ const MAILBOX_TRANSIENT_STATUSES = [
12
+ "creating",
13
+ "waiting_payment",
14
+ "waiting_domain",
15
+ "renewing",
16
+ "deleting",
17
+ "restoring"
18
+ ];
19
+ export { DOMAIN_RECORD_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, MAILBOX_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API, } from './api.gen.js';
2
+ export * from './content.gen.js';
3
+ export * from './marshalling.gen.js';
4
+ export type { BatchCreateMailboxesRequest, BatchCreateMailboxesRequestMailboxParameters, BatchCreateMailboxesResponse, CreateDomainRequest, DeleteDomainRequest, DeleteMailboxRequest, Domain, DomainRecord, DomainRecordDNSType, DomainRecordLevel, DomainRecordStatus, DomainStatus, GetDomainRecordsRequest, GetDomainRecordsResponse, GetDomainRequest, GetMailboxRequest, ListDomainsRequest, ListDomainsRequestOrderBy, ListDomainsResponse, ListMailboxesRequest, ListMailboxesRequestOrderBy, ListMailboxesResponse, Mailbox, MailboxStatus, MailboxSubscriptionPeriod, RestoreMailboxRequest, UpdateMailboxRequest, ValidateDomainRecordsRequest, } from './types.gen.js';
5
+ export * as ValidationRules from './validation-rules.gen.js';
@@ -0,0 +1,22 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { DOMAIN_RECORD_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, MAILBOX_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { marshalBatchCreateMailboxesRequest, marshalCreateDomainRequest, marshalUpdateMailboxRequest, unmarshalBatchCreateMailboxesResponse, unmarshalDomain, unmarshalGetDomainRecordsResponse, unmarshalListDomainsResponse, unmarshalListMailboxesResponse, unmarshalMailbox } from "./marshalling.gen.js";
4
+ import { API } from "./api.gen.js";
5
+ import { validation_rules_gen_exports } from "./validation-rules.gen.js";
6
+ var index_gen_exports = /* @__PURE__ */ __exportAll({
7
+ API: () => API,
8
+ DOMAIN_RECORD_TRANSIENT_STATUSES: () => DOMAIN_RECORD_TRANSIENT_STATUSES,
9
+ DOMAIN_TRANSIENT_STATUSES: () => DOMAIN_TRANSIENT_STATUSES,
10
+ MAILBOX_TRANSIENT_STATUSES: () => MAILBOX_TRANSIENT_STATUSES,
11
+ ValidationRules: () => validation_rules_gen_exports,
12
+ marshalBatchCreateMailboxesRequest: () => marshalBatchCreateMailboxesRequest,
13
+ marshalCreateDomainRequest: () => marshalCreateDomainRequest,
14
+ marshalUpdateMailboxRequest: () => marshalUpdateMailboxRequest,
15
+ unmarshalBatchCreateMailboxesResponse: () => unmarshalBatchCreateMailboxesResponse,
16
+ unmarshalDomain: () => unmarshalDomain,
17
+ unmarshalGetDomainRecordsResponse: () => unmarshalGetDomainRecordsResponse,
18
+ unmarshalListDomainsResponse: () => unmarshalListDomainsResponse,
19
+ unmarshalListMailboxesResponse: () => unmarshalListMailboxesResponse,
20
+ unmarshalMailbox: () => unmarshalMailbox
21
+ });
22
+ export { index_gen_exports };
@@ -0,0 +1,11 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { BatchCreateMailboxesRequest, BatchCreateMailboxesResponse, CreateDomainRequest, Domain, GetDomainRecordsResponse, ListDomainsResponse, ListMailboxesResponse, Mailbox, UpdateMailboxRequest } from './types.gen.js';
3
+ export declare const unmarshalMailbox: (data: unknown) => Mailbox;
4
+ export declare const unmarshalDomain: (data: unknown) => Domain;
5
+ export declare const unmarshalBatchCreateMailboxesResponse: (data: unknown) => BatchCreateMailboxesResponse;
6
+ export declare const unmarshalGetDomainRecordsResponse: (data: unknown) => GetDomainRecordsResponse;
7
+ export declare const unmarshalListDomainsResponse: (data: unknown) => ListDomainsResponse;
8
+ export declare const unmarshalListMailboxesResponse: (data: unknown) => ListMailboxesResponse;
9
+ export declare const marshalBatchCreateMailboxesRequest: (request: BatchCreateMailboxesRequest, defaults: DefaultValues) => Record<string, unknown>;
10
+ export declare const marshalCreateDomainRequest: (request: CreateDomainRequest, defaults: DefaultValues) => Record<string, unknown>;
11
+ export declare const marshalUpdateMailboxRequest: (request: UpdateMailboxRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,109 @@
1
+ import { isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ const unmarshalMailbox = (data) => {
3
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Mailbox' failed as data isn't a dictionary.`);
4
+ return {
5
+ createdAt: unmarshalDate(data.created_at),
6
+ deletionScheduledAt: unmarshalDate(data.deletion_scheduled_at),
7
+ displayName: data.display_name,
8
+ domainId: data.domain_id,
9
+ email: data.email,
10
+ id: data.id,
11
+ nextSubscriptionPeriod: data.next_subscription_period,
12
+ nextSubscriptionPeriodStartsAt: unmarshalDate(data.next_subscription_period_starts_at),
13
+ recoveryEmail: data.recovery_email,
14
+ status: data.status,
15
+ subscriptionPeriod: data.subscription_period,
16
+ subscriptionPeriodStartedAt: unmarshalDate(data.subscription_period_started_at),
17
+ updatedAt: unmarshalDate(data.updated_at)
18
+ };
19
+ };
20
+ const unmarshalDomain = (data) => {
21
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Domain' failed as data isn't a dictionary.`);
22
+ return {
23
+ createdAt: unmarshalDate(data.created_at),
24
+ id: data.id,
25
+ imapUrl: data.imap_url,
26
+ jmapUrl: data.jmap_url,
27
+ mailboxTotalCount: data.mailbox_total_count,
28
+ name: data.name,
29
+ pop3Url: data.pop3_url,
30
+ projectId: data.project_id,
31
+ smtpUrl: data.smtp_url,
32
+ status: data.status,
33
+ updatedAt: unmarshalDate(data.updated_at),
34
+ webmailUrl: data.webmail_url
35
+ };
36
+ };
37
+ const unmarshalBatchCreateMailboxesResponse = (data) => {
38
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BatchCreateMailboxesResponse' failed as data isn't a dictionary.`);
39
+ return { mailboxes: unmarshalArrayOfObject(data.mailboxes, unmarshalMailbox) };
40
+ };
41
+ var unmarshalDomainRecord = (data) => {
42
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DomainRecord' failed as data isn't a dictionary.`);
43
+ return {
44
+ createdAt: unmarshalDate(data.created_at),
45
+ dnsName: data.dns_name,
46
+ dnsType: data.dns_type,
47
+ dnsValue: data.dns_value,
48
+ domainId: data.domain_id,
49
+ error: data.error,
50
+ id: data.id,
51
+ level: data.level,
52
+ status: data.status,
53
+ updatedAt: unmarshalDate(data.updated_at)
54
+ };
55
+ };
56
+ const unmarshalGetDomainRecordsResponse = (data) => {
57
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetDomainRecordsResponse' failed as data isn't a dictionary.`);
58
+ return {
59
+ autoconfig: data.autoconfig ? unmarshalDomainRecord(data.autoconfig) : void 0,
60
+ autodiscover: data.autodiscover ? unmarshalDomainRecord(data.autodiscover) : void 0,
61
+ caldav: data.caldav ? unmarshalDomainRecord(data.caldav) : void 0,
62
+ carddav: data.carddav ? unmarshalDomainRecord(data.carddav) : void 0,
63
+ dkim: data.dkim ? unmarshalDomainRecord(data.dkim) : void 0,
64
+ dmarc: data.dmarc ? unmarshalDomainRecord(data.dmarc) : void 0,
65
+ domainValidation: data.domain_validation ? unmarshalDomainRecord(data.domain_validation) : void 0,
66
+ imap: data.imap ? unmarshalDomainRecord(data.imap) : void 0,
67
+ jmap: data.jmap ? unmarshalDomainRecord(data.jmap) : void 0,
68
+ mx: data.mx ? unmarshalDomainRecord(data.mx) : void 0,
69
+ pop3: data.pop3 ? unmarshalDomainRecord(data.pop3) : void 0,
70
+ spf: data.spf ? unmarshalDomainRecord(data.spf) : void 0,
71
+ submission: data.submission ? unmarshalDomainRecord(data.submission) : void 0
72
+ };
73
+ };
74
+ const unmarshalListDomainsResponse = (data) => {
75
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`);
76
+ return {
77
+ domains: unmarshalArrayOfObject(data.domains, unmarshalDomain),
78
+ totalCount: data.total_count
79
+ };
80
+ };
81
+ const unmarshalListMailboxesResponse = (data) => {
82
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListMailboxesResponse' failed as data isn't a dictionary.`);
83
+ return {
84
+ mailboxes: unmarshalArrayOfObject(data.mailboxes, unmarshalMailbox),
85
+ totalCount: data.total_count
86
+ };
87
+ };
88
+ var marshalBatchCreateMailboxesRequestMailboxParameters = (request, defaults) => ({
89
+ display_name: request.displayName,
90
+ local_part: request.localPart,
91
+ password: request.password,
92
+ recovery_email: request.recoveryEmail
93
+ });
94
+ const marshalBatchCreateMailboxesRequest = (request, defaults) => ({
95
+ domain_id: request.domainId,
96
+ mailboxes: request.mailboxes !== void 0 ? request.mailboxes.map((elt) => marshalBatchCreateMailboxesRequestMailboxParameters(elt, defaults)) : void 0,
97
+ subscription_period: request.subscriptionPeriod
98
+ });
99
+ const marshalCreateDomainRequest = (request, defaults) => ({
100
+ name: request.name,
101
+ project_id: request.projectId ?? defaults.defaultProjectId
102
+ });
103
+ const marshalUpdateMailboxRequest = (request, defaults) => ({
104
+ display_name: request.displayName,
105
+ new_password: request.newPassword,
106
+ recovery_email: request.recoveryEmail,
107
+ subscription_period: request.subscriptionPeriod
108
+ });
109
+ export { marshalBatchCreateMailboxesRequest, marshalCreateDomainRequest, marshalUpdateMailboxRequest, unmarshalBatchCreateMailboxesResponse, unmarshalDomain, unmarshalGetDomainRecordsResponse, unmarshalListDomainsResponse, unmarshalListMailboxesResponse, unmarshalMailbox };
@@ -0,0 +1,359 @@
1
+ export type DomainRecordDNSType = 'unknown_dns_type' | 'cname_dns_type' | 'mx_dns_type' | 'srv_dns_type' | 'txt_dns_type';
2
+ export type DomainRecordLevel = 'unknown_level' | 'required' | 'recommended' | 'optional';
3
+ export type DomainRecordStatus = 'unknown_status' | 'validating' | 'valid' | 'invalid' | 'not_found';
4
+ export type DomainStatus = 'unknown_status' | 'creating' | 'waiting_validation' | 'validating' | 'validation_failed' | 'provisioning' | 'ready' | 'deleting';
5
+ export type ListDomainsRequestOrderBy = 'created_at_desc' | 'created_at_asc' | 'updated_at_desc' | 'updated_at_asc' | 'name_desc' | 'name_asc' | 'mailbox_total_count_desc' | 'mailbox_total_count_asc';
6
+ export type ListMailboxesRequestOrderBy = 'created_at_desc' | 'created_at_asc' | 'updated_at_desc' | 'updated_at_asc' | 'email_desc' | 'email_asc';
7
+ export type MailboxStatus = 'unknown_status' | 'creating' | 'waiting_payment' | 'waiting_domain' | 'ready' | 'deletion_scheduled' | 'locked' | 'renewing' | 'deleting' | 'restoring' | 'payment_failed';
8
+ export type MailboxSubscriptionPeriod = 'unknown_subscription_period' | 'canceled' | 'monthly' | 'yearly';
9
+ export interface BatchCreateMailboxesRequestMailboxParameters {
10
+ localPart: string;
11
+ password: string;
12
+ displayName?: string;
13
+ recoveryEmail?: string;
14
+ }
15
+ export interface Mailbox {
16
+ /**
17
+ * Unique identifier of the mailbox.
18
+ */
19
+ id: string;
20
+ /**
21
+ * ID of the domain to which the mailbox belongs.
22
+ */
23
+ domainId: string;
24
+ /**
25
+ * Name of the mailbox.
26
+ */
27
+ displayName: string;
28
+ /**
29
+ * Email address of the mailbox as local_part@domain.
30
+ */
31
+ email: string;
32
+ /**
33
+ * Recovery email for the mailbox.
34
+ */
35
+ recoveryEmail: string;
36
+ /**
37
+ * Status of the mailbox.
38
+ */
39
+ status: MailboxStatus;
40
+ /**
41
+ * Subscription renewal period, it can be monthly, yearly or canceled if the subscription has been canceled.
42
+ */
43
+ subscriptionPeriod: MailboxSubscriptionPeriod;
44
+ /**
45
+ * Date and time of subscription period start.
46
+ */
47
+ subscriptionPeriodStartedAt?: Date;
48
+ /**
49
+ * Next subscription renewal period, it can be monthly or yearly or canceled if the subscription has been canceled.
50
+ */
51
+ nextSubscriptionPeriod: MailboxSubscriptionPeriod;
52
+ /**
53
+ * Date and time when the next subscription period starts.
54
+ */
55
+ nextSubscriptionPeriodStartsAt?: Date;
56
+ /**
57
+ * Date and time of mailbox creation.
58
+ */
59
+ createdAt?: Date;
60
+ /**
61
+ * Date and time when the mailbox was last updated.
62
+ */
63
+ updatedAt?: Date;
64
+ /**
65
+ * Date and time of the unrecoverable mailbox deletion.
66
+ */
67
+ deletionScheduledAt?: Date;
68
+ }
69
+ export interface DomainRecord {
70
+ /**
71
+ * Unique identifier of the DNS record.
72
+ */
73
+ id: string;
74
+ /**
75
+ * ID of the domain to which the record belongs.
76
+ */
77
+ domainId: string;
78
+ /**
79
+ * Status of the record.
80
+ */
81
+ status: DomainRecordStatus;
82
+ /**
83
+ * Level of requirement of the record.
84
+ */
85
+ level: DomainRecordLevel;
86
+ /**
87
+ * DNS type of the record.
88
+ */
89
+ dnsType: DomainRecordDNSType;
90
+ /**
91
+ * DNS name of the record.
92
+ */
93
+ dnsName: string;
94
+ /**
95
+ * DNS value of the record.
96
+ */
97
+ dnsValue: string;
98
+ /**
99
+ * Error associated in case the record is not valid.
100
+ */
101
+ error?: string;
102
+ /**
103
+ * Date and time of record creation.
104
+ */
105
+ createdAt?: Date;
106
+ /**
107
+ * Date and time of record last updated.
108
+ */
109
+ updatedAt?: Date;
110
+ }
111
+ export interface Domain {
112
+ /**
113
+ * Unique identifier of the domain.
114
+ */
115
+ id: string;
116
+ /**
117
+ * ID of the Project to which the domain belongs.
118
+ */
119
+ projectId: string;
120
+ /**
121
+ * Fully qualified domain name.
122
+ */
123
+ name: string;
124
+ /**
125
+ * Status of the domain.
126
+ */
127
+ status: DomainStatus;
128
+ /**
129
+ * Number of mailboxes of the domain.
130
+ */
131
+ mailboxTotalCount: number;
132
+ /**
133
+ * Date and time of domain creation.
134
+ */
135
+ createdAt?: Date;
136
+ /**
137
+ * Date and time of the domain's last update.
138
+ */
139
+ updatedAt?: Date;
140
+ /**
141
+ * URL of the domain's webmail.
142
+ */
143
+ webmailUrl: string;
144
+ /**
145
+ * URL of the domain's IMAP service.
146
+ */
147
+ imapUrl: string;
148
+ /**
149
+ * URL of the domain's JMAP service.
150
+ */
151
+ jmapUrl: string;
152
+ /**
153
+ * URL of the domain's POP3 service.
154
+ */
155
+ pop3Url: string;
156
+ /**
157
+ * URL of the domain's SMTP service.
158
+ */
159
+ smtpUrl: string;
160
+ }
161
+ export type BatchCreateMailboxesRequest = {
162
+ /**
163
+ * Parameters for the mailboxes to create.
164
+ */
165
+ mailboxes?: BatchCreateMailboxesRequestMailboxParameters[];
166
+ /**
167
+ * ID of the domain in which to create the mailboxes.
168
+ */
169
+ domainId: string;
170
+ /**
171
+ * Subscription renewal period, it can be monthly or yearly.
172
+ */
173
+ subscriptionPeriod?: MailboxSubscriptionPeriod;
174
+ };
175
+ export interface BatchCreateMailboxesResponse {
176
+ /**
177
+ * Mailboxes created.
178
+ */
179
+ mailboxes: Mailbox[];
180
+ }
181
+ export type CreateDomainRequest = {
182
+ /**
183
+ * ID of the project to which the domain belongs.
184
+ */
185
+ projectId?: string;
186
+ /**
187
+ * Fully qualified domain name.
188
+ */
189
+ name: string;
190
+ };
191
+ export type DeleteDomainRequest = {
192
+ /**
193
+ * ID of the domain to delete.
194
+ */
195
+ domainId: string;
196
+ };
197
+ export type DeleteMailboxRequest = {
198
+ /**
199
+ * ID of the mailbox to delete.
200
+ */
201
+ mailboxId: string;
202
+ };
203
+ export type GetDomainRecordsRequest = {
204
+ /**
205
+ * (Optional) ID of the domain in which to get the records.
206
+ */
207
+ domainId: string;
208
+ };
209
+ export interface GetDomainRecordsResponse {
210
+ /**
211
+ * Record designed to automatically configure an email client with the appropriate mail server settings using a standardized XML file format.
212
+ */
213
+ autoconfig?: DomainRecord;
214
+ /**
215
+ * Record designed to automate the discovery of server settings to configure email clients like Outlook.
216
+ */
217
+ autodiscover?: DomainRecord;
218
+ /**
219
+ * Record that allows clients to interact with calendar data stored on a server.
220
+ */
221
+ caldav?: DomainRecord;
222
+ /**
223
+ * Record that allows clients to interact with contact data stored on a server.
224
+ */
225
+ carddav?: DomainRecord;
226
+ /**
227
+ * Record that allows the DKIM email authentication method to be employed to verify the authenticity of an email message.
228
+ */
229
+ dkim?: DomainRecord;
230
+ /**
231
+ * Record that provides a mechanism for email receivers to determine if incoming messages are legitimate and were sent from authorized sources.
232
+ */
233
+ dmarc?: DomainRecord;
234
+ /**
235
+ * Record that provides a unique token to validate a domain ownership.
236
+ */
237
+ domainValidation?: DomainRecord;
238
+ /**
239
+ * Record that allows accessing the mailbox with the IMAP protocol.
240
+ */
241
+ imap?: DomainRecord;
242
+ /**
243
+ * Record that allows accessing the mailbox with the JMAP protocol.
244
+ */
245
+ jmap?: DomainRecord;
246
+ /**
247
+ * Record that directs emails to a mail server.
248
+ */
249
+ mx?: DomainRecord;
250
+ /**
251
+ * Record that allows accessing the mailbox with the POP3 protocol.
252
+ */
253
+ pop3?: DomainRecord;
254
+ /**
255
+ * Record that lists all the servers authorized to send emails from a particular domain.
256
+ */
257
+ spf?: DomainRecord;
258
+ /**
259
+ * Record that allows the use of the SMTP submission mechanism.
260
+ */
261
+ submission?: DomainRecord;
262
+ }
263
+ export type GetDomainRequest = {
264
+ /**
265
+ * ID of the domain to get.
266
+ */
267
+ domainId: string;
268
+ };
269
+ export type GetMailboxRequest = {
270
+ /**
271
+ * ID of the mailbox to get.
272
+ */
273
+ mailboxId: string;
274
+ };
275
+ export type ListDomainsRequest = {
276
+ orderBy?: ListDomainsRequestOrderBy;
277
+ page?: number;
278
+ pageSize?: number;
279
+ projectId?: string;
280
+ statuses?: DomainStatus[];
281
+ search?: string;
282
+ };
283
+ export interface ListDomainsResponse {
284
+ /**
285
+ * Number of domains that match the request (without pagination).
286
+ */
287
+ totalCount: number;
288
+ /**
289
+ * Single page of domains matching the requested criteria.
290
+ */
291
+ domains: Domain[];
292
+ }
293
+ export type ListMailboxesRequest = {
294
+ /**
295
+ * Order matching mailbox by different criteria.
296
+ */
297
+ orderBy?: ListMailboxesRequestOrderBy;
298
+ /**
299
+ * Requested page number. Value must be greater or equal to 1.
300
+ */
301
+ page?: number;
302
+ /**
303
+ * Requested page size. Value must be between 1 and 1000.
304
+ */
305
+ pageSize?: number;
306
+ /**
307
+ * (Optional) ID of the domain in which to list the mailboxes.
308
+ */
309
+ domainId?: string;
310
+ /**
311
+ * (Optional) Filter mailboxes by their statuses.
312
+ */
313
+ statuses?: MailboxStatus[];
314
+ /**
315
+ * (Optional) Search term to filter mailboxes on name and local_part.
316
+ */
317
+ search?: string;
318
+ };
319
+ export interface ListMailboxesResponse {
320
+ /**
321
+ * Number of mailboxes that match the request (without pagination).
322
+ */
323
+ totalCount: number;
324
+ /**
325
+ * Mailboxes matching the requested criteria.
326
+ */
327
+ mailboxes: Mailbox[];
328
+ }
329
+ export type RestoreMailboxRequest = {
330
+ /**
331
+ * ID of the mailbox to restore.
332
+ */
333
+ mailboxId: string;
334
+ };
335
+ export type UpdateMailboxRequest = {
336
+ /**
337
+ * ID of the mailbox to update.
338
+ */
339
+ mailboxId: string;
340
+ /**
341
+ * (Optional) New display name of the mailbox.
342
+ */
343
+ displayName?: string;
344
+ /**
345
+ * (Optional) New recovery email for the mailbox.
346
+ */
347
+ recoveryEmail?: string;
348
+ /**
349
+ * (Optional) New subscription period for the mailbox.
350
+ */
351
+ subscriptionPeriod?: MailboxSubscriptionPeriod;
352
+ /**
353
+ * (Optional) New password of the mailbox.
354
+ */
355
+ newPassword?: string;
356
+ };
357
+ export type ValidateDomainRecordsRequest = {
358
+ domainId: string;
359
+ };
@@ -0,0 +1,56 @@
1
+ export declare const BatchCreateMailboxesRequestMailboxParameters: {
2
+ displayName: {
3
+ maxLength: number;
4
+ minLength: number;
5
+ };
6
+ localPart: {
7
+ maxLength: number;
8
+ minLength: number;
9
+ };
10
+ password: {
11
+ maxLength: number;
12
+ minLength: number;
13
+ };
14
+ recoveryEmail: {
15
+ maxLength: number;
16
+ minLength: number;
17
+ };
18
+ };
19
+ export declare const CreateDomainRequest: {
20
+ name: {
21
+ maxLength: number;
22
+ minLength: number;
23
+ };
24
+ };
25
+ export declare const ListDomainsRequest: {
26
+ page: {
27
+ greaterThanOrEqual: number;
28
+ };
29
+ pageSize: {
30
+ greaterThanOrEqual: number;
31
+ lessThanOrEqual: number;
32
+ };
33
+ };
34
+ export declare const ListMailboxesRequest: {
35
+ page: {
36
+ greaterThanOrEqual: number;
37
+ };
38
+ pageSize: {
39
+ greaterThanOrEqual: number;
40
+ lessThanOrEqual: number;
41
+ };
42
+ };
43
+ export declare const UpdateMailboxRequest: {
44
+ displayName: {
45
+ maxLength: number;
46
+ minLength: number;
47
+ };
48
+ newPassword: {
49
+ maxLength: number;
50
+ minLength: number;
51
+ };
52
+ recoveryEmail: {
53
+ maxLength: number;
54
+ minLength: number;
55
+ };
56
+ };
@@ -0,0 +1,59 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
3
+ BatchCreateMailboxesRequestMailboxParameters: () => BatchCreateMailboxesRequestMailboxParameters,
4
+ CreateDomainRequest: () => CreateDomainRequest,
5
+ ListDomainsRequest: () => ListDomainsRequest,
6
+ ListMailboxesRequest: () => ListMailboxesRequest,
7
+ UpdateMailboxRequest: () => UpdateMailboxRequest
8
+ });
9
+ const BatchCreateMailboxesRequestMailboxParameters = {
10
+ displayName: {
11
+ maxLength: 64,
12
+ minLength: 1
13
+ },
14
+ localPart: {
15
+ maxLength: 64,
16
+ minLength: 1
17
+ },
18
+ password: {
19
+ maxLength: 128,
20
+ minLength: 12
21
+ },
22
+ recoveryEmail: {
23
+ maxLength: 320,
24
+ minLength: 6
25
+ }
26
+ };
27
+ const CreateDomainRequest = { name: {
28
+ maxLength: 253,
29
+ minLength: 1
30
+ } };
31
+ const ListDomainsRequest = {
32
+ page: { greaterThanOrEqual: 1 },
33
+ pageSize: {
34
+ greaterThanOrEqual: 1,
35
+ lessThanOrEqual: 1e3
36
+ }
37
+ };
38
+ const ListMailboxesRequest = {
39
+ page: { greaterThanOrEqual: 1 },
40
+ pageSize: {
41
+ greaterThanOrEqual: 1,
42
+ lessThanOrEqual: 1e3
43
+ }
44
+ };
45
+ const UpdateMailboxRequest = {
46
+ displayName: {
47
+ maxLength: 64,
48
+ minLength: 1
49
+ },
50
+ newPassword: {
51
+ maxLength: 128,
52
+ minLength: 12
53
+ },
54
+ recoveryEmail: {
55
+ maxLength: 320,
56
+ minLength: 6
57
+ }
58
+ };
59
+ export { validation_rules_gen_exports };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@scaleway/sdk-mailbox",
3
+ "version": "1.1.0",
4
+ "description": "Scaleway SDK mailbox",
5
+ "license": "Apache-2.0",
6
+ "files": [
7
+ "dist",
8
+ "README.md"
9
+ ],
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.gen.d.ts",
14
+ "default": "./dist/index.gen.js"
15
+ },
16
+ "./*": {
17
+ "types": "./dist/*/index.gen.d.ts",
18
+ "default": "./dist/*/index.gen.js"
19
+ }
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "directory": "packages_generated/mailbox"
24
+ },
25
+ "engines": {
26
+ "node": ">=20.18.3"
27
+ },
28
+ "dependencies": {
29
+ "@scaleway/random-name": "5.1.2",
30
+ "@scaleway/sdk-std": "2.2.1"
31
+ },
32
+ "peerDependencies": {
33
+ "@scaleway/sdk-client": "^2.2.1"
34
+ },
35
+ "devDependencies": {
36
+ "@scaleway/sdk-client": "^2.2.1"
37
+ },
38
+ "scripts": {
39
+ "package:check": "pnpm publint",
40
+ "typecheck": "tsc --noEmit",
41
+ "type:generate": "tsc --declaration -p tsconfig.build.json",
42
+ "build": "vite build --config vite.config.ts && pnpm run type:generate",
43
+ "build:profile": "npx vite-bundle-visualizer -c vite.config.ts"
44
+ }
45
+ }