Skip to content

Commit b003e17

Browse files
feat(webhosting): update public v1 hosting message (#1634)
Co-authored-by: Jonathan R. <[email protected]>
1 parent 4c4721b commit b003e17

File tree

4 files changed

+157
-124
lines changed

4 files changed

+157
-124
lines changed

packages/clients/src/api/webhosting/v1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export class OfferAPI extends ParentAPI {
428428
*/
429429
export class HostingAPI extends ParentAPI {
430430
/** Lists the available regions of the API. */
431-
public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams']
431+
public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw']
432432

433433
/**
434434
* Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer

packages/clients/src/api/webhosting/v1/index.gen.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type {
2727
DatabaseApiListDatabasesRequest,
2828
DatabaseApiUnassignDatabaseUserRequest,
2929
DatabaseUser,
30+
DnsRecordsStatus,
3031
FtpAccount,
3132
FtpAccountApiChangeFtpAccountPasswordRequest,
3233
FtpAccountApiCreateFtpAccountRequest,
@@ -41,12 +42,10 @@ export type {
4142
HostingApiListHostingsRequest,
4243
HostingApiResetHostingPasswordRequest,
4344
HostingApiUpdateHostingRequest,
44-
HostingCpanelUrls,
45-
HostingDnsStatus,
46-
HostingOption,
4745
HostingStatus,
4846
HostingSummary,
4947
HostingSummaryStatus,
48+
HostingUser,
5049
ListControlPanelsResponse,
5150
ListDatabaseUsersRequestOrderBy,
5251
ListDatabaseUsersResponse,
@@ -73,6 +72,10 @@ export type {
7372
OfferOptionName,
7473
OfferOptionRequest,
7574
OfferOptionWarning,
75+
Platform,
76+
PlatformControlPanel,
77+
PlatformControlPanelUrls,
78+
PlatformPlatformGroup,
7679
ResetHostingPasswordResponse,
7780
ResourceSummary,
7881
Session,

packages/clients/src/api/webhosting/v1/marshalling.gen.ts

Lines changed: 83 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ import type {
2323
Hosting,
2424
HostingApiCreateHostingRequest,
2525
HostingApiUpdateHostingRequest,
26-
HostingCpanelUrls,
27-
HostingOption,
2826
HostingSummary,
27+
HostingUser,
2928
ListControlPanelsResponse,
3029
ListDatabaseUsersResponse,
3130
ListDatabasesResponse,
@@ -41,6 +40,9 @@ import type {
4140
Offer,
4241
OfferOption,
4342
OfferOptionRequest,
43+
Platform,
44+
PlatformControlPanel,
45+
PlatformControlPanelUrls,
4446
ResetHostingPasswordResponse,
4547
ResourceSummary,
4648
Session,
@@ -99,67 +101,125 @@ export const unmarshalMailAccount = (data: unknown): MailAccount => {
99101
} as MailAccount
100102
}
101103

102-
const unmarshalHostingCpanelUrls = (data: unknown): HostingCpanelUrls => {
104+
const unmarshalPlatformControlPanelUrls = (
105+
data: unknown,
106+
): PlatformControlPanelUrls => {
103107
if (!isJSONObject(data)) {
104108
throw new TypeError(
105-
`Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary.`,
109+
`Unmarshalling the type 'PlatformControlPanelUrls' failed as data isn't a dictionary.`,
106110
)
107111
}
108112

109113
return {
110114
dashboard: data.dashboard,
111115
webmail: data.webmail,
112-
} as HostingCpanelUrls
116+
} as PlatformControlPanelUrls
113117
}
114118

115-
const unmarshalHostingOption = (data: unknown): HostingOption => {
119+
const unmarshalOfferOption = (data: unknown): OfferOption => {
116120
if (!isJSONObject(data)) {
117121
throw new TypeError(
118-
`Unmarshalling the type 'HostingOption' failed as data isn't a dictionary.`,
122+
`Unmarshalling the type 'OfferOption' failed as data isn't a dictionary.`,
119123
)
120124
}
121125

122126
return {
127+
billingOperationPath: data.billing_operation_path,
128+
currentValue: data.current_value,
123129
id: data.id,
130+
maxValue: data.max_value,
131+
minValue: data.min_value,
124132
name: data.name,
125-
quantity: data.quantity,
126-
} as HostingOption
133+
quotaWarning: data.quota_warning,
134+
} as OfferOption
127135
}
128136

129-
export const unmarshalHosting = (data: unknown): Hosting => {
137+
const unmarshalPlatformControlPanel = (data: unknown): PlatformControlPanel => {
130138
if (!isJSONObject(data)) {
131139
throw new TypeError(
132-
`Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`,
140+
`Unmarshalling the type 'PlatformControlPanel' failed as data isn't a dictionary.`,
141+
)
142+
}
143+
144+
return {
145+
name: data.name,
146+
urls: data.urls ? unmarshalPlatformControlPanelUrls(data.urls) : undefined,
147+
} as PlatformControlPanel
148+
}
149+
150+
const unmarshalHostingUser = (data: unknown): HostingUser => {
151+
if (!isJSONObject(data)) {
152+
throw new TypeError(
153+
`Unmarshalling the type 'HostingUser' failed as data isn't a dictionary.`,
133154
)
134155
}
135156

136157
return {
137158
contactEmail: data.contact_email,
159+
oneTimePassword: data.one_time_password,
160+
username: data.username,
161+
} as HostingUser
162+
}
163+
164+
const unmarshalOffer = (data: unknown): Offer => {
165+
if (!isJSONObject(data)) {
166+
throw new TypeError(
167+
`Unmarshalling the type 'Offer' failed as data isn't a dictionary.`,
168+
)
169+
}
170+
171+
return {
172+
available: data.available,
173+
billingOperationPath: data.billing_operation_path,
138174
controlPanelName: data.control_panel_name,
139-
cpanelUrls: data.cpanel_urls
140-
? unmarshalHostingCpanelUrls(data.cpanel_urls)
175+
endOfLife: data.end_of_life,
176+
id: data.id,
177+
options: unmarshalArrayOfObject(data.options, unmarshalOfferOption),
178+
price: data.price ? unmarshalMoney(data.price) : undefined,
179+
} as Offer
180+
}
181+
182+
const unmarshalPlatform = (data: unknown): Platform => {
183+
if (!isJSONObject(data)) {
184+
throw new TypeError(
185+
`Unmarshalling the type 'Platform' failed as data isn't a dictionary.`,
186+
)
187+
}
188+
189+
return {
190+
controlPanel: data.control_panel
191+
? unmarshalPlatformControlPanel(data.control_panel)
141192
: undefined,
193+
groupName: data.group_name,
194+
hostname: data.hostname,
195+
ipv4: data.ipv4,
196+
ipv6: data.ipv6,
197+
number: data.number,
198+
} as Platform
199+
}
200+
201+
export const unmarshalHosting = (data: unknown): Hosting => {
202+
if (!isJSONObject(data)) {
203+
throw new TypeError(
204+
`Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`,
205+
)
206+
}
207+
208+
return {
142209
createdAt: unmarshalDate(data.created_at),
143210
dnsStatus: data.dns_status,
144211
domain: data.domain,
145212
id: data.id,
146213
ipv4: data.ipv4,
147-
ipv6: data.ipv6,
148-
offerEndOfLife: data.offer_end_of_life,
149-
offerId: data.offer_id,
150-
offerName: data.offer_name,
151-
oneTimePassword: data.one_time_password,
152-
options: unmarshalArrayOfObject(data.options, unmarshalHostingOption),
153-
platformGroup: data.platform_group,
154-
platformHostname: data.platform_hostname,
155-
platformNumber: data.platform_number,
214+
offer: data.offer ? unmarshalOffer(data.offer) : undefined,
215+
platform: data.platform ? unmarshalPlatform(data.platform) : undefined,
156216
projectId: data.project_id,
157217
protected: data.protected,
158218
region: data.region,
159219
status: data.status,
160220
tags: data.tags,
161221
updatedAt: unmarshalDate(data.updated_at),
162-
username: data.username,
222+
user: data.user ? unmarshalHostingUser(data.user) : undefined,
163223
} as Hosting
164224
}
165225

@@ -293,42 +353,6 @@ export const unmarshalListMailAccountsResponse = (
293353
} as ListMailAccountsResponse
294354
}
295355

296-
const unmarshalOfferOption = (data: unknown): OfferOption => {
297-
if (!isJSONObject(data)) {
298-
throw new TypeError(
299-
`Unmarshalling the type 'OfferOption' failed as data isn't a dictionary.`,
300-
)
301-
}
302-
303-
return {
304-
billingOperationPath: data.billing_operation_path,
305-
currentValue: data.current_value,
306-
id: data.id,
307-
maxValue: data.max_value,
308-
minValue: data.min_value,
309-
name: data.name,
310-
quotaWarning: data.quota_warning,
311-
} as OfferOption
312-
}
313-
314-
const unmarshalOffer = (data: unknown): Offer => {
315-
if (!isJSONObject(data)) {
316-
throw new TypeError(
317-
`Unmarshalling the type 'Offer' failed as data isn't a dictionary.`,
318-
)
319-
}
320-
321-
return {
322-
available: data.available,
323-
billingOperationPath: data.billing_operation_path,
324-
controlPanelName: data.control_panel_name,
325-
endOfLife: data.end_of_life,
326-
id: data.id,
327-
options: unmarshalArrayOfObject(data.options, unmarshalOfferOption),
328-
price: data.price ? unmarshalMoney(data.price) : undefined,
329-
} as Offer
330-
}
331-
332356
export const unmarshalListOffersResponse = (
333357
data: unknown,
334358
): ListOffersResponse => {

0 commit comments

Comments
 (0)