Skip to content

Commit 06b151b

Browse files
authored
feat(webhosting): add public reset hosting password (#1251)
1 parent 50db5e5 commit 06b151b

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
unmarshalListControlPanelsResponse,
1818
unmarshalListHostingsResponse,
1919
unmarshalListOffersResponse,
20+
unmarshalResetHostingPasswordResponse,
2021
unmarshalSession,
2122
} from './marshalling.gen'
2223
import type {
@@ -33,6 +34,8 @@ import type {
3334
ListHostingsResponse,
3435
ListOffersRequest,
3536
ListOffersResponse,
37+
ResetHostingPasswordRequest,
38+
ResetHostingPasswordResponse,
3639
RestoreHostingRequest,
3740
Session,
3841
UpdateHostingRequest,
@@ -258,8 +261,7 @@ export class API extends ParentAPI {
258261
)
259262

260263
/**
261-
* List all control panels type. List the control panels type: cpanel or
262-
* plesk.
264+
* "List the control panels type: cpanel or plesk.".
263265
*
264266
* @param request - The request {@link ListControlPanelsRequest}
265267
* @returns A Promise of ListControlPanelsResponse
@@ -283,4 +285,15 @@ export class API extends ParentAPI {
283285
},
284286
unmarshalSession,
285287
)
288+
289+
resetHostingPassword = (request: Readonly<ResetHostingPasswordRequest>) =>
290+
this.client.fetch<ResetHostingPasswordResponse>(
291+
{
292+
body: '{}',
293+
headers: jsonContentHeaders,
294+
method: 'POST',
295+
path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}/reset-password`,
296+
},
297+
unmarshalResetHostingPasswordResponse,
298+
)
286299
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export type {
3333
Offer,
3434
OfferProduct,
3535
OfferQuotaWarning,
36+
ResetHostingPasswordRequest,
37+
ResetHostingPasswordResponse,
3638
RestoreHostingRequest,
3739
Session,
3840
UpdateHostingRequest,

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import type {
2222
Nameserver,
2323
Offer,
2424
OfferProduct,
25+
ResetHostingPasswordResponse,
2526
Session,
2627
UpdateHostingRequest,
2728
} from './types.gen'
@@ -235,6 +236,20 @@ export const unmarshalListOffersResponse = (
235236
} as ListOffersResponse
236237
}
237238

239+
export const unmarshalResetHostingPasswordResponse = (
240+
data: unknown,
241+
): ResetHostingPasswordResponse => {
242+
if (!isJSONObject(data)) {
243+
throw new TypeError(
244+
`Unmarshalling the type 'ResetHostingPasswordResponse' failed as data isn't a dictionary.`,
245+
)
246+
}
247+
248+
return {
249+
password: data.password,
250+
} as ResetHostingPasswordResponse
251+
}
252+
238253
export const unmarshalSession = (data: unknown): Session => {
239254
if (!isJSONObject(data)) {
240255
throw new TypeError(

packages/clients/src/api/webhosting/v1alpha1/types.gen.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,21 @@ export interface ListOffersResponse {
383383
offers: Offer[]
384384
}
385385

386+
export type ResetHostingPasswordRequest = {
387+
/**
388+
* Region to target. If none is passed will use default region from the
389+
* config.
390+
*/
391+
region?: Region
392+
/** UUID of the hosting. */
393+
hostingId: string
394+
}
395+
396+
export interface ResetHostingPasswordResponse {
397+
/** New password. */
398+
password: string
399+
}
400+
386401
export type RestoreHostingRequest = {
387402
/**
388403
* Region to target. If none is passed will use default region from the

0 commit comments

Comments
 (0)