@scaleway/sdk-webhosting 1.3.0 → 2.1.1

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,6 +1,6 @@
1
1
  import { API, toApiLocality, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
2
  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, marshalFreeDomainApiCheckFreeDomainAvailabilityRequest, unmarshalCheckFreeDomainAvailabilityResponse, unmarshalListFreeRootDomainsResponse, marshalFtpAccountApiCreateFtpAccountRequest, unmarshalFtpAccount, unmarshalListFtpAccountsResponse, marshalFtpAccountApiChangeFtpAccountPasswordRequest, marshalMailAccountApiCreateMailAccountRequest, unmarshalMailAccount, unmarshalListMailAccountsResponse, marshalMailAccountApiRemoveMailAccountRequest, marshalMailAccountApiChangeMailAccountPasswordRequest, unmarshalListWebsitesResponse } from "./marshalling.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, marshalFreeDomainApiCheckFreeDomainAvailabilityRequest, unmarshalCheckFreeDomainAvailabilityResponse, unmarshalListFreeRootDomainsResponse, marshalFtpAccountApiCreateFtpAccountRequest, unmarshalFtpAccount, unmarshalListFtpAccountsResponse, marshalFtpAccountApiChangeFtpAccountPasswordRequest, marshalMailAccountApiCreateMailAccountRequest, unmarshalMailAccount, unmarshalListMailAccountsResponse, marshalMailAccountApiRemoveMailAccountRequest, marshalMailAccountApiChangeMailAccountPasswordRequest, unmarshalListWebsitesResponse, marshalWebsiteApiCreateWebsiteRequest, unmarshalWebsite } from "./marshalling.gen.js";
4
4
  const jsonContentHeaders = {
5
5
  "Content-Type": "application/json; charset=utf-8"
6
6
  };
@@ -10,7 +10,11 @@ class BackupAPI extends API {
10
10
  * type ∈ {'zone','region','global','unspecified'}
11
11
  */
12
12
  static LOCALITY = toApiLocality({
13
- regions: ["fr-par", "nl-ams", "pl-waw"]
13
+ regions: [
14
+ "fr-par",
15
+ "nl-ams",
16
+ "pl-waw"
17
+ ]
14
18
  });
15
19
  pageOfListBackups = (request) => this.client.fetch(
16
20
  {
@@ -19,10 +23,7 @@ class BackupAPI extends API {
19
23
  urlParams: urlParams(
20
24
  ["order_by", request.orderBy],
21
25
  ["page", request.page],
22
- [
23
- "page_size",
24
- request.pageSize ?? this.client.settings.defaultPageSize
25
- ]
26
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
26
27
  )
27
28
  },
28
29
  unmarshalListBackupsResponse
@@ -55,9 +56,7 @@ class BackupAPI extends API {
55
56
  * @returns A Promise of Backup
56
57
  */
57
58
  waitForBackup = (request, options) => waitForResource(
58
- options?.stop ?? ((res) => Promise.resolve(
59
- !BACKUP_TRANSIENT_STATUSES.includes(res.status)
60
- )),
59
+ options?.stop ?? ((res) => Promise.resolve(!BACKUP_TRANSIENT_STATUSES.includes(res.status))),
61
60
  this.getBackup,
62
61
  request,
63
62
  options
@@ -87,7 +86,9 @@ class BackupAPI extends API {
87
86
  {
88
87
  method: "GET",
89
88
  path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/backup-items`,
90
- urlParams: urlParams(["backup_id", request.backupId])
89
+ urlParams: urlParams(
90
+ ["backup_id", request.backupId]
91
+ )
91
92
  },
92
93
  unmarshalListBackupItemsResponse
93
94
  );
@@ -100,10 +101,7 @@ class BackupAPI extends API {
100
101
  restoreBackupItems = (request) => this.client.fetch(
101
102
  {
102
103
  body: JSON.stringify(
103
- marshalBackupApiRestoreBackupItemsRequest(
104
- request,
105
- this.client.settings
106
- )
104
+ marshalBackupApiRestoreBackupItemsRequest(request, this.client.settings)
107
105
  ),
108
106
  headers: jsonContentHeaders,
109
107
  method: "POST",
@@ -144,7 +142,11 @@ class ControlPanelAPI extends API {
144
142
  * type ∈ {'zone','region','global','unspecified'}
145
143
  */
146
144
  static LOCALITY = toApiLocality({
147
- regions: ["fr-par", "nl-ams", "pl-waw"]
145
+ regions: [
146
+ "fr-par",
147
+ "nl-ams",
148
+ "pl-waw"
149
+ ]
148
150
  });
149
151
  pageOfListControlPanels = (request = {}) => this.client.fetch(
150
152
  {
@@ -152,10 +154,7 @@ class ControlPanelAPI extends API {
152
154
  path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/control-panels`,
153
155
  urlParams: urlParams(
154
156
  ["page", request.page],
155
- [
156
- "page_size",
157
- request.pageSize ?? this.client.settings.defaultPageSize
158
- ]
157
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
159
158
  )
160
159
  },
161
160
  unmarshalListControlPanelsResponse
@@ -174,7 +173,11 @@ class DatabaseAPI extends API {
174
173
  * type ∈ {'zone','region','global','unspecified'}
175
174
  */
176
175
  static LOCALITY = toApiLocality({
177
- regions: ["fr-par", "nl-ams", "pl-waw"]
176
+ regions: [
177
+ "fr-par",
178
+ "nl-ams",
179
+ "pl-waw"
180
+ ]
178
181
  });
179
182
  /**
180
183
  * "Create a new database within your hosting plan".
@@ -185,10 +188,7 @@ class DatabaseAPI extends API {
185
188
  createDatabase = (request) => this.client.fetch(
186
189
  {
187
190
  body: JSON.stringify(
188
- marshalDatabaseApiCreateDatabaseRequest(
189
- request,
190
- this.client.settings
191
- )
191
+ marshalDatabaseApiCreateDatabaseRequest(request, this.client.settings)
192
192
  ),
193
193
  headers: jsonContentHeaders,
194
194
  method: "POST",
@@ -203,10 +203,7 @@ class DatabaseAPI extends API {
203
203
  urlParams: urlParams(
204
204
  ["order_by", request.orderBy],
205
205
  ["page", request.page],
206
- [
207
- "page_size",
208
- request.pageSize ?? this.client.settings.defaultPageSize
209
- ]
206
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
210
207
  )
211
208
  },
212
209
  unmarshalListDatabasesResponse
@@ -253,10 +250,7 @@ class DatabaseAPI extends API {
253
250
  createDatabaseUser = (request) => this.client.fetch(
254
251
  {
255
252
  body: JSON.stringify(
256
- marshalDatabaseApiCreateDatabaseUserRequest(
257
- request,
258
- this.client.settings
259
- )
253
+ marshalDatabaseApiCreateDatabaseUserRequest(request, this.client.settings)
260
254
  ),
261
255
  headers: jsonContentHeaders,
262
256
  method: "POST",
@@ -271,10 +265,7 @@ class DatabaseAPI extends API {
271
265
  urlParams: urlParams(
272
266
  ["order_by", request.orderBy],
273
267
  ["page", request.page],
274
- [
275
- "page_size",
276
- request.pageSize ?? this.client.settings.defaultPageSize
277
- ]
268
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
278
269
  )
279
270
  },
280
271
  unmarshalListDatabaseUsersResponse
@@ -321,10 +312,7 @@ class DatabaseAPI extends API {
321
312
  changeDatabaseUserPassword = (request) => this.client.fetch(
322
313
  {
323
314
  body: JSON.stringify(
324
- marshalDatabaseApiChangeDatabaseUserPasswordRequest(
325
- request,
326
- this.client.settings
327
- )
315
+ marshalDatabaseApiChangeDatabaseUserPasswordRequest(request, this.client.settings)
328
316
  ),
329
317
  headers: jsonContentHeaders,
330
318
  method: "POST",
@@ -341,10 +329,7 @@ class DatabaseAPI extends API {
341
329
  assignDatabaseUser = (request) => this.client.fetch(
342
330
  {
343
331
  body: JSON.stringify(
344
- marshalDatabaseApiAssignDatabaseUserRequest(
345
- request,
346
- this.client.settings
347
- )
332
+ marshalDatabaseApiAssignDatabaseUserRequest(request, this.client.settings)
348
333
  ),
349
334
  headers: jsonContentHeaders,
350
335
  method: "POST",
@@ -361,10 +346,7 @@ class DatabaseAPI extends API {
361
346
  unassignDatabaseUser = (request) => this.client.fetch(
362
347
  {
363
348
  body: JSON.stringify(
364
- marshalDatabaseApiUnassignDatabaseUserRequest(
365
- request,
366
- this.client.settings
367
- )
349
+ marshalDatabaseApiUnassignDatabaseUserRequest(request, this.client.settings)
368
350
  ),
369
351
  headers: jsonContentHeaders,
370
352
  method: "POST",
@@ -379,7 +361,11 @@ class DnsAPI extends API {
379
361
  * type ∈ {'zone','region','global','unspecified'}
380
362
  */
381
363
  static LOCALITY = toApiLocality({
382
- regions: ["fr-par", "nl-ams", "pl-waw"]
364
+ regions: [
365
+ "fr-par",
366
+ "nl-ams",
367
+ "pl-waw"
368
+ ]
383
369
  });
384
370
  /**
385
371
  * Get DNS records. Get the set of DNS records of a specified domain associated with a Web Hosting plan's domain.
@@ -404,10 +390,7 @@ class DnsAPI extends API {
404
390
  checkUserOwnsDomain = (request) => this.client.fetch(
405
391
  {
406
392
  body: JSON.stringify(
407
- marshalDnsApiCheckUserOwnsDomainRequest(
408
- request,
409
- this.client.settings
410
- )
393
+ marshalDnsApiCheckUserOwnsDomainRequest(request, this.client.settings)
411
394
  ),
412
395
  headers: jsonContentHeaders,
413
396
  method: "POST",
@@ -424,10 +407,7 @@ class DnsAPI extends API {
424
407
  syncDomainDnsRecords = (request) => this.client.fetch(
425
408
  {
426
409
  body: JSON.stringify(
427
- marshalDnsApiSyncDomainDnsRecordsRequest(
428
- request,
429
- this.client.settings
430
- )
410
+ marshalDnsApiSyncDomainDnsRecordsRequest(request, this.client.settings)
431
411
  ),
432
412
  headers: jsonContentHeaders,
433
413
  method: "POST",
@@ -447,10 +427,7 @@ class DnsAPI extends API {
447
427
  path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/search-domains`,
448
428
  urlParams: urlParams(
449
429
  ["domain_name", request.domainName],
450
- [
451
- "project_id",
452
- request.projectId ?? this.client.settings.defaultProjectId
453
- ]
430
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
454
431
  )
455
432
  },
456
433
  unmarshalSearchDomainsResponse
@@ -465,10 +442,9 @@ class DnsAPI extends API {
465
442
  {
466
443
  method: "GET",
467
444
  path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainName", request.domainName)}`,
468
- urlParams: urlParams([
469
- "project_id",
470
- request.projectId ?? this.client.settings.defaultProjectId
471
- ])
445
+ urlParams: urlParams(
446
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
447
+ )
472
448
  },
473
449
  unmarshalDomain
474
450
  );
@@ -480,9 +456,7 @@ class DnsAPI extends API {
480
456
  * @returns A Promise of Domain
481
457
  */
482
458
  waitForDomain = (request, options) => waitForResource(
483
- options?.stop ?? ((res) => Promise.resolve(
484
- !DOMAIN_TRANSIENT_STATUSES.includes(res.status)
485
- )),
459
+ options?.stop ?? ((res) => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))),
486
460
  this.getDomain,
487
461
  request,
488
462
  options
@@ -494,7 +468,11 @@ class OfferAPI extends API {
494
468
  * type ∈ {'zone','region','global','unspecified'}
495
469
  */
496
470
  static LOCALITY = toApiLocality({
497
- regions: ["fr-par", "nl-ams", "pl-waw"]
471
+ regions: [
472
+ "fr-par",
473
+ "nl-ams",
474
+ "pl-waw"
475
+ ]
498
476
  });
499
477
  pageOfListOffers = (request = {}) => this.client.fetch(
500
478
  {
@@ -505,10 +483,7 @@ class OfferAPI extends API {
505
483
  ["hosting_id", request.hostingId],
506
484
  ["order_by", request.orderBy],
507
485
  ["page", request.page],
508
- [
509
- "page_size",
510
- request.pageSize ?? this.client.settings.defaultPageSize
511
- ]
486
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
512
487
  )
513
488
  },
514
489
  unmarshalListOffersResponse
@@ -527,7 +502,11 @@ class HostingAPI extends API {
527
502
  * type ∈ {'zone','region','global','unspecified'}
528
503
  */
529
504
  static LOCALITY = toApiLocality({
530
- regions: ["fr-par", "nl-ams", "pl-waw"]
505
+ regions: [
506
+ "fr-par",
507
+ "nl-ams",
508
+ "pl-waw"
509
+ ]
531
510
  });
532
511
  /**
533
512
  * Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer type required via the `offer_id` parameter.
@@ -556,10 +535,7 @@ class HostingAPI extends API {
556
535
  ["order_by", request.orderBy],
557
536
  ["organization_id", request.organizationId],
558
537
  ["page", request.page],
559
- [
560
- "page_size",
561
- request.pageSize ?? this.client.settings.defaultPageSize
562
- ],
538
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
563
539
  ["project_id", request.projectId],
564
540
  ["statuses", request.statuses],
565
541
  ["subdomain", request.subdomain],
@@ -596,9 +572,7 @@ class HostingAPI extends API {
596
572
  * @returns A Promise of Hosting
597
573
  */
598
574
  waitForHosting = (request, options) => waitForResource(
599
- options?.stop ?? ((res) => Promise.resolve(
600
- !HOSTING_TRANSIENT_STATUSES.includes(res.status)
601
- )),
575
+ options?.stop ?? ((res) => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))),
602
576
  this.getHosting,
603
577
  request,
604
578
  options
@@ -677,7 +651,7 @@ class HostingAPI extends API {
677
651
  unmarshalResourceSummary
678
652
  );
679
653
  /**
680
- * Attach a custom domain to a webhosting.
654
+ * Attach a custom domain to a webhosting as an alias to the main domain.
681
655
  *
682
656
  * @param request - The request {@link HostingApiAddCustomDomainRequest}
683
657
  * @returns A Promise of HostingSummary
@@ -685,10 +659,7 @@ class HostingAPI extends API {
685
659
  addCustomDomain = (request) => this.client.fetch(
686
660
  {
687
661
  body: JSON.stringify(
688
- marshalHostingApiAddCustomDomainRequest(
689
- request,
690
- this.client.settings
691
- )
662
+ marshalHostingApiAddCustomDomainRequest(request, this.client.settings)
692
663
  ),
693
664
  headers: jsonContentHeaders,
694
665
  method: "POST",
@@ -705,10 +676,7 @@ class HostingAPI extends API {
705
676
  removeCustomDomain = (request) => this.client.fetch(
706
677
  {
707
678
  body: JSON.stringify(
708
- marshalHostingApiRemoveCustomDomainRequest(
709
- request,
710
- this.client.settings
711
- )
679
+ marshalHostingApiRemoveCustomDomainRequest(request, this.client.settings)
712
680
  ),
713
681
  headers: jsonContentHeaders,
714
682
  method: "POST",
@@ -716,6 +684,23 @@ class HostingAPI extends API {
716
684
  },
717
685
  unmarshalHostingSummary
718
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
+ );
719
704
  }
720
705
  class FreeDomainAPI extends API {
721
706
  /**
@@ -723,7 +708,11 @@ class FreeDomainAPI extends API {
723
708
  * type ∈ {'zone','region','global','unspecified'}
724
709
  */
725
710
  static LOCALITY = toApiLocality({
726
- regions: ["fr-par", "nl-ams", "pl-waw"]
711
+ regions: [
712
+ "fr-par",
713
+ "nl-ams",
714
+ "pl-waw"
715
+ ]
727
716
  });
728
717
  /**
729
718
  * Check whether a given slug and free domain combination is available.. Check whether a given slug and free domain combination is available.
@@ -734,10 +723,7 @@ class FreeDomainAPI extends API {
734
723
  checkFreeDomainAvailability = (request) => this.client.fetch(
735
724
  {
736
725
  body: JSON.stringify(
737
- marshalFreeDomainApiCheckFreeDomainAvailabilityRequest(
738
- request,
739
- this.client.settings
740
- )
726
+ marshalFreeDomainApiCheckFreeDomainAvailabilityRequest(request, this.client.settings)
741
727
  ),
742
728
  headers: jsonContentHeaders,
743
729
  method: "POST",
@@ -751,10 +737,7 @@ class FreeDomainAPI extends API {
751
737
  path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/free-domains/root-domains`,
752
738
  urlParams: urlParams(
753
739
  ["page", request.page],
754
- [
755
- "page_size",
756
- request.pageSize ?? this.client.settings.defaultPageSize
757
- ]
740
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
758
741
  )
759
742
  },
760
743
  unmarshalListFreeRootDomainsResponse
@@ -773,7 +756,11 @@ class FtpAccountAPI extends API {
773
756
  * type ∈ {'zone','region','global','unspecified'}
774
757
  */
775
758
  static LOCALITY = toApiLocality({
776
- regions: ["fr-par", "nl-ams", "pl-waw"]
759
+ regions: [
760
+ "fr-par",
761
+ "nl-ams",
762
+ "pl-waw"
763
+ ]
777
764
  });
778
765
  /**
779
766
  * Create a new FTP account within your hosting plan.. Create a new FTP account within your hosting plan.
@@ -784,10 +771,7 @@ class FtpAccountAPI extends API {
784
771
  createFtpAccount = (request) => this.client.fetch(
785
772
  {
786
773
  body: JSON.stringify(
787
- marshalFtpAccountApiCreateFtpAccountRequest(
788
- request,
789
- this.client.settings
790
- )
774
+ marshalFtpAccountApiCreateFtpAccountRequest(request, this.client.settings)
791
775
  ),
792
776
  headers: jsonContentHeaders,
793
777
  method: "POST",
@@ -803,10 +787,7 @@ class FtpAccountAPI extends API {
803
787
  ["domain", request.domain],
804
788
  ["order_by", request.orderBy],
805
789
  ["page", request.page],
806
- [
807
- "page_size",
808
- request.pageSize ?? this.client.settings.defaultPageSize
809
- ]
790
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
810
791
  )
811
792
  },
812
793
  unmarshalListFtpAccountsResponse
@@ -834,10 +815,7 @@ class FtpAccountAPI extends API {
834
815
  changeFtpAccountPassword = (request) => this.client.fetch(
835
816
  {
836
817
  body: JSON.stringify(
837
- marshalFtpAccountApiChangeFtpAccountPasswordRequest(
838
- request,
839
- this.client.settings
840
- )
818
+ marshalFtpAccountApiChangeFtpAccountPasswordRequest(request, this.client.settings)
841
819
  ),
842
820
  headers: jsonContentHeaders,
843
821
  method: "POST",
@@ -852,7 +830,11 @@ class MailAccountAPI extends API {
852
830
  * type ∈ {'zone','region','global','unspecified'}
853
831
  */
854
832
  static LOCALITY = toApiLocality({
855
- regions: ["fr-par", "nl-ams", "pl-waw"]
833
+ regions: [
834
+ "fr-par",
835
+ "nl-ams",
836
+ "pl-waw"
837
+ ]
856
838
  });
857
839
  /**
858
840
  * Create a new mail account within your hosting plan.. Create a new mail account within your hosting plan.
@@ -863,10 +845,7 @@ class MailAccountAPI extends API {
863
845
  createMailAccount = (request) => this.client.fetch(
864
846
  {
865
847
  body: JSON.stringify(
866
- marshalMailAccountApiCreateMailAccountRequest(
867
- request,
868
- this.client.settings
869
- )
848
+ marshalMailAccountApiCreateMailAccountRequest(request, this.client.settings)
870
849
  ),
871
850
  headers: jsonContentHeaders,
872
851
  method: "POST",
@@ -882,10 +861,7 @@ class MailAccountAPI extends API {
882
861
  ["domain", request.domain],
883
862
  ["order_by", request.orderBy],
884
863
  ["page", request.page],
885
- [
886
- "page_size",
887
- request.pageSize ?? this.client.settings.defaultPageSize
888
- ]
864
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
889
865
  )
890
866
  },
891
867
  unmarshalListMailAccountsResponse
@@ -906,10 +882,7 @@ class MailAccountAPI extends API {
906
882
  removeMailAccount = (request) => this.client.fetch(
907
883
  {
908
884
  body: JSON.stringify(
909
- marshalMailAccountApiRemoveMailAccountRequest(
910
- request,
911
- this.client.settings
912
- )
885
+ marshalMailAccountApiRemoveMailAccountRequest(request, this.client.settings)
913
886
  ),
914
887
  headers: jsonContentHeaders,
915
888
  method: "POST",
@@ -926,10 +899,7 @@ class MailAccountAPI extends API {
926
899
  changeMailAccountPassword = (request) => this.client.fetch(
927
900
  {
928
901
  body: JSON.stringify(
929
- marshalMailAccountApiChangeMailAccountPasswordRequest(
930
- request,
931
- this.client.settings
932
- )
902
+ marshalMailAccountApiChangeMailAccountPasswordRequest(request, this.client.settings)
933
903
  ),
934
904
  headers: jsonContentHeaders,
935
905
  method: "POST",
@@ -944,7 +914,11 @@ class WebsiteAPI extends API {
944
914
  * type ∈ {'zone','region','global','unspecified'}
945
915
  */
946
916
  static LOCALITY = toApiLocality({
947
- regions: ["fr-par", "nl-ams", "pl-waw"]
917
+ regions: [
918
+ "fr-par",
919
+ "nl-ams",
920
+ "pl-waw"
921
+ ]
948
922
  });
949
923
  pageOfListWebsites = (request) => this.client.fetch(
950
924
  {
@@ -953,10 +927,7 @@ class WebsiteAPI extends API {
953
927
  urlParams: urlParams(
954
928
  ["order_by", request.orderBy],
955
929
  ["page", request.page],
956
- [
957
- "page_size",
958
- request.pageSize ?? this.client.settings.defaultPageSize
959
- ]
930
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
960
931
  )
961
932
  },
962
933
  unmarshalListWebsitesResponse
@@ -968,6 +939,34 @@ class WebsiteAPI extends API {
968
939
  * @returns A Promise of ListWebsitesResponse
969
940
  */
970
941
  listWebsites = (request) => enrichForPagination("websites", this.pageOfListWebsites, request);
942
+ /**
943
+ * Create a new website and attach it to a webhosting.
944
+ *
945
+ * @param request - The request {@link WebsiteApiCreateWebsiteRequest}
946
+ * @returns A Promise of Website
947
+ */
948
+ createWebsite = (request) => this.client.fetch(
949
+ {
950
+ body: JSON.stringify(
951
+ marshalWebsiteApiCreateWebsiteRequest(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)}/websites`
956
+ },
957
+ unmarshalWebsite
958
+ );
959
+ /**
960
+ * Delete a website from a webhosting.
961
+ *
962
+ * @param request - The request {@link WebsiteApiDeleteWebsiteRequest}
963
+ */
964
+ deleteWebsite = (request) => this.client.fetch(
965
+ {
966
+ method: "DELETE",
967
+ path: `/webhosting/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam("hostingId", request.hostingId)}/websites/${validatePathParam("domainName", request.domainName)}`
968
+ }
969
+ );
971
970
  }
972
971
  export {
973
972
  BackupAPI,
@@ -1,6 +1,12 @@
1
- const BACKUP_TRANSIENT_STATUSES = ["restoring"];
2
- const DOMAIN_AVAILABILITY_TRANSIENT_STATUSES = ["validating"];
3
- const DOMAIN_TRANSIENT_STATUSES = ["validating"];
1
+ const BACKUP_TRANSIENT_STATUSES = [
2
+ "restoring"
3
+ ];
4
+ const DOMAIN_AVAILABILITY_TRANSIENT_STATUSES = [
5
+ "validating"
6
+ ];
7
+ const DOMAIN_TRANSIENT_STATUSES = [
8
+ "validating"
9
+ ];
4
10
  const HOSTING_TRANSIENT_STATUSES = [
5
11
  "delivering",
6
12
  "deleting",
@@ -1,5 +1,5 @@
1
1
  export { BackupAPI, ControlPanelAPI, DatabaseAPI, DnsAPI, FreeDomainAPI, FtpAccountAPI, HostingAPI, MailAccountAPI, OfferAPI, WebsiteAPI, } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
- export type { AutoConfigDomainDns, Backup, BackupApiGetBackupRequest, BackupApiGetProgressRequest, BackupApiListBackupItemsRequest, BackupApiListBackupsRequest, BackupApiListRecentProgressesRequest, BackupApiRestoreBackupItemsRequest, BackupApiRestoreBackupRequest, BackupItem, BackupItemGroup, BackupItemType, BackupStatus, CheckFreeDomainAvailabilityResponse, CheckFreeDomainAvailabilityResponseUnavailableReason, CheckUserOwnsDomainResponse, ControlPanel, ControlPanelApiListControlPanelsRequest, CreateDatabaseRequestUser, CreateHostingRequestDomainConfiguration, Database, DatabaseApiAssignDatabaseUserRequest, DatabaseApiChangeDatabaseUserPasswordRequest, DatabaseApiCreateDatabaseRequest, DatabaseApiCreateDatabaseUserRequest, DatabaseApiDeleteDatabaseRequest, DatabaseApiDeleteDatabaseUserRequest, DatabaseApiGetDatabaseRequest, DatabaseApiGetDatabaseUserRequest, DatabaseApiListDatabaseUsersRequest, DatabaseApiListDatabasesRequest, DatabaseApiUnassignDatabaseUserRequest, DatabaseUser, DnsApiCheckUserOwnsDomainRequest, DnsApiGetDomainDnsRecordsRequest, DnsApiGetDomainRequest, DnsApiSearchDomainsRequest, DnsApiSyncDomainDnsRecordsRequest, DnsRecord, DnsRecordStatus, DnsRecordType, DnsRecords, DnsRecordsStatus, Domain, DomainAction, DomainAvailability, DomainAvailabilityAction, DomainAvailabilityStatus, DomainDnsAction, DomainStatus, DomainZoneOwner, FreeDomain, FreeDomainApiCheckFreeDomainAvailabilityRequest, FreeDomainApiListFreeRootDomainsRequest, FtpAccount, FtpAccountApiChangeFtpAccountPasswordRequest, FtpAccountApiCreateFtpAccountRequest, FtpAccountApiListFtpAccountsRequest, FtpAccountApiRemoveFtpAccountRequest, Hosting, HostingApiAddCustomDomainRequest, HostingApiCreateHostingRequest, HostingApiCreateSessionRequest, HostingApiDeleteHostingRequest, HostingApiGetHostingRequest, HostingApiGetResourceSummaryRequest, HostingApiListHostingsRequest, HostingApiRemoveCustomDomainRequest, HostingApiResetHostingPasswordRequest, HostingApiUpdateHostingRequest, HostingDomain, HostingDomainCustomDomain, HostingStatus, HostingSummary, HostingUser, ListBackupItemsResponse, ListBackupsRequestOrderBy, ListBackupsResponse, ListControlPanelsResponse, ListDatabaseUsersRequestOrderBy, ListDatabaseUsersResponse, ListDatabasesRequestOrderBy, ListDatabasesResponse, ListFreeRootDomainsResponse, ListFtpAccountsRequestOrderBy, ListFtpAccountsResponse, ListHostingsRequestOrderBy, ListHostingsResponse, ListMailAccountsRequestOrderBy, ListMailAccountsResponse, ListOffersRequestOrderBy, ListOffersResponse, ListRecentProgressesResponse, ListWebsitesRequestOrderBy, ListWebsitesResponse, MailAccount, MailAccountApiChangeMailAccountPasswordRequest, MailAccountApiCreateMailAccountRequest, MailAccountApiListMailAccountsRequest, MailAccountApiRemoveMailAccountRequest, Nameserver, NameserverStatus, Offer, OfferApiListOffersRequest, OfferOption, OfferOptionName, OfferOptionRequest, OfferOptionWarning, Platform, PlatformControlPanel, PlatformControlPanelUrls, PlatformPlatformGroup, Progress, ProgressStatus, ProgressSummary, ResetHostingPasswordResponse, ResourceSummary, RestoreBackupItemsResponse, RestoreBackupResponse, SearchDomainsResponse, Session, SyncDomainDnsRecordsRequestRecord, Website, WebsiteApiListWebsitesRequest, } from './types.gen.js';
4
+ export type { AutoConfigDomainDns, Backup, BackupApiGetBackupRequest, BackupApiGetProgressRequest, BackupApiListBackupItemsRequest, BackupApiListBackupsRequest, BackupApiListRecentProgressesRequest, BackupApiRestoreBackupItemsRequest, BackupApiRestoreBackupRequest, BackupItem, BackupItemGroup, BackupItemType, BackupStatus, CheckFreeDomainAvailabilityResponse, CheckFreeDomainAvailabilityResponseUnavailableReason, CheckUserOwnsDomainResponse, ControlPanel, ControlPanelApiListControlPanelsRequest, CreateDatabaseRequestUser, CreateHostingRequestDomainConfiguration, Database, DatabaseApiAssignDatabaseUserRequest, DatabaseApiChangeDatabaseUserPasswordRequest, DatabaseApiCreateDatabaseRequest, DatabaseApiCreateDatabaseUserRequest, DatabaseApiDeleteDatabaseRequest, DatabaseApiDeleteDatabaseUserRequest, DatabaseApiGetDatabaseRequest, DatabaseApiGetDatabaseUserRequest, DatabaseApiListDatabasesRequest, DatabaseApiListDatabaseUsersRequest, DatabaseApiUnassignDatabaseUserRequest, DatabaseUser, DnsApiCheckUserOwnsDomainRequest, DnsApiGetDomainDnsRecordsRequest, DnsApiGetDomainRequest, DnsApiSearchDomainsRequest, DnsApiSyncDomainDnsRecordsRequest, DnsRecord, DnsRecordStatus, DnsRecords, DnsRecordsStatus, DnsRecordType, Domain, DomainAction, DomainAvailability, DomainAvailabilityAction, DomainAvailabilityStatus, DomainDnsAction, DomainStatus, DomainZoneOwner, FreeDomain, FreeDomainApiCheckFreeDomainAvailabilityRequest, FreeDomainApiListFreeRootDomainsRequest, FtpAccount, FtpAccountApiChangeFtpAccountPasswordRequest, FtpAccountApiCreateFtpAccountRequest, FtpAccountApiListFtpAccountsRequest, FtpAccountApiRemoveFtpAccountRequest, Hosting, HostingApiAddCustomDomainRequest, HostingApiCreateHostingRequest, HostingApiCreateSessionRequest, HostingApiDeleteHostingRequest, HostingApiGetHostingRequest, HostingApiGetResourceSummaryRequest, HostingApiListHostingsRequest, HostingApiMigrateControlPanelRequest, HostingApiRemoveCustomDomainRequest, HostingApiResetHostingPasswordRequest, HostingApiUpdateHostingRequest, HostingDomain, HostingDomainCustomDomain, HostingStatus, HostingSummary, HostingUser, ListBackupItemsResponse, ListBackupsRequestOrderBy, ListBackupsResponse, ListControlPanelsResponse, ListDatabasesRequestOrderBy, ListDatabasesResponse, ListDatabaseUsersRequestOrderBy, ListDatabaseUsersResponse, ListFreeRootDomainsResponse, ListFtpAccountsRequestOrderBy, ListFtpAccountsResponse, ListHostingsRequestOrderBy, ListHostingsResponse, ListMailAccountsRequestOrderBy, ListMailAccountsResponse, ListOffersRequestOrderBy, ListOffersResponse, ListRecentProgressesResponse, ListWebsitesRequestOrderBy, ListWebsitesResponse, MailAccount, MailAccountApiChangeMailAccountPasswordRequest, MailAccountApiCreateMailAccountRequest, MailAccountApiListMailAccountsRequest, MailAccountApiRemoveMailAccountRequest, Nameserver, NameserverStatus, Offer, OfferApiListOffersRequest, OfferOption, OfferOptionName, OfferOptionRequest, OfferOptionWarning, Platform, PlatformControlPanel, PlatformControlPanelUrls, PlatformPlatformGroup, Progress, ProgressStatus, ProgressSummary, ResetHostingPasswordResponse, ResourceSummary, RestoreBackupItemsResponse, RestoreBackupResponse, SearchDomainsResponse, Session, SyncDomainDnsRecordsRequestRecord, Website, WebsiteApiCreateWebsiteRequest, WebsiteApiDeleteWebsiteRequest, WebsiteApiListWebsitesRequest, } from './types.gen.js';
5
5
  export * as ValidationRules from './validation-rules.gen.js';
@@ -1,6 +1,6 @@
1
1
  import { BackupAPI, ControlPanelAPI, DatabaseAPI, DnsAPI, FreeDomainAPI, FtpAccountAPI, HostingAPI, MailAccountAPI, OfferAPI, WebsiteAPI } from "./api.gen.js";
2
2
  import { BACKUP_TRANSIENT_STATUSES, DOMAIN_AVAILABILITY_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, HOSTING_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { marshalBackupApiRestoreBackupItemsRequest, marshalDatabaseApiAssignDatabaseUserRequest, marshalDatabaseApiChangeDatabaseUserPasswordRequest, marshalDatabaseApiCreateDatabaseRequest, marshalDatabaseApiCreateDatabaseUserRequest, marshalDatabaseApiUnassignDatabaseUserRequest, marshalDnsApiCheckUserOwnsDomainRequest, marshalDnsApiSyncDomainDnsRecordsRequest, marshalFreeDomainApiCheckFreeDomainAvailabilityRequest, marshalFtpAccountApiChangeFtpAccountPasswordRequest, marshalFtpAccountApiCreateFtpAccountRequest, marshalHostingApiAddCustomDomainRequest, marshalHostingApiCreateHostingRequest, marshalHostingApiRemoveCustomDomainRequest, marshalHostingApiUpdateHostingRequest, marshalMailAccountApiChangeMailAccountPasswordRequest, marshalMailAccountApiCreateMailAccountRequest, marshalMailAccountApiRemoveMailAccountRequest, 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 } from "./marshalling.gen.js";
3
+ import { marshalBackupApiRestoreBackupItemsRequest, marshalDatabaseApiAssignDatabaseUserRequest, marshalDatabaseApiChangeDatabaseUserPasswordRequest, marshalDatabaseApiCreateDatabaseRequest, marshalDatabaseApiCreateDatabaseUserRequest, marshalDatabaseApiUnassignDatabaseUserRequest, marshalDnsApiCheckUserOwnsDomainRequest, marshalDnsApiSyncDomainDnsRecordsRequest, marshalFreeDomainApiCheckFreeDomainAvailabilityRequest, marshalFtpAccountApiChangeFtpAccountPasswordRequest, marshalFtpAccountApiCreateFtpAccountRequest, marshalHostingApiAddCustomDomainRequest, marshalHostingApiCreateHostingRequest, marshalHostingApiMigrateControlPanelRequest, marshalHostingApiRemoveCustomDomainRequest, 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";
4
4
  import * as validationRules_gen from "./validation-rules.gen.js";
5
5
  export {
6
6
  BACKUP_TRANSIENT_STATUSES,
@@ -31,11 +31,13 @@ export {
31
31
  marshalFtpAccountApiCreateFtpAccountRequest,
32
32
  marshalHostingApiAddCustomDomainRequest,
33
33
  marshalHostingApiCreateHostingRequest,
34
+ marshalHostingApiMigrateControlPanelRequest,
34
35
  marshalHostingApiRemoveCustomDomainRequest,
35
36
  marshalHostingApiUpdateHostingRequest,
36
37
  marshalMailAccountApiChangeMailAccountPasswordRequest,
37
38
  marshalMailAccountApiCreateMailAccountRequest,
38
39
  marshalMailAccountApiRemoveMailAccountRequest,
40
+ marshalWebsiteApiCreateWebsiteRequest,
39
41
  unmarshalBackup,
40
42
  unmarshalCheckFreeDomainAvailabilityResponse,
41
43
  unmarshalCheckUserOwnsDomainResponse,
@@ -65,5 +67,6 @@ export {
65
67
  unmarshalRestoreBackupItemsResponse,
66
68
  unmarshalRestoreBackupResponse,
67
69
  unmarshalSearchDomainsResponse,
68
- unmarshalSession
70
+ unmarshalSession,
71
+ unmarshalWebsite
69
72
  };