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
22 changes: 22 additions & 0 deletions packages/clients/src/api/webhosting/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { HOSTING_TRANSIENT_STATUSES } from './content.gen'
import {
marshalCreateHostingRequest,
marshalUpdateHostingRequest,
unmarshalCheckUserOwnsDomainResponse,
unmarshalDnsRecords,
unmarshalHosting,
unmarshalListControlPanelsResponse,
Expand All @@ -21,6 +22,8 @@ import {
unmarshalSession,
} from './marshalling.gen'
import type {
CheckUserOwnsDomainRequest,
CheckUserOwnsDomainResponse,
CreateHostingRequest,
CreateSessionRequest,
DeleteHostingRequest,
Expand Down Expand Up @@ -223,6 +226,25 @@ export class API extends ParentAPI {
unmarshalDnsRecords,
)

/**
* "Check whether you own this domain or not.".
*
* @param request - The request {@link CheckUserOwnsDomainRequest}
* @returns A Promise of CheckUserOwnsDomainResponse
*/
checkUserOwnsDomain = (request: Readonly<CheckUserOwnsDomainRequest>) =>
this.client.fetch<CheckUserOwnsDomainResponse>(
{
method: 'POST',
path: `/webhosting/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domain', request.domain)}/check-ownership`,
urlParams: urlParams([
'project_id',
request.projectId ?? this.client.settings.defaultProjectId,
]),
},
unmarshalCheckUserOwnsDomainResponse,
)

/**
* List all offers. List the different Web Hosting offers, and their options,
* available to order from Scaleway.
Expand Down
2 changes: 2 additions & 0 deletions packages/clients/src/api/webhosting/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
export { API } from './api.gen'
export * from './content.gen'
export type {
CheckUserOwnsDomainRequest,
CheckUserOwnsDomainResponse,
ControlPanel,
CreateHostingRequest,
CreateHostingRequestDomainConfiguration,
Expand Down
15 changes: 15 additions & 0 deletions packages/clients/src/api/webhosting/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '../../../bridge'
import type { DefaultValues } from '../../../bridge'
import type {
CheckUserOwnsDomainResponse,
ControlPanel,
CreateHostingRequest,
CreateHostingRequestDomainConfiguration,
Expand Down Expand Up @@ -90,6 +91,20 @@ export const unmarshalHosting = (data: unknown): Hosting => {
} as Hosting
}

export const unmarshalCheckUserOwnsDomainResponse = (
data: unknown,
): CheckUserOwnsDomainResponse => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'CheckUserOwnsDomainResponse' failed as data isn't a dictionary.`,
)
}

return {
ownsDomain: data.owns_domain,
} as CheckUserOwnsDomainResponse
}

const unmarshalDnsRecord = (data: unknown): DnsRecord => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down
17 changes: 17 additions & 0 deletions packages/clients/src/api/webhosting/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,23 @@ export interface Offer {
controlPanelName: string
}

export type CheckUserOwnsDomainRequest = {
/**
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
/** Domain for which ownership is to be verified. */
domain: string
/** ID of the project currently in use. */
projectId?: string
}

export interface CheckUserOwnsDomainResponse {
/** Indicates whether the specified project owns the domain. */
ownsDomain: boolean
}

export type CreateHostingRequest = {
/**
* Region to target. If none is passed will use default region from the
Expand Down