Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/clients/src/api/webhosting/v1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions packages/clients/src/api/webhosting/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type {
DatabaseApiListDatabasesRequest,
DatabaseApiUnassignDatabaseUserRequest,
DatabaseUser,
DnsRecordsStatus,
FtpAccount,
FtpAccountApiChangeFtpAccountPasswordRequest,
FtpAccountApiCreateFtpAccountRequest,
Expand All @@ -41,12 +42,10 @@ export type {
HostingApiListHostingsRequest,
HostingApiResetHostingPasswordRequest,
HostingApiUpdateHostingRequest,
HostingCpanelUrls,
HostingDnsStatus,
HostingOption,
HostingStatus,
HostingSummary,
HostingSummaryStatus,
HostingUser,
ListControlPanelsResponse,
ListDatabaseUsersRequestOrderBy,
ListDatabaseUsersResponse,
Expand All @@ -73,6 +72,10 @@ export type {
OfferOptionName,
OfferOptionRequest,
OfferOptionWarning,
Platform,
PlatformControlPanel,
PlatformControlPanelUrls,
PlatformPlatformGroup,
ResetHostingPasswordResponse,
ResourceSummary,
Session,
Expand Down
142 changes: 83 additions & 59 deletions packages/clients/src/api/webhosting/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import type {
Hosting,
HostingApiCreateHostingRequest,
HostingApiUpdateHostingRequest,
HostingCpanelUrls,
HostingOption,
HostingSummary,
HostingUser,
ListControlPanelsResponse,
ListDatabaseUsersResponse,
ListDatabasesResponse,
Expand All @@ -41,6 +40,9 @@ import type {
Offer,
OfferOption,
OfferOptionRequest,
Platform,
PlatformControlPanel,
PlatformControlPanelUrls,
ResetHostingPasswordResponse,
ResourceSummary,
Session,
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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 => {
Expand Down
Loading
Loading