@scaleway/sdk-webhosting 2.2.1 → 2.4.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.
@@ -1,1031 +1,791 @@
1
- import { API, toApiLocality, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
1
  import { BACKUP_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, HOSTING_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalListBackupsResponse, unmarshalBackup, unmarshalRestoreBackupResponse, unmarshalListBackupItemsResponse, marshalBackupApiRestoreBackupItemsRequest, unmarshalRestoreBackupItemsResponse, unmarshalProgress, unmarshalListRecentProgressesResponse, unmarshalListControlPanelsResponse, marshalDatabaseApiCreateDatabaseRequest, unmarshalDatabase, unmarshalListDatabasesResponse, marshalDatabaseApiCreateDatabaseUserRequest, unmarshalDatabaseUser, unmarshalListDatabaseUsersResponse, marshalDatabaseApiChangeDatabaseUserPasswordRequest, marshalDatabaseApiAssignDatabaseUserRequest, marshalDatabaseApiUnassignDatabaseUserRequest, unmarshalDnsRecords, marshalDnsApiCheckUserOwnsDomainRequest, unmarshalCheckUserOwnsDomainResponse, marshalDnsApiSyncDomainDnsRecordsRequest, unmarshalSearchDomainsResponse, unmarshalDomain, unmarshalListOffersResponse, marshalHostingApiCreateHostingRequest, unmarshalHosting, unmarshalListHostingsResponse, marshalHostingApiUpdateHostingRequest, unmarshalSession, unmarshalResetHostingPasswordResponse, unmarshalResourceSummary, marshalHostingApiAddCustomDomainRequest, unmarshalHostingSummary, marshalHostingApiRemoveCustomDomainRequest, marshalHostingApiMigrateControlPanelRequest, marshalHostingApiDeleteHostingDomainsRequest, marshalHostingApiUpdateHostingFreeDomainRequest, marshalFreeDomainApiCheckFreeDomainAvailabilityRequest, unmarshalCheckFreeDomainAvailabilityResponse, unmarshalListFreeRootDomainsResponse, marshalFtpAccountApiCreateFtpAccountRequest, unmarshalFtpAccount, unmarshalListFtpAccountsResponse, marshalFtpAccountApiChangeFtpAccountPasswordRequest, marshalMailAccountApiCreateMailAccountRequest, unmarshalMailAccount, unmarshalListMailAccountsResponse, marshalMailAccountApiRemoveMailAccountRequest, marshalMailAccountApiChangeMailAccountPasswordRequest, unmarshalListWebsitesResponse, marshalWebsiteApiCreateWebsiteRequest, unmarshalWebsite } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
2
+ import { marshalBackupApiRestoreBackupItemsRequest, marshalDatabaseApiAssignDatabaseUserRequest, marshalDatabaseApiChangeDatabaseUserPasswordRequest, marshalDatabaseApiCreateDatabaseRequest, marshalDatabaseApiCreateDatabaseUserRequest, marshalDatabaseApiUnassignDatabaseUserRequest, marshalDnsApiCheckUserOwnsDomainRequest, marshalDnsApiSyncDomainDnsRecordsRequest, marshalFreeDomainApiCheckFreeDomainAvailabilityRequest, marshalFtpAccountApiChangeFtpAccountPasswordRequest, marshalFtpAccountApiCreateFtpAccountRequest, marshalHostingApiAddCustomDomainRequest, marshalHostingApiCreateHostingRequest, marshalHostingApiDeleteHostingDomainsRequest, marshalHostingApiMigrateControlPanelRequest, marshalHostingApiRemoveCustomDomainRequest, marshalHostingApiUpdateHostingFreeDomainRequest, marshalHostingApiUpdateHostingRequest, marshalMailAccountApiChangeMailAccountPasswordRequest, marshalMailAccountApiCreateMailAccountRequest, marshalMailAccountApiRemoveMailAccountRequest, marshalWebsiteApiCreateWebsiteRequest, unmarshalBackup, unmarshalCheckFreeDomainAvailabilityResponse, unmarshalCheckUserOwnsDomainResponse, unmarshalDatabase, unmarshalDatabaseUser, unmarshalDnsRecords, unmarshalDomain, unmarshalFtpAccount, unmarshalHosting, unmarshalHostingSummary, unmarshalListBackupItemsResponse, unmarshalListBackupsResponse, unmarshalListControlPanelsResponse, unmarshalListDatabaseUsersResponse, unmarshalListDatabasesResponse, unmarshalListFreeRootDomainsResponse, unmarshalListFtpAccountsResponse, unmarshalListHostingsResponse, unmarshalListMailAccountsResponse, unmarshalListOffersResponse, unmarshalListRecentProgressesResponse, unmarshalListWebsitesResponse, unmarshalMailAccount, unmarshalProgress, unmarshalResetHostingPasswordResponse, unmarshalResourceSummary, unmarshalRestoreBackupItemsResponse, unmarshalRestoreBackupResponse, unmarshalSearchDomainsResponse, unmarshalSession, unmarshalWebsite } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Web Hosting backup API.
7
+
8
+ This API allows you to list and restore backups for your cPanel and WordPress Web Hosting service.
9
+ */
10
+ var BackupAPI = class extends API {
11
+ /**
12
+ * Locality of this API.
13
+ * type ∈ {'zone','region','global','unspecified'}
14
+ */
15
+ static LOCALITY = toApiLocality({ regions: [
16
+ "fr-par",
17
+ "nl-ams",
18
+ "pl-waw"
19
+ ] });
20
+ pageOfListBackups = (request) => this.client.fetch({
21
+ method: "GET",
22
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backups`,
23
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
24
+ }, unmarshalListBackupsResponse);
25
+ /**
26
+ * List all available backups for a hosting account.. List all available backups for a hosting account.
27
+ *
28
+ * @param request - The request {@link BackupApiListBackupsRequest}
29
+ * @returns A Promise of ListBackupsResponse
30
+ */
31
+ listBackups = (request) => enrichForPagination("backups", this.pageOfListBackups, request);
32
+ /**
33
+ * Get info about a backup specified by the backup ID.. Get info about a backup specified by the backup ID.
34
+ *
35
+ * @param request - The request {@link BackupApiGetBackupRequest}
36
+ * @returns A Promise of Backup
37
+ */
38
+ getBackup = (request) => this.client.fetch({
39
+ method: "GET",
40
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backups/${validatePathParam("backupId", request.backupId)}`
41
+ }, unmarshalBackup);
42
+ /**
43
+ * Waits for {@link Backup} to be in a final state.
44
+ *
45
+ * @param request - The request {@link BackupApiGetBackupRequest}
46
+ * @param options - The waiting options
47
+ * @returns A Promise of Backup
48
+ */
49
+ waitForBackup = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!BACKUP_TRANSIENT_STATUSES.includes(res.status))), this.getBackup, request, options);
50
+ /**
51
+ * Restore an entire backup to your hosting environment.. Restore an entire backup to your hosting environment.
52
+ *
53
+ * @param request - The request {@link BackupApiRestoreBackupRequest}
54
+ * @returns A Promise of RestoreBackupResponse
55
+ */
56
+ restoreBackup = (request) => this.client.fetch({
57
+ body: "{}",
58
+ headers: jsonContentHeaders,
59
+ method: "POST",
60
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backups/${validatePathParam("backupId", request.backupId)}/restore`
61
+ }, unmarshalRestoreBackupResponse);
62
+ /**
63
+ * List items within a specific backup, grouped by type.. List items within a specific backup, grouped by type.
64
+ *
65
+ * @param request - The request {@link BackupApiListBackupItemsRequest}
66
+ * @returns A Promise of ListBackupItemsResponse
67
+ */
68
+ listBackupItems = (request) => this.client.fetch({
69
+ method: "GET",
70
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backup-items`,
71
+ urlParams: urlParams(["backup_id", request.backupId])
72
+ }, unmarshalListBackupItemsResponse);
73
+ /**
74
+ * Restore specific items from a backup (e.g., a database or mailbox).. Restore specific items from a backup (e.g., a database or mailbox).
75
+ *
76
+ * @param request - The request {@link BackupApiRestoreBackupItemsRequest}
77
+ * @returns A Promise of RestoreBackupItemsResponse
78
+ */
79
+ restoreBackupItems = (request) => this.client.fetch({
80
+ body: JSON.stringify(marshalBackupApiRestoreBackupItemsRequest(request, this.client.settings)),
81
+ headers: jsonContentHeaders,
82
+ method: "POST",
83
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/restore-backup-items`
84
+ }, unmarshalRestoreBackupItemsResponse);
85
+ /**
86
+ * Retrieve detailed information about a specific progress by its ID.. Retrieve detailed information about a specific progress by its ID.
87
+ *
88
+ * @param request - The request {@link BackupApiGetProgressRequest}
89
+ * @returns A Promise of Progress
90
+ */
91
+ getProgress = (request) => this.client.fetch({
92
+ method: "GET",
93
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/progresses/${validatePathParam("progressId", request.progressId)}`
94
+ }, unmarshalProgress);
95
+ /**
96
+ * List recent progresses associated with a specific backup, grouped by type.. List recent progresses associated with a specific backup, grouped by type.
97
+ *
98
+ * @param request - The request {@link BackupApiListRecentProgressesRequest}
99
+ * @returns A Promise of ListRecentProgressesResponse
100
+ */
101
+ listRecentProgresses = (request) => this.client.fetch({
102
+ method: "GET",
103
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/progresses`
104
+ }, unmarshalListRecentProgressesResponse);
6
105
  };
7
- class BackupAPI extends API {
8
- /**
9
- * Locality of this API.
10
- * type {'zone','region','global','unspecified'}
11
- */
12
- static LOCALITY = toApiLocality({
13
- regions: [
14
- "fr-par",
15
- "nl-ams",
16
- "pl-waw"
17
- ]
18
- });
19
- pageOfListBackups = (request) => this.client.fetch(
20
- {
21
- method: "GET",
22
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backups`,
23
- urlParams: urlParams(
24
- ["order_by", request.orderBy],
25
- ["page", request.page],
26
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
27
- )
28
- },
29
- unmarshalListBackupsResponse
30
- );
31
- /**
32
- * List all available backups for a hosting account.. List all available backups for a hosting account.
33
- *
34
- * @param request - The request {@link BackupApiListBackupsRequest}
35
- * @returns A Promise of ListBackupsResponse
36
- */
37
- listBackups = (request) => enrichForPagination("backups", this.pageOfListBackups, request);
38
- /**
39
- * Get info about a backup specified by the backup ID.. Get info about a backup specified by the backup ID.
40
- *
41
- * @param request - The request {@link BackupApiGetBackupRequest}
42
- * @returns A Promise of Backup
43
- */
44
- getBackup = (request) => this.client.fetch(
45
- {
46
- method: "GET",
47
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backups/${validatePathParam("backupId", request.backupId)}`
48
- },
49
- unmarshalBackup
50
- );
51
- /**
52
- * Waits for {@link Backup} to be in a final state.
53
- *
54
- * @param request - The request {@link BackupApiGetBackupRequest}
55
- * @param options - The waiting options
56
- * @returns A Promise of Backup
57
- */
58
- waitForBackup = (request, options) => waitForResource(
59
- options?.stop ?? ((res) => Promise.resolve(!BACKUP_TRANSIENT_STATUSES.includes(res.status))),
60
- this.getBackup,
61
- request,
62
- options
63
- );
64
- /**
65
- * Restore an entire backup to your hosting environment.. Restore an entire backup to your hosting environment.
66
- *
67
- * @param request - The request {@link BackupApiRestoreBackupRequest}
68
- * @returns A Promise of RestoreBackupResponse
69
- */
70
- restoreBackup = (request) => this.client.fetch(
71
- {
72
- body: "{}",
73
- headers: jsonContentHeaders,
74
- method: "POST",
75
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backups/${validatePathParam("backupId", request.backupId)}/restore`
76
- },
77
- unmarshalRestoreBackupResponse
78
- );
79
- /**
80
- * List items within a specific backup, grouped by type.. List items within a specific backup, grouped by type.
81
- *
82
- * @param request - The request {@link BackupApiListBackupItemsRequest}
83
- * @returns A Promise of ListBackupItemsResponse
84
- */
85
- listBackupItems = (request) => this.client.fetch(
86
- {
87
- method: "GET",
88
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backup-items`,
89
- urlParams: urlParams(
90
- ["backup_id", request.backupId]
91
- )
92
- },
93
- unmarshalListBackupItemsResponse
94
- );
95
- /**
96
- * Restore specific items from a backup (e.g., a database or mailbox).. Restore specific items from a backup (e.g., a database or mailbox).
97
- *
98
- * @param request - The request {@link BackupApiRestoreBackupItemsRequest}
99
- * @returns A Promise of RestoreBackupItemsResponse
100
- */
101
- restoreBackupItems = (request) => this.client.fetch(
102
- {
103
- body: JSON.stringify(
104
- marshalBackupApiRestoreBackupItemsRequest(request, this.client.settings)
105
- ),
106
- headers: jsonContentHeaders,
107
- method: "POST",
108
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/restore-backup-items`
109
- },
110
- unmarshalRestoreBackupItemsResponse
111
- );
112
- /**
113
- * Retrieve detailed information about a specific progress by its ID.. Retrieve detailed information about a specific progress by its ID.
114
- *
115
- * @param request - The request {@link BackupApiGetProgressRequest}
116
- * @returns A Promise of Progress
117
- */
118
- getProgress = (request) => this.client.fetch(
119
- {
120
- method: "GET",
121
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/progresses/${validatePathParam("progressId", request.progressId)}`
122
- },
123
- unmarshalProgress
124
- );
125
- /**
126
- * List recent progresses associated with a specific backup, grouped by type.. List recent progresses associated with a specific backup, grouped by type.
127
- *
128
- * @param request - The request {@link BackupApiListRecentProgressesRequest}
129
- * @returns A Promise of ListRecentProgressesResponse
130
- */
131
- listRecentProgresses = (request) => this.client.fetch(
132
- {
133
- method: "GET",
134
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/progresses`
135
- },
136
- unmarshalListRecentProgressesResponse
137
- );
138
- }
139
- class ControlPanelAPI extends API {
140
- /**
141
- * Locality of this API.
142
- * type ∈ {'zone','region','global','unspecified'}
143
- */
144
- static LOCALITY = toApiLocality({
145
- regions: [
146
- "fr-par",
147
- "nl-ams",
148
- "pl-waw"
149
- ]
150
- });
151
- pageOfListControlPanels = (request = {}) => this.client.fetch(
152
- {
153
- method: "GET",
154
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/control-panels`,
155
- urlParams: urlParams(
156
- ["page", request.page],
157
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
158
- )
159
- },
160
- unmarshalListControlPanelsResponse
161
- );
162
- /**
163
- * "List the control panels type: cpanel or plesk.".
164
- *
165
- * @param request - The request {@link ControlPanelApiListControlPanelsRequest}
166
- * @returns A Promise of ListControlPanelsResponse
167
- */
168
- listControlPanels = (request = {}) => enrichForPagination("controlPanels", this.pageOfListControlPanels, request);
169
- }
170
- class DatabaseAPI extends API {
171
- /**
172
- * Locality of this API.
173
- * type ∈ {'zone','region','global','unspecified'}
174
- */
175
- static LOCALITY = toApiLocality({
176
- regions: [
177
- "fr-par",
178
- "nl-ams",
179
- "pl-waw"
180
- ]
181
- });
182
- /**
183
- * "Create a new database within your hosting plan".
184
- *
185
- * @param request - The request {@link DatabaseApiCreateDatabaseRequest}
186
- * @returns A Promise of Database
187
- */
188
- createDatabase = (request) => this.client.fetch(
189
- {
190
- body: JSON.stringify(
191
- marshalDatabaseApiCreateDatabaseRequest(request, this.client.settings)
192
- ),
193
- headers: jsonContentHeaders,
194
- method: "POST",
195
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases`
196
- },
197
- unmarshalDatabase
198
- );
199
- pageOfListDatabases = (request) => this.client.fetch(
200
- {
201
- method: "GET",
202
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases`,
203
- urlParams: urlParams(
204
- ["order_by", request.orderBy],
205
- ["page", request.page],
206
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
207
- )
208
- },
209
- unmarshalListDatabasesResponse
210
- );
211
- /**
212
- * "List all databases within your hosting plan".
213
- *
214
- * @param request - The request {@link DatabaseApiListDatabasesRequest}
215
- * @returns A Promise of ListDatabasesResponse
216
- */
217
- listDatabases = (request) => enrichForPagination("databases", this.pageOfListDatabases, request);
218
- /**
219
- * "Get details of a database within your hosting plan".
220
- *
221
- * @param request - The request {@link DatabaseApiGetDatabaseRequest}
222
- * @returns A Promise of Database
223
- */
224
- getDatabase = (request) => this.client.fetch(
225
- {
226
- method: "GET",
227
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}`
228
- },
229
- unmarshalDatabase
230
- );
231
- /**
232
- * "Delete a database within your hosting plan".
233
- *
234
- * @param request - The request {@link DatabaseApiDeleteDatabaseRequest}
235
- * @returns A Promise of Database
236
- */
237
- deleteDatabase = (request) => this.client.fetch(
238
- {
239
- method: "DELETE",
240
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}`
241
- },
242
- unmarshalDatabase
243
- );
244
- /**
245
- * "Create a new database user".
246
- *
247
- * @param request - The request {@link DatabaseApiCreateDatabaseUserRequest}
248
- * @returns A Promise of DatabaseUser
249
- */
250
- createDatabaseUser = (request) => this.client.fetch(
251
- {
252
- body: JSON.stringify(
253
- marshalDatabaseApiCreateDatabaseUserRequest(request, this.client.settings)
254
- ),
255
- headers: jsonContentHeaders,
256
- method: "POST",
257
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases-users`
258
- },
259
- unmarshalDatabaseUser
260
- );
261
- pageOfListDatabaseUsers = (request) => this.client.fetch(
262
- {
263
- method: "GET",
264
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/database-users`,
265
- urlParams: urlParams(
266
- ["order_by", request.orderBy],
267
- ["page", request.page],
268
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
269
- )
270
- },
271
- unmarshalListDatabaseUsersResponse
272
- );
273
- /**
274
- * "List all database users".
275
- *
276
- * @param request - The request {@link DatabaseApiListDatabaseUsersRequest}
277
- * @returns A Promise of ListDatabaseUsersResponse
278
- */
279
- listDatabaseUsers = (request) => enrichForPagination("users", this.pageOfListDatabaseUsers, request);
280
- /**
281
- * "Get details of a database user".
282
- *
283
- * @param request - The request {@link DatabaseApiGetDatabaseUserRequest}
284
- * @returns A Promise of DatabaseUser
285
- */
286
- getDatabaseUser = (request) => this.client.fetch(
287
- {
288
- method: "GET",
289
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases-users/${validatePathParam("username", request.username)}`
290
- },
291
- unmarshalDatabaseUser
292
- );
293
- /**
294
- * "Delete a database user".
295
- *
296
- * @param request - The request {@link DatabaseApiDeleteDatabaseUserRequest}
297
- * @returns A Promise of DatabaseUser
298
- */
299
- deleteDatabaseUser = (request) => this.client.fetch(
300
- {
301
- method: "DELETE",
302
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/database-users/${validatePathParam("username", request.username)}`
303
- },
304
- unmarshalDatabaseUser
305
- );
306
- /**
307
- * "Change the password of a database user".
308
- *
309
- * @param request - The request {@link DatabaseApiChangeDatabaseUserPasswordRequest}
310
- * @returns A Promise of DatabaseUser
311
- */
312
- changeDatabaseUserPassword = (request) => this.client.fetch(
313
- {
314
- body: JSON.stringify(
315
- marshalDatabaseApiChangeDatabaseUserPasswordRequest(request, this.client.settings)
316
- ),
317
- headers: jsonContentHeaders,
318
- method: "POST",
319
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases-users/${validatePathParam("username", request.username)}/change-password`
320
- },
321
- unmarshalDatabaseUser
322
- );
323
- /**
324
- * "Assign a database user to a database".
325
- *
326
- * @param request - The request {@link DatabaseApiAssignDatabaseUserRequest}
327
- * @returns A Promise of DatabaseUser
328
- */
329
- assignDatabaseUser = (request) => this.client.fetch(
330
- {
331
- body: JSON.stringify(
332
- marshalDatabaseApiAssignDatabaseUserRequest(request, this.client.settings)
333
- ),
334
- headers: jsonContentHeaders,
335
- method: "POST",
336
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}/assign-user`
337
- },
338
- unmarshalDatabaseUser
339
- );
340
- /**
341
- * "Unassign a database user from a database".
342
- *
343
- * @param request - The request {@link DatabaseApiUnassignDatabaseUserRequest}
344
- * @returns A Promise of DatabaseUser
345
- */
346
- unassignDatabaseUser = (request) => this.client.fetch(
347
- {
348
- body: JSON.stringify(
349
- marshalDatabaseApiUnassignDatabaseUserRequest(request, this.client.settings)
350
- ),
351
- headers: jsonContentHeaders,
352
- method: "POST",
353
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}/unassign-user`
354
- },
355
- unmarshalDatabaseUser
356
- );
357
- }
358
- class DnsAPI extends API {
359
- /**
360
- * Locality of this API.
361
- * type ∈ {'zone','region','global','unspecified'}
362
- */
363
- static LOCALITY = toApiLocality({
364
- regions: [
365
- "fr-par",
366
- "nl-ams",
367
- "pl-waw"
368
- ]
369
- });
370
- /**
371
- * Get DNS records. Get the set of DNS records of a specified domain associated with a Web Hosting plan's domain.
372
- *
373
- * @param request - The request {@link DnsApiGetDomainDnsRecordsRequest}
374
- * @returns A Promise of DnsRecords
375
- */
376
- getDomainDnsRecords = (request) => this.client.fetch(
377
- {
378
- method: "GET",
379
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domain", request.domain)}/dns-records`
380
- },
381
- unmarshalDnsRecords
382
- );
383
- /**
384
- * Check whether you own this domain or not.. Check whether you own this domain or not.
385
- *
386
- * @deprecated
387
- * @param request - The request {@link DnsApiCheckUserOwnsDomainRequest}
388
- * @returns A Promise of CheckUserOwnsDomainResponse
389
- */
390
- checkUserOwnsDomain = (request) => this.client.fetch(
391
- {
392
- body: JSON.stringify(
393
- marshalDnsApiCheckUserOwnsDomainRequest(request, this.client.settings)
394
- ),
395
- headers: jsonContentHeaders,
396
- method: "POST",
397
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domain", request.domain)}/check-ownership`
398
- },
399
- unmarshalCheckUserOwnsDomainResponse
400
- );
401
- /**
402
- * Synchronize your DNS records on the Elements Console and on cPanel.. Synchronize your DNS records on the Elements Console and on cPanel.
403
- *
404
- * @param request - The request {@link DnsApiSyncDomainDnsRecordsRequest}
405
- * @returns A Promise of DnsRecords
406
- */
407
- syncDomainDnsRecords = (request) => this.client.fetch(
408
- {
409
- body: JSON.stringify(
410
- marshalDnsApiSyncDomainDnsRecordsRequest(request, this.client.settings)
411
- ),
412
- headers: jsonContentHeaders,
413
- method: "POST",
414
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domain", request.domain)}/sync-domain-dns-records`
415
- },
416
- unmarshalDnsRecords
417
- );
418
- /**
419
- * Search for available domains based on domain name.. Search for available domains based on domain name.
420
- *
421
- * @param request - The request {@link DnsApiSearchDomainsRequest}
422
- * @returns A Promise of SearchDomainsResponse
423
- */
424
- searchDomains = (request) => this.client.fetch(
425
- {
426
- method: "GET",
427
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/search-domains`,
428
- urlParams: urlParams(
429
- ["domain_name", request.domainName],
430
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
431
- )
432
- },
433
- unmarshalSearchDomainsResponse
434
- );
435
- /**
436
- * Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.. Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.
437
- *
438
- * @param request - The request {@link DnsApiGetDomainRequest}
439
- * @returns A Promise of Domain
440
- */
441
- getDomain = (request) => this.client.fetch(
442
- {
443
- method: "GET",
444
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainName", request.domainName)}`,
445
- urlParams: urlParams(
446
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
447
- )
448
- },
449
- unmarshalDomain
450
- );
451
- /**
452
- * Waits for {@link Domain} to be in a final state.
453
- *
454
- * @param request - The request {@link DnsApiGetDomainRequest}
455
- * @param options - The waiting options
456
- * @returns A Promise of Domain
457
- */
458
- waitForDomain = (request, options) => waitForResource(
459
- options?.stop ?? ((res) => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))),
460
- this.getDomain,
461
- request,
462
- options
463
- );
464
- }
465
- class OfferAPI extends API {
466
- /**
467
- * Locality of this API.
468
- * type ∈ {'zone','region','global','unspecified'}
469
- */
470
- static LOCALITY = toApiLocality({
471
- regions: [
472
- "fr-par",
473
- "nl-ams",
474
- "pl-waw"
475
- ]
476
- });
477
- pageOfListOffers = (request = {}) => this.client.fetch(
478
- {
479
- method: "GET",
480
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/offers`,
481
- urlParams: urlParams(
482
- ["control_panels", request.controlPanels],
483
- ["hosting_id", request.hostingId],
484
- ["order_by", request.orderBy],
485
- ["page", request.page],
486
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
487
- )
488
- },
489
- unmarshalListOffersResponse
490
- );
491
- /**
492
- * List all available hosting offers along with their specific options.. List all available hosting offers along with their specific options.
493
- *
494
- * @param request - The request {@link OfferApiListOffersRequest}
495
- * @returns A Promise of ListOffersResponse
496
- */
497
- listOffers = (request = {}) => enrichForPagination("offers", this.pageOfListOffers, request);
498
- }
499
- class HostingAPI extends API {
500
- /**
501
- * Locality of this API.
502
- * type ∈ {'zone','region','global','unspecified'}
503
- */
504
- static LOCALITY = toApiLocality({
505
- regions: [
506
- "fr-par",
507
- "nl-ams",
508
- "pl-waw"
509
- ]
510
- });
511
- /**
512
- * Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer type required via the `offer_id` parameter.
513
- *
514
- * @param request - The request {@link HostingApiCreateHostingRequest}
515
- * @returns A Promise of Hosting
516
- */
517
- createHosting = (request) => this.client.fetch(
518
- {
519
- body: JSON.stringify(
520
- marshalHostingApiCreateHostingRequest(request, this.client.settings)
521
- ),
522
- headers: jsonContentHeaders,
523
- method: "POST",
524
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings`
525
- },
526
- unmarshalHosting
527
- );
528
- pageOfListHostings = (request = {}) => this.client.fetch(
529
- {
530
- method: "GET",
531
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings`,
532
- urlParams: urlParams(
533
- ["control_panels", request.controlPanels],
534
- ["domain", request.domain],
535
- ["order_by", request.orderBy],
536
- ["organization_id", request.organizationId],
537
- ["page", request.page],
538
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
539
- ["project_id", request.projectId],
540
- ["statuses", request.statuses],
541
- ["subdomain", request.subdomain],
542
- ["tags", request.tags]
543
- )
544
- },
545
- unmarshalListHostingsResponse
546
- );
547
- /**
548
- * List all Web Hosting plans. List all of your existing Web Hosting plans. Various filters are available to limit the results, including filtering by domain, status, tag and Project ID.
549
- *
550
- * @param request - The request {@link HostingApiListHostingsRequest}
551
- * @returns A Promise of ListHostingsResponse
552
- */
553
- listHostings = (request = {}) => enrichForPagination("hostings", this.pageOfListHostings, request);
554
- /**
555
- * Get a Web Hosting plan. Get the details of one of your existing Web Hosting plans, specified by its `hosting_id`.
556
- *
557
- * @param request - The request {@link HostingApiGetHostingRequest}
558
- * @returns A Promise of Hosting
559
- */
560
- getHosting = (request) => this.client.fetch(
561
- {
562
- method: "GET",
563
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}`
564
- },
565
- unmarshalHosting
566
- );
567
- /**
568
- * Waits for {@link Hosting} to be in a final state.
569
- *
570
- * @param request - The request {@link HostingApiGetHostingRequest}
571
- * @param options - The waiting options
572
- * @returns A Promise of Hosting
573
- */
574
- waitForHosting = (request, options) => waitForResource(
575
- options?.stop ?? ((res) => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))),
576
- this.getHosting,
577
- request,
578
- options
579
- );
580
- /**
581
- * Update a Web Hosting plan. Update the details of one of your existing Web Hosting plans, specified by its `hosting_id`. You can update parameters including the contact email address, tags, options and offer.
582
- *
583
- * @param request - The request {@link HostingApiUpdateHostingRequest}
584
- * @returns A Promise of Hosting
585
- */
586
- updateHosting = (request) => this.client.fetch(
587
- {
588
- body: JSON.stringify(
589
- marshalHostingApiUpdateHostingRequest(request, this.client.settings)
590
- ),
591
- headers: jsonContentHeaders,
592
- method: "PATCH",
593
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}`
594
- },
595
- unmarshalHosting
596
- );
597
- /**
598
- * Delete a Web Hosting plan. Delete a Web Hosting plan, specified by its `hosting_id`. Note that deletion is not immediate: it will take place at the end of the calendar month, after which time your Web Hosting plan and all its data (files and emails) will be irreversibly lost.
599
- *
600
- * @param request - The request {@link HostingApiDeleteHostingRequest}
601
- * @returns A Promise of Hosting
602
- */
603
- deleteHosting = (request) => this.client.fetch(
604
- {
605
- method: "DELETE",
606
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}`
607
- },
608
- unmarshalHosting
609
- );
610
- /**
611
- * Create a user session.
612
- *
613
- * @param request - The request {@link HostingApiCreateSessionRequest}
614
- * @returns A Promise of Session
615
- */
616
- createSession = (request) => this.client.fetch(
617
- {
618
- body: "{}",
619
- headers: jsonContentHeaders,
620
- method: "POST",
621
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/sessions`
622
- },
623
- unmarshalSession
624
- );
625
- /**
626
- * Reset a Web Hosting plan password.
627
- *
628
- * @param request - The request {@link HostingApiResetHostingPasswordRequest}
629
- * @returns A Promise of ResetHostingPasswordResponse
630
- */
631
- resetHostingPassword = (request) => this.client.fetch(
632
- {
633
- body: "{}",
634
- headers: jsonContentHeaders,
635
- method: "POST",
636
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/reset-password`
637
- },
638
- unmarshalResetHostingPasswordResponse
639
- );
640
- /**
641
- * Get the total counts of websites, databases, email accounts, and FTP accounts of a Web Hosting plan.
642
- *
643
- * @param request - The request {@link HostingApiGetResourceSummaryRequest}
644
- * @returns A Promise of ResourceSummary
645
- */
646
- getResourceSummary = (request) => this.client.fetch(
647
- {
648
- method: "GET",
649
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/resource-summary`
650
- },
651
- unmarshalResourceSummary
652
- );
653
- /**
654
- * Attach a custom domain to a webhosting as an alias to the main domain.
655
- *
656
- * @param request - The request {@link HostingApiAddCustomDomainRequest}
657
- * @returns A Promise of HostingSummary
658
- */
659
- addCustomDomain = (request) => this.client.fetch(
660
- {
661
- body: JSON.stringify(
662
- marshalHostingApiAddCustomDomainRequest(request, this.client.settings)
663
- ),
664
- headers: jsonContentHeaders,
665
- method: "POST",
666
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/add-custom-domain`
667
- },
668
- unmarshalHostingSummary
669
- );
670
- /**
671
- * Detach a custom domain from a webhosting.
672
- *
673
- * @param request - The request {@link HostingApiRemoveCustomDomainRequest}
674
- * @returns A Promise of HostingSummary
675
- */
676
- removeCustomDomain = (request) => this.client.fetch(
677
- {
678
- body: JSON.stringify(
679
- marshalHostingApiRemoveCustomDomainRequest(request, this.client.settings)
680
- ),
681
- headers: jsonContentHeaders,
682
- method: "POST",
683
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/remove-custom-domain`
684
- },
685
- unmarshalHostingSummary
686
- );
687
- /**
688
- * Migrate a hosting to a new control panel.. Migrate a hosting to a new control panel.
689
- *
690
- * @param request - The request {@link HostingApiMigrateControlPanelRequest}
691
- * @returns A Promise of HostingSummary
692
- */
693
- migrateControlPanel = (request) => this.client.fetch(
694
- {
695
- body: JSON.stringify(
696
- marshalHostingApiMigrateControlPanelRequest(request, this.client.settings)
697
- ),
698
- headers: jsonContentHeaders,
699
- method: "POST",
700
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/migrate-control-panel`
701
- },
702
- unmarshalHostingSummary
703
- );
704
- /**
705
- * Reset a Web Hosting plan. Reset a Web Hosting plan to its initial state, specified by its `hosting_id`. This permanently deletes all hosting data including files, databases and emails. The hosting will be re-provisioned.
706
- *
707
- * @param request - The request {@link HostingApiResetHostingRequest}
708
- * @returns A Promise of Hosting
709
- */
710
- resetHosting = (request) => this.client.fetch(
711
- {
712
- body: "{}",
713
- headers: jsonContentHeaders,
714
- method: "POST",
715
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/reset`
716
- },
717
- unmarshalHosting
718
- );
719
- /**
720
- * Delete domains from a Web Hosting plan. Remove one or more domains from a Web Hosting plan, specified by its `hosting_id`. This permanently deletes the domains and all services tied to them, including mailboxes, FTP accounts and DNS zones.
721
- *
722
- * @param request - The request {@link HostingApiDeleteHostingDomainsRequest}
723
- * @returns A Promise of Hosting
724
- */
725
- deleteHostingDomains = (request) => this.client.fetch(
726
- {
727
- body: JSON.stringify(
728
- marshalHostingApiDeleteHostingDomainsRequest(request, this.client.settings)
729
- ),
730
- headers: jsonContentHeaders,
731
- method: "POST",
732
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/delete-domains`
733
- },
734
- unmarshalHosting
735
- );
736
- /**
737
- * Update the free domain of a Web Hosting plan. Change the free domain associated with a Web Hosting plan, specified by its `hosting_id`.
738
- *
739
- * @param request - The request {@link HostingApiUpdateHostingFreeDomainRequest}
740
- * @returns A Promise of Hosting
741
- */
742
- updateHostingFreeDomain = (request) => this.client.fetch(
743
- {
744
- body: JSON.stringify(
745
- marshalHostingApiUpdateHostingFreeDomainRequest(request, this.client.settings)
746
- ),
747
- headers: jsonContentHeaders,
748
- method: "PATCH",
749
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/update-free-domain`
750
- },
751
- unmarshalHosting
752
- );
753
- }
754
- class FreeDomainAPI extends API {
755
- /**
756
- * Locality of this API.
757
- * type ∈ {'zone','region','global','unspecified'}
758
- */
759
- static LOCALITY = toApiLocality({
760
- regions: [
761
- "fr-par",
762
- "nl-ams",
763
- "pl-waw"
764
- ]
765
- });
766
- /**
767
- * Check whether a given slug and free domain combination is available.. Check whether a given slug and free domain combination is available.
768
- *
769
- * @param request - The request {@link FreeDomainApiCheckFreeDomainAvailabilityRequest}
770
- * @returns A Promise of CheckFreeDomainAvailabilityResponse
771
- */
772
- checkFreeDomainAvailability = (request) => this.client.fetch(
773
- {
774
- body: JSON.stringify(
775
- marshalFreeDomainApiCheckFreeDomainAvailabilityRequest(request, this.client.settings)
776
- ),
777
- headers: jsonContentHeaders,
778
- method: "POST",
779
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/free-domains/check-availability`
780
- },
781
- unmarshalCheckFreeDomainAvailabilityResponse
782
- );
783
- pageOfListFreeRootDomains = (request = {}) => this.client.fetch(
784
- {
785
- method: "GET",
786
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/free-domains/root-domains`,
787
- urlParams: urlParams(
788
- ["page", request.page],
789
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
790
- )
791
- },
792
- unmarshalListFreeRootDomainsResponse
793
- );
794
- /**
795
- * Retrieve the list of free root domains available for a Web Hosting.. Retrieve the list of free root domains available for a Web Hosting.
796
- *
797
- * @param request - The request {@link FreeDomainApiListFreeRootDomainsRequest}
798
- * @returns A Promise of ListFreeRootDomainsResponse
799
- */
800
- listFreeRootDomains = (request = {}) => enrichForPagination("rootDomains", this.pageOfListFreeRootDomains, request);
801
- }
802
- class FtpAccountAPI extends API {
803
- /**
804
- * Locality of this API.
805
- * type ∈ {'zone','region','global','unspecified'}
806
- */
807
- static LOCALITY = toApiLocality({
808
- regions: [
809
- "fr-par",
810
- "nl-ams",
811
- "pl-waw"
812
- ]
813
- });
814
- /**
815
- * Create a new FTP account within your hosting plan.. Create a new FTP account within your hosting plan.
816
- *
817
- * @param request - The request {@link FtpAccountApiCreateFtpAccountRequest}
818
- * @returns A Promise of FtpAccount
819
- */
820
- createFtpAccount = (request) => this.client.fetch(
821
- {
822
- body: JSON.stringify(
823
- marshalFtpAccountApiCreateFtpAccountRequest(request, this.client.settings)
824
- ),
825
- headers: jsonContentHeaders,
826
- method: "POST",
827
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts`
828
- },
829
- unmarshalFtpAccount
830
- );
831
- pageOfListFtpAccounts = (request) => this.client.fetch(
832
- {
833
- method: "GET",
834
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts`,
835
- urlParams: urlParams(
836
- ["domain", request.domain],
837
- ["order_by", request.orderBy],
838
- ["page", request.page],
839
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
840
- )
841
- },
842
- unmarshalListFtpAccountsResponse
843
- );
844
- /**
845
- * List all FTP accounts within your hosting plan.. List all FTP accounts within your hosting plan.
846
- *
847
- * @param request - The request {@link FtpAccountApiListFtpAccountsRequest}
848
- * @returns A Promise of ListFtpAccountsResponse
849
- */
850
- listFtpAccounts = (request) => enrichForPagination("ftpAccounts", this.pageOfListFtpAccounts, request);
851
- /**
852
- * Delete a specific FTP account within your hosting plan.. Delete a specific FTP account within your hosting plan.
853
- *
854
- * @param request - The request {@link FtpAccountApiRemoveFtpAccountRequest}
855
- * @returns A Promise of FtpAccount
856
- */
857
- removeFtpAccount = (request) => this.client.fetch(
858
- {
859
- method: "DELETE",
860
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts/${validatePathParam("username", request.username)}`
861
- },
862
- unmarshalFtpAccount
863
- );
864
- changeFtpAccountPassword = (request) => this.client.fetch(
865
- {
866
- body: JSON.stringify(
867
- marshalFtpAccountApiChangeFtpAccountPasswordRequest(request, this.client.settings)
868
- ),
869
- headers: jsonContentHeaders,
870
- method: "POST",
871
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts/${validatePathParam("username", request.username)}/change-password`
872
- },
873
- unmarshalFtpAccount
874
- );
875
- }
876
- class MailAccountAPI extends API {
877
- /**
878
- * Locality of this API.
879
- * type ∈ {'zone','region','global','unspecified'}
880
- */
881
- static LOCALITY = toApiLocality({
882
- regions: [
883
- "fr-par",
884
- "nl-ams",
885
- "pl-waw"
886
- ]
887
- });
888
- /**
889
- * Create a new mail account within your hosting plan.. Create a new mail account within your hosting plan.
890
- *
891
- * @param request - The request {@link MailAccountApiCreateMailAccountRequest}
892
- * @returns A Promise of MailAccount
893
- */
894
- createMailAccount = (request) => this.client.fetch(
895
- {
896
- body: JSON.stringify(
897
- marshalMailAccountApiCreateMailAccountRequest(request, this.client.settings)
898
- ),
899
- headers: jsonContentHeaders,
900
- method: "POST",
901
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/mail-accounts`
902
- },
903
- unmarshalMailAccount
904
- );
905
- pageOfListMailAccounts = (request) => this.client.fetch(
906
- {
907
- method: "GET",
908
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/mail-accounts`,
909
- urlParams: urlParams(
910
- ["domain", request.domain],
911
- ["order_by", request.orderBy],
912
- ["page", request.page],
913
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
914
- )
915
- },
916
- unmarshalListMailAccountsResponse
917
- );
918
- /**
919
- * List all mail accounts within your hosting plan.. List all mail accounts within your hosting plan.
920
- *
921
- * @param request - The request {@link MailAccountApiListMailAccountsRequest}
922
- * @returns A Promise of ListMailAccountsResponse
923
- */
924
- listMailAccounts = (request) => enrichForPagination("mailAccounts", this.pageOfListMailAccounts, request);
925
- /**
926
- * Delete a mail account within your hosting plan.. Delete a mail account within your hosting plan.
927
- *
928
- * @param request - The request {@link MailAccountApiRemoveMailAccountRequest}
929
- * @returns A Promise of MailAccount
930
- */
931
- removeMailAccount = (request) => this.client.fetch(
932
- {
933
- body: JSON.stringify(
934
- marshalMailAccountApiRemoveMailAccountRequest(request, this.client.settings)
935
- ),
936
- headers: jsonContentHeaders,
937
- method: "POST",
938
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/remove-mail-account`
939
- },
940
- unmarshalMailAccount
941
- );
942
- /**
943
- * Update the password of a mail account within your hosting plan.. Update the password of a mail account within your hosting plan.
944
- *
945
- * @param request - The request {@link MailAccountApiChangeMailAccountPasswordRequest}
946
- * @returns A Promise of MailAccount
947
- */
948
- changeMailAccountPassword = (request) => this.client.fetch(
949
- {
950
- body: JSON.stringify(
951
- marshalMailAccountApiChangeMailAccountPasswordRequest(request, this.client.settings)
952
- ),
953
- headers: jsonContentHeaders,
954
- method: "POST",
955
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/change-mail-password`
956
- },
957
- unmarshalMailAccount
958
- );
959
- }
960
- class WebsiteAPI extends API {
961
- /**
962
- * Locality of this API.
963
- * type ∈ {'zone','region','global','unspecified'}
964
- */
965
- static LOCALITY = toApiLocality({
966
- regions: [
967
- "fr-par",
968
- "nl-ams",
969
- "pl-waw"
970
- ]
971
- });
972
- pageOfListWebsites = (request) => this.client.fetch(
973
- {
974
- method: "GET",
975
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites`,
976
- urlParams: urlParams(
977
- ["order_by", request.orderBy],
978
- ["page", request.page],
979
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
980
- )
981
- },
982
- unmarshalListWebsitesResponse
983
- );
984
- /**
985
- * List all websites for a specific hosting.. List all websites for a specific hosting.
986
- *
987
- * @param request - The request {@link WebsiteApiListWebsitesRequest}
988
- * @returns A Promise of ListWebsitesResponse
989
- */
990
- listWebsites = (request) => enrichForPagination("websites", this.pageOfListWebsites, request);
991
- /**
992
- * Create a new website and attach it to a webhosting.
993
- *
994
- * @param request - The request {@link WebsiteApiCreateWebsiteRequest}
995
- * @returns A Promise of Website
996
- */
997
- createWebsite = (request) => this.client.fetch(
998
- {
999
- body: JSON.stringify(
1000
- marshalWebsiteApiCreateWebsiteRequest(request, this.client.settings)
1001
- ),
1002
- headers: jsonContentHeaders,
1003
- method: "POST",
1004
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites`
1005
- },
1006
- unmarshalWebsite
1007
- );
1008
- /**
1009
- * Delete a website from a webhosting.
1010
- *
1011
- * @param request - The request {@link WebsiteApiDeleteWebsiteRequest}
1012
- */
1013
- deleteWebsite = (request) => this.client.fetch(
1014
- {
1015
- method: "DELETE",
1016
- path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites/${validatePathParam("domainName", request.domainName)}`
1017
- }
1018
- );
1019
- }
1020
- export {
1021
- BackupAPI,
1022
- ControlPanelAPI,
1023
- DatabaseAPI,
1024
- DnsAPI,
1025
- FreeDomainAPI,
1026
- FtpAccountAPI,
1027
- HostingAPI,
1028
- MailAccountAPI,
1029
- OfferAPI,
1030
- WebsiteAPI
106
+ /**
107
+ * Web Hosting Control Panel API.
108
+
109
+ This API allows you to manage your Web Hosting services.
110
+ */
111
+ var ControlPanelAPI = class extends API {
112
+ /**
113
+ * Locality of this API.
114
+ * type ∈ {'zone','region','global','unspecified'}
115
+ */
116
+ static LOCALITY = toApiLocality({ regions: [
117
+ "fr-par",
118
+ "nl-ams",
119
+ "pl-waw"
120
+ ] });
121
+ pageOfListControlPanels = (request = {}) => this.client.fetch({
122
+ method: "GET",
123
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/control-panels`,
124
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
125
+ }, unmarshalListControlPanelsResponse);
126
+ /**
127
+ * "List the control panels type: cpanel or plesk.".
128
+ *
129
+ * @param request - The request {@link ControlPanelApiListControlPanelsRequest}
130
+ * @returns A Promise of ListControlPanelsResponse
131
+ */
132
+ listControlPanels = (request = {}) => enrichForPagination("controlPanels", this.pageOfListControlPanels, request);
1031
133
  };
134
+ /**
135
+ * Web Hosting Database API.
136
+
137
+ This API allows you to manage your databases and database users for your Web Hosting services.
138
+ */
139
+ var DatabaseAPI = class extends API {
140
+ /**
141
+ * Locality of this API.
142
+ * type ∈ {'zone','region','global','unspecified'}
143
+ */
144
+ static LOCALITY = toApiLocality({ regions: [
145
+ "fr-par",
146
+ "nl-ams",
147
+ "pl-waw"
148
+ ] });
149
+ /**
150
+ * "Create a new database within your hosting plan".
151
+ *
152
+ * @param request - The request {@link DatabaseApiCreateDatabaseRequest}
153
+ * @returns A Promise of Database
154
+ */
155
+ createDatabase = (request) => this.client.fetch({
156
+ body: JSON.stringify(marshalDatabaseApiCreateDatabaseRequest(request, this.client.settings)),
157
+ headers: jsonContentHeaders,
158
+ method: "POST",
159
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases`
160
+ }, unmarshalDatabase);
161
+ pageOfListDatabases = (request) => this.client.fetch({
162
+ method: "GET",
163
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases`,
164
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
165
+ }, unmarshalListDatabasesResponse);
166
+ /**
167
+ * "List all databases within your hosting plan".
168
+ *
169
+ * @param request - The request {@link DatabaseApiListDatabasesRequest}
170
+ * @returns A Promise of ListDatabasesResponse
171
+ */
172
+ listDatabases = (request) => enrichForPagination("databases", this.pageOfListDatabases, request);
173
+ /**
174
+ * "Get details of a database within your hosting plan".
175
+ *
176
+ * @param request - The request {@link DatabaseApiGetDatabaseRequest}
177
+ * @returns A Promise of Database
178
+ */
179
+ getDatabase = (request) => this.client.fetch({
180
+ method: "GET",
181
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}`
182
+ }, unmarshalDatabase);
183
+ /**
184
+ * "Delete a database within your hosting plan".
185
+ *
186
+ * @param request - The request {@link DatabaseApiDeleteDatabaseRequest}
187
+ * @returns A Promise of Database
188
+ */
189
+ deleteDatabase = (request) => this.client.fetch({
190
+ method: "DELETE",
191
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}`
192
+ }, unmarshalDatabase);
193
+ /**
194
+ * "Create a new database user".
195
+ *
196
+ * @param request - The request {@link DatabaseApiCreateDatabaseUserRequest}
197
+ * @returns A Promise of DatabaseUser
198
+ */
199
+ createDatabaseUser = (request) => this.client.fetch({
200
+ body: JSON.stringify(marshalDatabaseApiCreateDatabaseUserRequest(request, this.client.settings)),
201
+ headers: jsonContentHeaders,
202
+ method: "POST",
203
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases-users`
204
+ }, unmarshalDatabaseUser);
205
+ pageOfListDatabaseUsers = (request) => this.client.fetch({
206
+ method: "GET",
207
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/database-users`,
208
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
209
+ }, unmarshalListDatabaseUsersResponse);
210
+ /**
211
+ * "List all database users".
212
+ *
213
+ * @param request - The request {@link DatabaseApiListDatabaseUsersRequest}
214
+ * @returns A Promise of ListDatabaseUsersResponse
215
+ */
216
+ listDatabaseUsers = (request) => enrichForPagination("users", this.pageOfListDatabaseUsers, request);
217
+ /**
218
+ * "Get details of a database user".
219
+ *
220
+ * @param request - The request {@link DatabaseApiGetDatabaseUserRequest}
221
+ * @returns A Promise of DatabaseUser
222
+ */
223
+ getDatabaseUser = (request) => this.client.fetch({
224
+ method: "GET",
225
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases-users/${validatePathParam("username", request.username)}`
226
+ }, unmarshalDatabaseUser);
227
+ /**
228
+ * "Delete a database user".
229
+ *
230
+ * @param request - The request {@link DatabaseApiDeleteDatabaseUserRequest}
231
+ * @returns A Promise of DatabaseUser
232
+ */
233
+ deleteDatabaseUser = (request) => this.client.fetch({
234
+ method: "DELETE",
235
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/database-users/${validatePathParam("username", request.username)}`
236
+ }, unmarshalDatabaseUser);
237
+ /**
238
+ * "Change the password of a database user".
239
+ *
240
+ * @param request - The request {@link DatabaseApiChangeDatabaseUserPasswordRequest}
241
+ * @returns A Promise of DatabaseUser
242
+ */
243
+ changeDatabaseUserPassword = (request) => this.client.fetch({
244
+ body: JSON.stringify(marshalDatabaseApiChangeDatabaseUserPasswordRequest(request, this.client.settings)),
245
+ headers: jsonContentHeaders,
246
+ method: "POST",
247
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases-users/${validatePathParam("username", request.username)}/change-password`
248
+ }, unmarshalDatabaseUser);
249
+ /**
250
+ * "Assign a database user to a database".
251
+ *
252
+ * @param request - The request {@link DatabaseApiAssignDatabaseUserRequest}
253
+ * @returns A Promise of DatabaseUser
254
+ */
255
+ assignDatabaseUser = (request) => this.client.fetch({
256
+ body: JSON.stringify(marshalDatabaseApiAssignDatabaseUserRequest(request, this.client.settings)),
257
+ headers: jsonContentHeaders,
258
+ method: "POST",
259
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}/assign-user`
260
+ }, unmarshalDatabaseUser);
261
+ /**
262
+ * "Unassign a database user from a database".
263
+ *
264
+ * @param request - The request {@link DatabaseApiUnassignDatabaseUserRequest}
265
+ * @returns A Promise of DatabaseUser
266
+ */
267
+ unassignDatabaseUser = (request) => this.client.fetch({
268
+ body: JSON.stringify(marshalDatabaseApiUnassignDatabaseUserRequest(request, this.client.settings)),
269
+ headers: jsonContentHeaders,
270
+ method: "POST",
271
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/databases/${validatePathParam("databaseName", request.databaseName)}/unassign-user`
272
+ }, unmarshalDatabaseUser);
273
+ };
274
+ /**
275
+ * Web Hosting Dns API.
276
+
277
+ This API allows you to manage your Web Hosting services.
278
+ */
279
+ var DnsAPI = class extends API {
280
+ /**
281
+ * Locality of this API.
282
+ * type ∈ {'zone','region','global','unspecified'}
283
+ */
284
+ static LOCALITY = toApiLocality({ regions: [
285
+ "fr-par",
286
+ "nl-ams",
287
+ "pl-waw"
288
+ ] });
289
+ /**
290
+ * Get DNS records. Get the set of DNS records of a specified domain associated with a Web Hosting plan's domain.
291
+ *
292
+ * @param request - The request {@link DnsApiGetDomainDnsRecordsRequest}
293
+ * @returns A Promise of DnsRecords
294
+ */
295
+ getDomainDnsRecords = (request) => this.client.fetch({
296
+ method: "GET",
297
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domain", request.domain)}/dns-records`
298
+ }, unmarshalDnsRecords);
299
+ /**
300
+ * Check whether you own this domain or not.. Check whether you own this domain or not.
301
+ *
302
+ * @deprecated
303
+ * @param request - The request {@link DnsApiCheckUserOwnsDomainRequest}
304
+ * @returns A Promise of CheckUserOwnsDomainResponse
305
+ */
306
+ checkUserOwnsDomain = (request) => this.client.fetch({
307
+ body: JSON.stringify(marshalDnsApiCheckUserOwnsDomainRequest(request, this.client.settings)),
308
+ headers: jsonContentHeaders,
309
+ method: "POST",
310
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domain", request.domain)}/check-ownership`
311
+ }, unmarshalCheckUserOwnsDomainResponse);
312
+ /**
313
+ * Synchronize your DNS records on the Elements Console and on cPanel.. Synchronize your DNS records on the Elements Console and on cPanel.
314
+ *
315
+ * @param request - The request {@link DnsApiSyncDomainDnsRecordsRequest}
316
+ * @returns A Promise of DnsRecords
317
+ */
318
+ syncDomainDnsRecords = (request) => this.client.fetch({
319
+ body: JSON.stringify(marshalDnsApiSyncDomainDnsRecordsRequest(request, this.client.settings)),
320
+ headers: jsonContentHeaders,
321
+ method: "POST",
322
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domain", request.domain)}/sync-domain-dns-records`
323
+ }, unmarshalDnsRecords);
324
+ /**
325
+ * Search for available domains based on domain name.. Search for available domains based on domain name.
326
+ *
327
+ * @param request - The request {@link DnsApiSearchDomainsRequest}
328
+ * @returns A Promise of SearchDomainsResponse
329
+ */
330
+ searchDomains = (request) => this.client.fetch({
331
+ method: "GET",
332
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/search-domains`,
333
+ urlParams: urlParams(["domain_name", request.domainName], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
334
+ }, unmarshalSearchDomainsResponse);
335
+ /**
336
+ * Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.. Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.
337
+ *
338
+ * @param request - The request {@link DnsApiGetDomainRequest}
339
+ * @returns A Promise of Domain
340
+ */
341
+ getDomain = (request) => this.client.fetch({
342
+ method: "GET",
343
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainName", request.domainName)}`,
344
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
345
+ }, unmarshalDomain);
346
+ /**
347
+ * Waits for {@link Domain} to be in a final state.
348
+ *
349
+ * @param request - The request {@link DnsApiGetDomainRequest}
350
+ * @param options - The waiting options
351
+ * @returns A Promise of Domain
352
+ */
353
+ waitForDomain = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
354
+ };
355
+ /**
356
+ * Web Hosting Offer API.
357
+
358
+ This API allows you to manage your offer for your Web Hosting services.
359
+ */
360
+ var OfferAPI = class extends API {
361
+ /**
362
+ * Locality of this API.
363
+ * type ∈ {'zone','region','global','unspecified'}
364
+ */
365
+ static LOCALITY = toApiLocality({ regions: [
366
+ "fr-par",
367
+ "nl-ams",
368
+ "pl-waw"
369
+ ] });
370
+ pageOfListOffers = (request = {}) => this.client.fetch({
371
+ method: "GET",
372
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/offers`,
373
+ urlParams: urlParams(["control_panels", request.controlPanels], ["hosting_id", request.hostingId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
374
+ }, unmarshalListOffersResponse);
375
+ /**
376
+ * List all available hosting offers along with their specific options.. List all available hosting offers along with their specific options.
377
+ *
378
+ * @param request - The request {@link OfferApiListOffersRequest}
379
+ * @returns A Promise of ListOffersResponse
380
+ */
381
+ listOffers = (request = {}) => enrichForPagination("offers", this.pageOfListOffers, request);
382
+ };
383
+ /**
384
+ * Web Hosting API.
385
+
386
+ This API allows you to manage your Web Hosting services.
387
+ */
388
+ var HostingAPI = class extends API {
389
+ /**
390
+ * Locality of this API.
391
+ * type ∈ {'zone','region','global','unspecified'}
392
+ */
393
+ static LOCALITY = toApiLocality({ regions: [
394
+ "fr-par",
395
+ "nl-ams",
396
+ "pl-waw"
397
+ ] });
398
+ /**
399
+ * Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer type required via the `offer_id` parameter.
400
+ *
401
+ * @param request - The request {@link HostingApiCreateHostingRequest}
402
+ * @returns A Promise of Hosting
403
+ */
404
+ createHosting = (request) => this.client.fetch({
405
+ body: JSON.stringify(marshalHostingApiCreateHostingRequest(request, this.client.settings)),
406
+ headers: jsonContentHeaders,
407
+ method: "POST",
408
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings`
409
+ }, unmarshalHosting);
410
+ pageOfListHostings = (request = {}) => this.client.fetch({
411
+ method: "GET",
412
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings`,
413
+ urlParams: urlParams(["control_panels", request.controlPanels], ["domain", request.domain], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["statuses", request.statuses], ["subdomain", request.subdomain], ["tags", request.tags])
414
+ }, unmarshalListHostingsResponse);
415
+ /**
416
+ * List all Web Hosting plans. List all of your existing Web Hosting plans. Various filters are available to limit the results, including filtering by domain, status, tag and Project ID.
417
+ *
418
+ * @param request - The request {@link HostingApiListHostingsRequest}
419
+ * @returns A Promise of ListHostingsResponse
420
+ */
421
+ listHostings = (request = {}) => enrichForPagination("hostings", this.pageOfListHostings, request);
422
+ /**
423
+ * Get a Web Hosting plan. Get the details of one of your existing Web Hosting plans, specified by its `hosting_id`.
424
+ *
425
+ * @param request - The request {@link HostingApiGetHostingRequest}
426
+ * @returns A Promise of Hosting
427
+ */
428
+ getHosting = (request) => this.client.fetch({
429
+ method: "GET",
430
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}`
431
+ }, unmarshalHosting);
432
+ /**
433
+ * Waits for {@link Hosting} to be in a final state.
434
+ *
435
+ * @param request - The request {@link HostingApiGetHostingRequest}
436
+ * @param options - The waiting options
437
+ * @returns A Promise of Hosting
438
+ */
439
+ waitForHosting = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
440
+ /**
441
+ * Update a Web Hosting plan. Update the details of one of your existing Web Hosting plans, specified by its `hosting_id`. You can update parameters including the contact email address, tags, options and offer.
442
+ *
443
+ * @param request - The request {@link HostingApiUpdateHostingRequest}
444
+ * @returns A Promise of Hosting
445
+ */
446
+ updateHosting = (request) => this.client.fetch({
447
+ body: JSON.stringify(marshalHostingApiUpdateHostingRequest(request, this.client.settings)),
448
+ headers: jsonContentHeaders,
449
+ method: "PATCH",
450
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}`
451
+ }, unmarshalHosting);
452
+ /**
453
+ * Delete a Web Hosting plan. Delete a Web Hosting plan, specified by its `hosting_id`. Note that deletion is not immediate: it will take place at the end of the calendar month, after which time your Web Hosting plan and all its data (files and emails) will be irreversibly lost.
454
+ *
455
+ * @param request - The request {@link HostingApiDeleteHostingRequest}
456
+ * @returns A Promise of Hosting
457
+ */
458
+ deleteHosting = (request) => this.client.fetch({
459
+ method: "DELETE",
460
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}`
461
+ }, unmarshalHosting);
462
+ /**
463
+ * Create a user session.
464
+ *
465
+ * @param request - The request {@link HostingApiCreateSessionRequest}
466
+ * @returns A Promise of Session
467
+ */
468
+ createSession = (request) => this.client.fetch({
469
+ body: "{}",
470
+ headers: jsonContentHeaders,
471
+ method: "POST",
472
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/sessions`
473
+ }, unmarshalSession);
474
+ /**
475
+ * Reset a Web Hosting plan password.
476
+ *
477
+ * @param request - The request {@link HostingApiResetHostingPasswordRequest}
478
+ * @returns A Promise of ResetHostingPasswordResponse
479
+ */
480
+ resetHostingPassword = (request) => this.client.fetch({
481
+ body: "{}",
482
+ headers: jsonContentHeaders,
483
+ method: "POST",
484
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/reset-password`
485
+ }, unmarshalResetHostingPasswordResponse);
486
+ /**
487
+ * Get the total counts of websites, databases, email accounts, and FTP accounts of a Web Hosting plan.
488
+ *
489
+ * @param request - The request {@link HostingApiGetResourceSummaryRequest}
490
+ * @returns A Promise of ResourceSummary
491
+ */
492
+ getResourceSummary = (request) => this.client.fetch({
493
+ method: "GET",
494
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/resource-summary`
495
+ }, unmarshalResourceSummary);
496
+ /**
497
+ * Attach a custom domain to a webhosting as an alias to the main domain.
498
+ *
499
+ * @param request - The request {@link HostingApiAddCustomDomainRequest}
500
+ * @returns A Promise of HostingSummary
501
+ */
502
+ addCustomDomain = (request) => this.client.fetch({
503
+ body: JSON.stringify(marshalHostingApiAddCustomDomainRequest(request, this.client.settings)),
504
+ headers: jsonContentHeaders,
505
+ method: "POST",
506
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/add-custom-domain`
507
+ }, unmarshalHostingSummary);
508
+ /**
509
+ * Detach a custom domain from a webhosting.
510
+ *
511
+ * @param request - The request {@link HostingApiRemoveCustomDomainRequest}
512
+ * @returns A Promise of HostingSummary
513
+ */
514
+ removeCustomDomain = (request) => this.client.fetch({
515
+ body: JSON.stringify(marshalHostingApiRemoveCustomDomainRequest(request, this.client.settings)),
516
+ headers: jsonContentHeaders,
517
+ method: "POST",
518
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/remove-custom-domain`
519
+ }, unmarshalHostingSummary);
520
+ /**
521
+ * Migrate a hosting to a new control panel.. Migrate a hosting to a new control panel.
522
+ *
523
+ * @param request - The request {@link HostingApiMigrateControlPanelRequest}
524
+ * @returns A Promise of HostingSummary
525
+ */
526
+ migrateControlPanel = (request) => this.client.fetch({
527
+ body: JSON.stringify(marshalHostingApiMigrateControlPanelRequest(request, this.client.settings)),
528
+ headers: jsonContentHeaders,
529
+ method: "POST",
530
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/migrate-control-panel`
531
+ }, unmarshalHostingSummary);
532
+ /**
533
+ * Reset a Web Hosting plan. Reset a Web Hosting plan to its initial state, specified by its `hosting_id`. This permanently deletes all hosting data including files, databases and emails. The hosting will be re-provisioned.
534
+ *
535
+ * @param request - The request {@link HostingApiResetHostingRequest}
536
+ * @returns A Promise of Hosting
537
+ */
538
+ resetHosting = (request) => this.client.fetch({
539
+ body: "{}",
540
+ headers: jsonContentHeaders,
541
+ method: "POST",
542
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/reset`
543
+ }, unmarshalHosting);
544
+ /**
545
+ * Delete domains from a Web Hosting plan. Remove one or more domains from a Web Hosting plan, specified by its `hosting_id`. This permanently deletes the domains and all services tied to them, including mailboxes, FTP accounts and DNS zones.
546
+ *
547
+ * @param request - The request {@link HostingApiDeleteHostingDomainsRequest}
548
+ * @returns A Promise of Hosting
549
+ */
550
+ deleteHostingDomains = (request) => this.client.fetch({
551
+ body: JSON.stringify(marshalHostingApiDeleteHostingDomainsRequest(request, this.client.settings)),
552
+ headers: jsonContentHeaders,
553
+ method: "POST",
554
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/delete-domains`
555
+ }, unmarshalHosting);
556
+ /**
557
+ * Update the free domain of a Web Hosting plan. Change the free domain associated with a Web Hosting plan, specified by its `hosting_id`.
558
+ *
559
+ * @param request - The request {@link HostingApiUpdateHostingFreeDomainRequest}
560
+ * @returns A Promise of Hosting
561
+ */
562
+ updateHostingFreeDomain = (request) => this.client.fetch({
563
+ body: JSON.stringify(marshalHostingApiUpdateHostingFreeDomainRequest(request, this.client.settings)),
564
+ headers: jsonContentHeaders,
565
+ method: "PATCH",
566
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/update-free-domain`
567
+ }, unmarshalHosting);
568
+ };
569
+ /**
570
+ * Web Hosting free domain API.
571
+
572
+ This API allows you to list and check a free domain's validity.
573
+ */
574
+ var FreeDomainAPI = class extends API {
575
+ /**
576
+ * Locality of this API.
577
+ * type ∈ {'zone','region','global','unspecified'}
578
+ */
579
+ static LOCALITY = toApiLocality({ regions: [
580
+ "fr-par",
581
+ "nl-ams",
582
+ "pl-waw"
583
+ ] });
584
+ /**
585
+ * Check whether a given slug and free domain combination is available.. Check whether a given slug and free domain combination is available.
586
+ *
587
+ * @param request - The request {@link FreeDomainApiCheckFreeDomainAvailabilityRequest}
588
+ * @returns A Promise of CheckFreeDomainAvailabilityResponse
589
+ */
590
+ checkFreeDomainAvailability = (request) => this.client.fetch({
591
+ body: JSON.stringify(marshalFreeDomainApiCheckFreeDomainAvailabilityRequest(request, this.client.settings)),
592
+ headers: jsonContentHeaders,
593
+ method: "POST",
594
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/free-domains/check-availability`
595
+ }, unmarshalCheckFreeDomainAvailabilityResponse);
596
+ pageOfListFreeRootDomains = (request = {}) => this.client.fetch({
597
+ method: "GET",
598
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/free-domains/root-domains`,
599
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
600
+ }, unmarshalListFreeRootDomainsResponse);
601
+ /**
602
+ * Retrieve the list of free root domains available for a Web Hosting.. Retrieve the list of free root domains available for a Web Hosting.
603
+ *
604
+ * @param request - The request {@link FreeDomainApiListFreeRootDomainsRequest}
605
+ * @returns A Promise of ListFreeRootDomainsResponse
606
+ */
607
+ listFreeRootDomains = (request = {}) => enrichForPagination("rootDomains", this.pageOfListFreeRootDomains, request);
608
+ };
609
+ /**
610
+ * Web Hosting FTP Account API.
611
+
612
+ This API allows you to manage your FTP accounts for your Web Hosting services.
613
+ */
614
+ var FtpAccountAPI = class extends API {
615
+ /**
616
+ * Locality of this API.
617
+ * type ∈ {'zone','region','global','unspecified'}
618
+ */
619
+ static LOCALITY = toApiLocality({ regions: [
620
+ "fr-par",
621
+ "nl-ams",
622
+ "pl-waw"
623
+ ] });
624
+ /**
625
+ * Create a new FTP account within your hosting plan.. Create a new FTP account within your hosting plan.
626
+ *
627
+ * @param request - The request {@link FtpAccountApiCreateFtpAccountRequest}
628
+ * @returns A Promise of FtpAccount
629
+ */
630
+ createFtpAccount = (request) => this.client.fetch({
631
+ body: JSON.stringify(marshalFtpAccountApiCreateFtpAccountRequest(request, this.client.settings)),
632
+ headers: jsonContentHeaders,
633
+ method: "POST",
634
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts`
635
+ }, unmarshalFtpAccount);
636
+ pageOfListFtpAccounts = (request) => this.client.fetch({
637
+ method: "GET",
638
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts`,
639
+ urlParams: urlParams(["domain", request.domain], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
640
+ }, unmarshalListFtpAccountsResponse);
641
+ /**
642
+ * List all FTP accounts within your hosting plan.. List all FTP accounts within your hosting plan.
643
+ *
644
+ * @param request - The request {@link FtpAccountApiListFtpAccountsRequest}
645
+ * @returns A Promise of ListFtpAccountsResponse
646
+ */
647
+ listFtpAccounts = (request) => enrichForPagination("ftpAccounts", this.pageOfListFtpAccounts, request);
648
+ /**
649
+ * Delete a specific FTP account within your hosting plan.. Delete a specific FTP account within your hosting plan.
650
+ *
651
+ * @param request - The request {@link FtpAccountApiRemoveFtpAccountRequest}
652
+ * @returns A Promise of FtpAccount
653
+ */
654
+ removeFtpAccount = (request) => this.client.fetch({
655
+ method: "DELETE",
656
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts/${validatePathParam("username", request.username)}`
657
+ }, unmarshalFtpAccount);
658
+ changeFtpAccountPassword = (request) => this.client.fetch({
659
+ body: JSON.stringify(marshalFtpAccountApiChangeFtpAccountPasswordRequest(request, this.client.settings)),
660
+ headers: jsonContentHeaders,
661
+ method: "POST",
662
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/ftp-accounts/${validatePathParam("username", request.username)}/change-password`
663
+ }, unmarshalFtpAccount);
664
+ };
665
+ /**
666
+ * Web Hosting Mail Account API.
667
+
668
+ This API allows you to manage your mail accounts for your Web Hosting services.
669
+ */
670
+ var MailAccountAPI = class extends API {
671
+ /**
672
+ * Locality of this API.
673
+ * type ∈ {'zone','region','global','unspecified'}
674
+ */
675
+ static LOCALITY = toApiLocality({ regions: [
676
+ "fr-par",
677
+ "nl-ams",
678
+ "pl-waw"
679
+ ] });
680
+ /**
681
+ * Create a new mail account within your hosting plan.. Create a new mail account within your hosting plan.
682
+ *
683
+ * @param request - The request {@link MailAccountApiCreateMailAccountRequest}
684
+ * @returns A Promise of MailAccount
685
+ */
686
+ createMailAccount = (request) => this.client.fetch({
687
+ body: JSON.stringify(marshalMailAccountApiCreateMailAccountRequest(request, this.client.settings)),
688
+ headers: jsonContentHeaders,
689
+ method: "POST",
690
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/mail-accounts`
691
+ }, unmarshalMailAccount);
692
+ pageOfListMailAccounts = (request) => this.client.fetch({
693
+ method: "GET",
694
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/mail-accounts`,
695
+ urlParams: urlParams(["domain", request.domain], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
696
+ }, unmarshalListMailAccountsResponse);
697
+ /**
698
+ * List all mail accounts within your hosting plan.. List all mail accounts within your hosting plan.
699
+ *
700
+ * @param request - The request {@link MailAccountApiListMailAccountsRequest}
701
+ * @returns A Promise of ListMailAccountsResponse
702
+ */
703
+ listMailAccounts = (request) => enrichForPagination("mailAccounts", this.pageOfListMailAccounts, request);
704
+ /**
705
+ * Delete a mail account within your hosting plan.. Delete a mail account within your hosting plan.
706
+ *
707
+ * @param request - The request {@link MailAccountApiRemoveMailAccountRequest}
708
+ * @returns A Promise of MailAccount
709
+ */
710
+ removeMailAccount = (request) => this.client.fetch({
711
+ body: JSON.stringify(marshalMailAccountApiRemoveMailAccountRequest(request, this.client.settings)),
712
+ headers: jsonContentHeaders,
713
+ method: "POST",
714
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/remove-mail-account`
715
+ }, unmarshalMailAccount);
716
+ /**
717
+ * Update the password of a mail account within your hosting plan.. Update the password of a mail account within your hosting plan.
718
+ *
719
+ * @param request - The request {@link MailAccountApiChangeMailAccountPasswordRequest}
720
+ * @returns A Promise of MailAccount
721
+ */
722
+ changeMailAccountPassword = (request) => this.client.fetch({
723
+ body: JSON.stringify(marshalMailAccountApiChangeMailAccountPasswordRequest(request, this.client.settings)),
724
+ headers: jsonContentHeaders,
725
+ method: "POST",
726
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/change-mail-password`
727
+ }, unmarshalMailAccount);
728
+ };
729
+ /**
730
+ * Web Hosting Website API.
731
+
732
+ This API allows you to manage your websites for your Web Hosting services.
733
+ */
734
+ var WebsiteAPI = class extends API {
735
+ /**
736
+ * Locality of this API.
737
+ * type ∈ {'zone','region','global','unspecified'}
738
+ */
739
+ static LOCALITY = toApiLocality({ regions: [
740
+ "fr-par",
741
+ "nl-ams",
742
+ "pl-waw"
743
+ ] });
744
+ pageOfListWebsites = (request) => this.client.fetch({
745
+ method: "GET",
746
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites`,
747
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
748
+ }, unmarshalListWebsitesResponse);
749
+ /**
750
+ * List all websites for a specific hosting.. List all websites for a specific hosting.
751
+ *
752
+ * @param request - The request {@link WebsiteApiListWebsitesRequest}
753
+ * @returns A Promise of ListWebsitesResponse
754
+ */
755
+ listWebsites = (request) => enrichForPagination("websites", this.pageOfListWebsites, request);
756
+ /**
757
+ * Create a new website and attach it to a webhosting.
758
+ *
759
+ * @param request - The request {@link WebsiteApiCreateWebsiteRequest}
760
+ * @returns A Promise of Website
761
+ */
762
+ createWebsite = (request) => this.client.fetch({
763
+ body: JSON.stringify(marshalWebsiteApiCreateWebsiteRequest(request, this.client.settings)),
764
+ headers: jsonContentHeaders,
765
+ method: "POST",
766
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites`
767
+ }, unmarshalWebsite);
768
+ /**
769
+ * Delete a website from a webhosting.
770
+ *
771
+ * @param request - The request {@link WebsiteApiDeleteWebsiteRequest}
772
+ */
773
+ deleteWebsite = (request) => this.client.fetch({
774
+ method: "DELETE",
775
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites/${validatePathParam("domainName", request.domainName)}`
776
+ });
777
+ /**
778
+ * Delete a website's content, all files and directories. This. Permanently deletes data including files and configurations. The
779
+ website will display the default welcome page.
780
+ *
781
+ * @param request - The request {@link WebsiteApiResetWebsiteRequest}
782
+ * @returns A Promise of Website
783
+ */
784
+ resetWebsite = (request) => this.client.fetch({
785
+ body: "{}",
786
+ headers: jsonContentHeaders,
787
+ method: "POST",
788
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites/${validatePathParam("domainName", request.domainName)}/reset`
789
+ }, unmarshalWebsite);
790
+ };
791
+ export { BackupAPI, ControlPanelAPI, DatabaseAPI, DnsAPI, FreeDomainAPI, FtpAccountAPI, HostingAPI, MailAccountAPI, OfferAPI, WebsiteAPI };