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
29 changes: 29 additions & 0 deletions packages/clients/src/api/domain/v2beta1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
marshalImportRawDNSZoneRequest,
marshalRefreshDNSZoneRequest,
marshalRegistrarApiBuyDomainsRequest,
marshalRegistrarApiCheckContactsCompatibilityRequest,
marshalRegistrarApiEnableDomainDNSSECRequest,
marshalRegistrarApiRegisterExternalDomainRequest,
marshalRegistrarApiRenewDomainsRequest,
Expand All @@ -26,6 +27,7 @@ import {
marshalUpdateDNSZoneNameserversRequest,
marshalUpdateDNSZoneRecordsRequest,
marshalUpdateDNSZoneRequest,
unmarshalCheckContactsCompatibilityResponse,
unmarshalClearDNSZoneRecordsResponse,
unmarshalContact,
unmarshalDNSZone,
Expand Down Expand Up @@ -58,6 +60,7 @@ import {
unmarshalUpdateDNSZoneRecordsResponse,
} from './marshalling.gen'
import type {
CheckContactsCompatibilityResponse,
ClearDNSZoneRecordsRequest,
ClearDNSZoneRecordsResponse,
CloneDNSZoneRequest,
Expand Down Expand Up @@ -104,6 +107,7 @@ import type {
RefreshDNSZoneResponse,
RegisterExternalDomainResponse,
RegistrarApiBuyDomainsRequest,
RegistrarApiCheckContactsCompatibilityRequest,
RegistrarApiDeleteExternalDomainRequest,
RegistrarApiDisableDomainAutoRenewRequest,
RegistrarApiDisableDomainDNSSECRequest,
Expand Down Expand Up @@ -896,6 +900,31 @@ export class DomainRegistrarV2Beta1GenAPI extends API {
unmarshalDeleteExternalDomainResponse,
)

/**
* Check if contacts are compatible against a domain or a tld. If not, it will
* return the information requiring a correction.
*
* @param request - The request {@link RegistrarApiCheckContactsCompatibilityRequest}
* @returns A Promise of CheckContactsCompatibilityResponse
*/
checkContactsCompatibility = (
request: Readonly<RegistrarApiCheckContactsCompatibilityRequest> = {},
) =>
this.client.fetch<CheckContactsCompatibilityResponse>(
{
body: JSON.stringify(
marshalRegistrarApiCheckContactsCompatibilityRequest(
request,
this.client.settings,
),
),
headers: jsonContentHeaders,
method: 'POST',
path: `/domain/v2beta1/check-contacts-compatibility`,
},
unmarshalCheckContactsCompatibilityResponse,
)

protected pageOfListContacts = (
request: Readonly<RegistrarApiListContactsRequest> = {},
) =>
Expand Down
97 changes: 97 additions & 0 deletions packages/clients/src/api/domain/v2beta1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
import type { DefaultValues } from '../../../bridge'
import type {
AvailableDomain,
CheckContactsCompatibilityResponse,
CheckContactsCompatibilityResponseContactCheckResult,
ClearDNSZoneRecordsResponse,
CloneDNSZoneRequest,
Contact,
Expand Down Expand Up @@ -82,6 +84,7 @@ import type {
RefreshDNSZoneResponse,
RegisterExternalDomainResponse,
RegistrarApiBuyDomainsRequest,
RegistrarApiCheckContactsCompatibilityRequest,
RegistrarApiEnableDomainDNSSECRequest,
RegistrarApiRegisterExternalDomainRequest,
RegistrarApiRenewDomainsRequest,
Expand Down Expand Up @@ -599,6 +602,21 @@ const unmarshalAvailableDomain = (data: unknown) => {
} as AvailableDomain
}

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

return {
compatible: data.compatible,
errorMessage: data.error_message,
} as CheckContactsCompatibilityResponseContactCheckResult
}

const unmarshalContactRoles = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down Expand Up @@ -770,6 +788,33 @@ const unmarshalTask = (data: unknown) => {
} as Task
}

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

return {
administrativeCheckResult: data.administrative_check_result
? unmarshalCheckContactsCompatibilityResponseContactCheckResult(
data.administrative_check_result,
)
: undefined,
compatible: data.compatible,
ownerCheckResult: data.owner_check_result
? unmarshalCheckContactsCompatibilityResponseContactCheckResult(
data.owner_check_result,
)
: undefined,
technicalCheckResult: data.technical_check_result
? unmarshalCheckContactsCompatibilityResponseContactCheckResult(
data.technical_check_result,
)
: undefined,
} as CheckContactsCompatibilityResponse
}

export const unmarshalClearDNSZoneRecordsResponse = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down Expand Up @@ -1698,6 +1743,58 @@ export const marshalRegistrarApiBuyDomainsRequest = (
]),
})

export const marshalRegistrarApiCheckContactsCompatibilityRequest = (
request: RegistrarApiCheckContactsCompatibilityRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
...resolveOneOf<unknown>([
{
param: 'administrative_contact_id',
value: request.administrativeContactId,
},
{
param: 'administrative_contact',
value: request.administrativeContact
? marshalNewContact(request.administrativeContact, defaults)
: undefined,
},
]),
...resolveOneOf<unknown>([
{
param: 'owner_contact_id',
value: request.ownerContactId,
},
{
param: 'owner_contact',
value: request.ownerContact
? marshalNewContact(request.ownerContact, defaults)
: undefined,
},
]),
...resolveOneOf([
{
param: 'domain',
value: request.domain,
},
{
param: 'tld',
value: request.tld,
},
]),
...resolveOneOf<unknown>([
{
param: 'technical_contact_id',
value: request.technicalContactId,
},
{
param: 'technical_contact',
value: request.technicalContact
? marshalNewContact(request.technicalContact, defaults)
: undefined,
},
]),
})

export const marshalRegistrarApiEnableDomainDNSSECRequest = (
request: RegistrarApiEnableDomainDNSSECRequest,
defaults: DefaultValues,
Expand Down
50 changes: 50 additions & 0 deletions packages/clients/src/api/domain/v2beta1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ export interface AvailableDomain {
tld?: Tld
}

/** Check contacts compatibility response */
export interface CheckContactsCompatibilityResponse {
compatible: boolean
ownerCheckResult?: CheckContactsCompatibilityResponseContactCheckResult
administrativeCheckResult?: CheckContactsCompatibilityResponseContactCheckResult
technicalCheckResult?: CheckContactsCompatibilityResponseContactCheckResult
}

export interface CheckContactsCompatibilityResponseContactCheckResult {
compatible: boolean
errorMessage?: string
}

/** Clear dns zone records response */
export interface ClearDNSZoneRecordsResponse {}

Expand Down Expand Up @@ -1074,6 +1087,43 @@ export type RegistrarApiDeleteExternalDomainRequest = {
domain: string
}

export type RegistrarApiCheckContactsCompatibilityRequest = {
/** One-of ('parameter'): at most one of 'domain', 'tld' could be set. */
domain?: string
/** One-of ('parameter'): at most one of 'domain', 'tld' could be set. */
tld?: string
/**
* One-of ('ownerContactType'): at most one of 'ownerContactId',
* 'ownerContact' could be set.
*/
ownerContactId?: string
/**
* One-of ('ownerContactType'): at most one of 'ownerContactId',
* 'ownerContact' could be set.
*/
ownerContact?: NewContact
/**
* One-of ('administrativeContactType'): at most one of
* 'administrativeContactId', 'administrativeContact' could be set.
*/
administrativeContactId?: string
/**
* One-of ('administrativeContactType'): at most one of
* 'administrativeContactId', 'administrativeContact' could be set.
*/
administrativeContact?: NewContact
/**
* One-of ('technicalContactType'): at most one of 'technicalContactId',
* 'technicalContact' could be set.
*/
technicalContactId?: string
/**
* One-of ('technicalContactType'): at most one of 'technicalContactId',
* 'technicalContact' could be set.
*/
technicalContact?: NewContact
}

export type RegistrarApiListContactsRequest = {
page?: number
pageSize?: number
Expand Down