@@ -11,20 +11,29 @@ import type { Region, WaitForOptions } from '../../../bridge'
1111import { HOSTING_TRANSIENT_STATUSES } from './content.gen'
1212import {
1313 marshalCheckUserOwnsDomainRequest ,
14+ marshalClassicMailApiCreateMailboxRequest ,
15+ marshalClassicMailApiUpdateMailboxRequest ,
1416 marshalCreateHostingRequest ,
1517 marshalUpdateHostingRequest ,
1618 unmarshalCheckUserOwnsDomainResponse ,
1719 unmarshalDnsRecords ,
1820 unmarshalHosting ,
1921 unmarshalListControlPanelsResponse ,
2022 unmarshalListHostingsResponse ,
23+ unmarshalListMailboxesResponse ,
2124 unmarshalListOffersResponse ,
25+ unmarshalMailbox ,
2226 unmarshalResetHostingPasswordResponse ,
2327 unmarshalSession ,
2428} from './marshalling.gen'
2529import type {
2630 CheckUserOwnsDomainRequest ,
2731 CheckUserOwnsDomainResponse ,
32+ ClassicMailApiCreateMailboxRequest ,
33+ ClassicMailApiDeleteMailboxRequest ,
34+ ClassicMailApiGetMailboxRequest ,
35+ ClassicMailApiListMailboxesRequest ,
36+ ClassicMailApiUpdateMailboxRequest ,
2837 CreateHostingRequest ,
2938 CreateSessionRequest ,
3039 DeleteHostingRequest ,
@@ -36,8 +45,10 @@ import type {
3645 ListControlPanelsResponse ,
3746 ListHostingsRequest ,
3847 ListHostingsResponse ,
48+ ListMailboxesResponse ,
3949 ListOffersRequest ,
4050 ListOffersResponse ,
51+ Mailbox ,
4152 ResetHostingPasswordRequest ,
4253 ResetHostingPasswordResponse ,
4354 RestoreHostingRequest ,
@@ -324,3 +335,113 @@ export class API extends ParentAPI {
324335 unmarshalResetHostingPasswordResponse ,
325336 )
326337}
338+
339+ /**
340+ * Web Hosting Classic Mailbox API.
341+ *
342+ * This API allows you to manage your mailboxes for your Web Hosting services.
343+ */
344+ export class ClassicMailAPI extends ParentAPI {
345+ /** Lists the available regions of the API. */
346+ public static readonly LOCALITIES : Region [ ] = [ 'fr-par' , 'nl-ams' , 'pl-waw' ]
347+
348+ /**
349+ * Create a new mailbox within your hosting plan.. Create a new mailbox within
350+ * your hosting plan.
351+ *
352+ * @param request - The request {@link ClassicMailApiCreateMailboxRequest}
353+ * @returns A Promise of Mailbox
354+ */
355+ createMailbox = ( request : Readonly < ClassicMailApiCreateMailboxRequest > ) =>
356+ this . client . fetch < Mailbox > (
357+ {
358+ body : JSON . stringify (
359+ marshalClassicMailApiCreateMailboxRequest (
360+ request ,
361+ this . client . settings ,
362+ ) ,
363+ ) ,
364+ headers : jsonContentHeaders ,
365+ method : 'POST' ,
366+ path : `/webhosting/v1alpha1/regions/${ validatePathParam ( 'region' , request . region ?? this . client . settings . defaultRegion ) } /classic-hostings/${ validatePathParam ( 'onlineId' , request . onlineId ) } /mailboxes` ,
367+ } ,
368+ unmarshalMailbox ,
369+ )
370+
371+ /**
372+ * Get a mailbox by id within your hosting plan.. Get a mailbox by id within
373+ * your hosting plan.
374+ *
375+ * @param request - The request {@link ClassicMailApiGetMailboxRequest}
376+ * @returns A Promise of Mailbox
377+ */
378+ getMailbox = ( request : Readonly < ClassicMailApiGetMailboxRequest > ) =>
379+ this . client . fetch < Mailbox > (
380+ {
381+ method : 'GET' ,
382+ path : `/webhosting/v1alpha1/regions/${ validatePathParam ( 'region' , request . region ?? this . client . settings . defaultRegion ) } /classic-hostings/${ validatePathParam ( 'onlineId' , request . onlineId ) } /mailboxes/${ validatePathParam ( 'mailboxId' , request . mailboxId ) } ` ,
383+ } ,
384+ unmarshalMailbox ,
385+ )
386+
387+ protected pageOfListMailboxes = (
388+ request : Readonly < ClassicMailApiListMailboxesRequest > ,
389+ ) =>
390+ this . client . fetch < ListMailboxesResponse > (
391+ {
392+ method : 'GET' ,
393+ path : `/webhosting/v1alpha1/regions/${ validatePathParam ( 'region' , request . region ?? this . client . settings . defaultRegion ) } /classic-hostings/${ validatePathParam ( 'onlineId' , request . onlineId ) } /mailboxes` ,
394+ urlParams : urlParams (
395+ [ 'domain' , request . domain ] ,
396+ [ 'page' , request . page ] ,
397+ [
398+ 'page_size' ,
399+ request . pageSize ?? this . client . settings . defaultPageSize ,
400+ ] ,
401+ ) ,
402+ } ,
403+ unmarshalListMailboxesResponse ,
404+ )
405+
406+ /**
407+ * List all mailboxes within your hosting plan.. List all mailboxes within
408+ * your hosting plan.
409+ *
410+ * @param request - The request {@link ClassicMailApiListMailboxesRequest}
411+ * @returns A Promise of ListMailboxesResponse
412+ */
413+ listMailboxes = ( request : Readonly < ClassicMailApiListMailboxesRequest > ) =>
414+ enrichForPagination ( 'mailboxes' , this . pageOfListMailboxes , request )
415+
416+ deleteMailbox = ( request : Readonly < ClassicMailApiDeleteMailboxRequest > ) =>
417+ this . client . fetch < Mailbox > (
418+ {
419+ method : 'DELETE' ,
420+ path : `/webhosting/v1alpha1/regions/${ validatePathParam ( 'region' , request . region ?? this . client . settings . defaultRegion ) } /classic-hostings/${ validatePathParam ( 'onlineId' , request . onlineId ) } /mailboxes/${ validatePathParam ( 'mailboxId' , request . mailboxId ) } ` ,
421+ } ,
422+ unmarshalMailbox ,
423+ )
424+
425+ /**
426+ * Update the mailbox within your hosting plan.. Update the mailbox within
427+ * your hosting plan.
428+ *
429+ * @param request - The request {@link ClassicMailApiUpdateMailboxRequest}
430+ * @returns A Promise of Mailbox
431+ */
432+ updateMailbox = ( request : Readonly < ClassicMailApiUpdateMailboxRequest > ) =>
433+ this . client . fetch < Mailbox > (
434+ {
435+ body : JSON . stringify (
436+ marshalClassicMailApiUpdateMailboxRequest (
437+ request ,
438+ this . client . settings ,
439+ ) ,
440+ ) ,
441+ headers : jsonContentHeaders ,
442+ method : 'PATCH' ,
443+ path : `/webhosting/v1alpha1/regions/${ validatePathParam ( 'region' , request . region ?? this . client . settings . defaultRegion ) } /classic-hostings/${ validatePathParam ( 'onlineId' , request . onlineId ) } /mailboxes/${ validatePathParam ( 'mailboxId' , request . mailboxId ) } ` ,
444+ } ,
445+ unmarshalMailbox ,
446+ )
447+ }
0 commit comments