diff --git a/packages/clients/src/api/webhosting/v1/api.gen.ts b/packages/clients/src/api/webhosting/v1/api.gen.ts index a5e18de76..0838ffdb8 100644 --- a/packages/clients/src/api/webhosting/v1/api.gen.ts +++ b/packages/clients/src/api/webhosting/v1/api.gen.ts @@ -428,7 +428,7 @@ export class OfferAPI extends ParentAPI { */ export class HostingAPI extends ParentAPI { /** Lists the available regions of the API. */ - public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams'] + public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw'] /** * Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer diff --git a/packages/clients/src/api/webhosting/v1/index.gen.ts b/packages/clients/src/api/webhosting/v1/index.gen.ts index 461774cf0..aa0327384 100644 --- a/packages/clients/src/api/webhosting/v1/index.gen.ts +++ b/packages/clients/src/api/webhosting/v1/index.gen.ts @@ -27,6 +27,7 @@ export type { DatabaseApiListDatabasesRequest, DatabaseApiUnassignDatabaseUserRequest, DatabaseUser, + DnsRecordsStatus, FtpAccount, FtpAccountApiChangeFtpAccountPasswordRequest, FtpAccountApiCreateFtpAccountRequest, @@ -41,12 +42,10 @@ export type { HostingApiListHostingsRequest, HostingApiResetHostingPasswordRequest, HostingApiUpdateHostingRequest, - HostingCpanelUrls, - HostingDnsStatus, - HostingOption, HostingStatus, HostingSummary, HostingSummaryStatus, + HostingUser, ListControlPanelsResponse, ListDatabaseUsersRequestOrderBy, ListDatabaseUsersResponse, @@ -73,6 +72,10 @@ export type { OfferOptionName, OfferOptionRequest, OfferOptionWarning, + Platform, + PlatformControlPanel, + PlatformControlPanelUrls, + PlatformPlatformGroup, ResetHostingPasswordResponse, ResourceSummary, Session, diff --git a/packages/clients/src/api/webhosting/v1/marshalling.gen.ts b/packages/clients/src/api/webhosting/v1/marshalling.gen.ts index d50b5831c..bc06cb160 100644 --- a/packages/clients/src/api/webhosting/v1/marshalling.gen.ts +++ b/packages/clients/src/api/webhosting/v1/marshalling.gen.ts @@ -23,9 +23,8 @@ import type { Hosting, HostingApiCreateHostingRequest, HostingApiUpdateHostingRequest, - HostingCpanelUrls, - HostingOption, HostingSummary, + HostingUser, ListControlPanelsResponse, ListDatabaseUsersResponse, ListDatabasesResponse, @@ -41,6 +40,9 @@ import type { Offer, OfferOption, OfferOptionRequest, + Platform, + PlatformControlPanel, + PlatformControlPanelUrls, ResetHostingPasswordResponse, ResourceSummary, Session, @@ -99,67 +101,125 @@ export const unmarshalMailAccount = (data: unknown): MailAccount => { } as MailAccount } -const unmarshalHostingCpanelUrls = (data: unknown): HostingCpanelUrls => { +const unmarshalPlatformControlPanelUrls = ( + data: unknown, +): PlatformControlPanelUrls => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PlatformControlPanelUrls' failed as data isn't a dictionary.`, ) } return { dashboard: data.dashboard, webmail: data.webmail, - } as HostingCpanelUrls + } as PlatformControlPanelUrls } -const unmarshalHostingOption = (data: unknown): HostingOption => { +const unmarshalOfferOption = (data: unknown): OfferOption => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'HostingOption' failed as data isn't a dictionary.`, + `Unmarshalling the type 'OfferOption' failed as data isn't a dictionary.`, ) } return { + billingOperationPath: data.billing_operation_path, + currentValue: data.current_value, id: data.id, + maxValue: data.max_value, + minValue: data.min_value, name: data.name, - quantity: data.quantity, - } as HostingOption + quotaWarning: data.quota_warning, + } as OfferOption } -export const unmarshalHosting = (data: unknown): Hosting => { +const unmarshalPlatformControlPanel = (data: unknown): PlatformControlPanel => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PlatformControlPanel' failed as data isn't a dictionary.`, + ) + } + + return { + name: data.name, + urls: data.urls ? unmarshalPlatformControlPanelUrls(data.urls) : undefined, + } as PlatformControlPanel +} + +const unmarshalHostingUser = (data: unknown): HostingUser => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'HostingUser' failed as data isn't a dictionary.`, ) } return { contactEmail: data.contact_email, + oneTimePassword: data.one_time_password, + username: data.username, + } as HostingUser +} + +const unmarshalOffer = (data: unknown): Offer => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`, + ) + } + + return { + available: data.available, + billingOperationPath: data.billing_operation_path, controlPanelName: data.control_panel_name, - cpanelUrls: data.cpanel_urls - ? unmarshalHostingCpanelUrls(data.cpanel_urls) + endOfLife: data.end_of_life, + id: data.id, + options: unmarshalArrayOfObject(data.options, unmarshalOfferOption), + price: data.price ? unmarshalMoney(data.price) : undefined, + } as Offer +} + +const unmarshalPlatform = (data: unknown): Platform => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Platform' failed as data isn't a dictionary.`, + ) + } + + return { + controlPanel: data.control_panel + ? unmarshalPlatformControlPanel(data.control_panel) : undefined, + groupName: data.group_name, + hostname: data.hostname, + ipv4: data.ipv4, + ipv6: data.ipv6, + number: data.number, + } as Platform +} + +export const unmarshalHosting = (data: unknown): Hosting => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`, + ) + } + + return { createdAt: unmarshalDate(data.created_at), dnsStatus: data.dns_status, domain: data.domain, id: data.id, ipv4: data.ipv4, - ipv6: data.ipv6, - offerEndOfLife: data.offer_end_of_life, - offerId: data.offer_id, - offerName: data.offer_name, - oneTimePassword: data.one_time_password, - options: unmarshalArrayOfObject(data.options, unmarshalHostingOption), - platformGroup: data.platform_group, - platformHostname: data.platform_hostname, - platformNumber: data.platform_number, + offer: data.offer ? unmarshalOffer(data.offer) : undefined, + platform: data.platform ? unmarshalPlatform(data.platform) : undefined, projectId: data.project_id, protected: data.protected, region: data.region, status: data.status, tags: data.tags, updatedAt: unmarshalDate(data.updated_at), - username: data.username, + user: data.user ? unmarshalHostingUser(data.user) : undefined, } as Hosting } @@ -293,42 +353,6 @@ export const unmarshalListMailAccountsResponse = ( } as ListMailAccountsResponse } -const unmarshalOfferOption = (data: unknown): OfferOption => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'OfferOption' failed as data isn't a dictionary.`, - ) - } - - return { - billingOperationPath: data.billing_operation_path, - currentValue: data.current_value, - id: data.id, - maxValue: data.max_value, - minValue: data.min_value, - name: data.name, - quotaWarning: data.quota_warning, - } as OfferOption -} - -const unmarshalOffer = (data: unknown): Offer => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`, - ) - } - - return { - available: data.available, - billingOperationPath: data.billing_operation_path, - controlPanelName: data.control_panel_name, - endOfLife: data.end_of_life, - id: data.id, - options: unmarshalArrayOfObject(data.options, unmarshalOfferOption), - price: data.price ? unmarshalMoney(data.price) : undefined, - } as Offer -} - export const unmarshalListOffersResponse = ( data: unknown, ): ListOffersResponse => { diff --git a/packages/clients/src/api/webhosting/v1/types.gen.ts b/packages/clients/src/api/webhosting/v1/types.gen.ts index aa6a11667..c1e43c719 100644 --- a/packages/clients/src/api/webhosting/v1/types.gen.ts +++ b/packages/clients/src/api/webhosting/v1/types.gen.ts @@ -3,7 +3,7 @@ import type { Money, Region } from '../../../bridge' import type { LanguageCode as StdLanguageCode } from '../../std/types.gen' -export type HostingDnsStatus = 'unknown_dns_status' | 'valid' | 'invalid' +export type DnsRecordsStatus = 'unknown_status' | 'valid' | 'invalid' export type HostingStatus = | 'unknown_status' @@ -55,6 +55,15 @@ export type OfferOptionName = export type OfferOptionWarning = 'unknown_warning' | 'quota_exceeded_warning' +export type PlatformPlatformGroup = 'unknown_group' | 'default' | 'premium' + +export interface PlatformControlPanelUrls { + /** URL to connect to the hosting control panel dashboard. */ + dashboard: string + /** URL to connect to the hosting Webmail interface. */ + webmail: string +} + export interface OfferOption { /** Option ID. */ id: string @@ -75,6 +84,13 @@ export interface OfferOption { quotaWarning: OfferOptionWarning } +export interface PlatformControlPanel { + /** Name of the control panel. */ + name: string + /** URL to connect to cPanel dashboard and to Webmail interface. */ + urls?: PlatformControlPanelUrls +} + export interface CreateHostingRequestDomainConfiguration { updateNameservers: boolean updateWebRecord: boolean @@ -89,18 +105,51 @@ export interface OfferOptionRequest { quantity: number } -export interface HostingCpanelUrls { - dashboard: string - webmail: string +export interface HostingUser { + /** Main Web Hosting cPanel username. */ + username: string + /** + * One-time-password used for the first login or reset password, empty after + * first use. + */ + oneTimePassword?: string + /** Contact email used for the hosting. */ + contactEmail: string } -export interface HostingOption { - /** Option ID. */ +export interface Offer { + /** Offer ID. */ id: string - /** Option name. */ - name: OfferOptionName - /** Option quantity. */ - quantity: number + /** Unique identifier used for billing. */ + billingOperationPath: string + /** Options available for the offer. */ + options: OfferOption[] + /** Price of the offer. */ + price?: Money + /** + * If a hosting_id was specified in the call, defines whether the offer is + * available for a specified hosting plan to migrate (update) to. + */ + available: boolean + /** Name of the control panel. */ + controlPanelName: string + /** Indicates if the offer has reached its end of life. */ + endOfLife: boolean +} + +export interface Platform { + /** Hostname of the host platform. */ + hostname: string + /** Number of the host platform. */ + number: number + /** Group name of the hosting's host platform. */ + groupName: PlatformPlatformGroup + /** IPv4 address of the hosting's host platform. */ + ipv4: string + /** IPv6 address of the hosting's host platform. */ + ipv6: string + /** Details of the platform control panel. */ + controlPanel?: PlatformControlPanel } export interface ControlPanel { @@ -161,26 +210,6 @@ export interface MailAccount { username: string } -export interface Offer { - /** Offer ID. */ - id: string - /** Unique identifier used for billing. */ - billingOperationPath: string - /** Options available for the offer. */ - options: OfferOption[] - /** Price of the offer. */ - price?: Money - /** - * If a hosting_id was specified in the call, defines whether the offer is - * available for a specified hosting plan to migrate (update) to. - */ - available: boolean - /** Name of the control panel. */ - controlPanelName: string - /** Indicates if the offer has reached its end of life. */ - endOfLife: boolean -} - export interface Website { /** The domain of the website. */ domain: string @@ -433,45 +462,22 @@ export interface Hosting { createdAt?: Date /** Status of the Web Hosting plan. */ status: HostingStatus - /** Hostname of the host platform. */ - platformHostname: string - /** Number of the host platform. */ - platformNumber: number - /** ID of the active offer for the Web Hosting plan. */ - offerId: string - /** Name of the active offer for the Web Hosting plan. */ - offerName: string /** Main domain associated with the Web Hosting plan. */ domain: string + /** Details of the Web Hosting plan offer and options. */ + offer?: Offer + /** Details of the hosting platform. */ + platform?: Platform /** List of tags associated with the Web Hosting plan. */ tags: string[] - /** List of the Web Hosting plan options. */ - options: HostingOption[] /** DNS status of the Web Hosting plan. */ - dnsStatus: HostingDnsStatus - /** URL to connect to cPanel dashboard and to Webmail interface. */ - cpanelUrls?: HostingCpanelUrls - /** Main Web Hosting cPanel username. */ - username: string - /** Indicates if the hosting offer has reached its end of life. */ - offerEndOfLife: boolean - /** Name of the control panel. */ - controlPanelName: string - /** Group of the hosting's host server/platform. */ - platformGroup: string - /** IPv4 address of the hosting's host server. */ + dnsStatus: DnsRecordsStatus + /** Current IPv4 address of the hosting. */ ipv4: string - /** IPv6 address of the hosting's host server. */ - ipv6: string /** Whether the hosting is protected or not. */ protected: boolean - /** - * One-time-password used for the first login or reset password, empty after - * first use. - */ - oneTimePassword: string - /** Contact email used for the hosting. */ - contactEmail: string + /** Details of the hosting user. */ + user?: HostingUser /** Region where the Web Hosting plan is hosted. */ region: Region }