diff --git a/packages/clients/src/api/domain/v2beta1/api.gen.ts b/packages/clients/src/api/domain/v2beta1/api.gen.ts index 456b059b8..ef7ecb4a2 100644 --- a/packages/clients/src/api/domain/v2beta1/api.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/api.gen.ts @@ -16,6 +16,7 @@ import { marshalImportRawDNSZoneRequest, marshalRefreshDNSZoneRequest, marshalRegistrarApiBuyDomainsRequest, + marshalRegistrarApiCheckContactsCompatibilityRequest, marshalRegistrarApiEnableDomainDNSSECRequest, marshalRegistrarApiRegisterExternalDomainRequest, marshalRegistrarApiRenewDomainsRequest, @@ -26,6 +27,7 @@ import { marshalUpdateDNSZoneNameserversRequest, marshalUpdateDNSZoneRecordsRequest, marshalUpdateDNSZoneRequest, + unmarshalCheckContactsCompatibilityResponse, unmarshalClearDNSZoneRecordsResponse, unmarshalContact, unmarshalDNSZone, @@ -58,6 +60,7 @@ import { unmarshalUpdateDNSZoneRecordsResponse, } from './marshalling.gen' import type { + CheckContactsCompatibilityResponse, ClearDNSZoneRecordsRequest, ClearDNSZoneRecordsResponse, CloneDNSZoneRequest, @@ -104,6 +107,7 @@ import type { RefreshDNSZoneResponse, RegisterExternalDomainResponse, RegistrarApiBuyDomainsRequest, + RegistrarApiCheckContactsCompatibilityRequest, RegistrarApiDeleteExternalDomainRequest, RegistrarApiDisableDomainAutoRenewRequest, RegistrarApiDisableDomainDNSSECRequest, @@ -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 = {}, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalRegistrarApiCheckContactsCompatibilityRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/domain/v2beta1/check-contacts-compatibility`, + }, + unmarshalCheckContactsCompatibilityResponse, + ) + protected pageOfListContacts = ( request: Readonly = {}, ) => diff --git a/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts b/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts index 138e16a9f..7bae15ac0 100644 --- a/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts @@ -11,6 +11,8 @@ import { import type { DefaultValues } from '../../../bridge' import type { AvailableDomain, + CheckContactsCompatibilityResponse, + CheckContactsCompatibilityResponseContactCheckResult, ClearDNSZoneRecordsResponse, CloneDNSZoneRequest, Contact, @@ -82,6 +84,7 @@ import type { RefreshDNSZoneResponse, RegisterExternalDomainResponse, RegistrarApiBuyDomainsRequest, + RegistrarApiCheckContactsCompatibilityRequest, RegistrarApiEnableDomainDNSSECRequest, RegistrarApiRegisterExternalDomainRequest, RegistrarApiRenewDomainsRequest, @@ -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( @@ -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( @@ -1698,6 +1743,58 @@ export const marshalRegistrarApiBuyDomainsRequest = ( ]), }) +export const marshalRegistrarApiCheckContactsCompatibilityRequest = ( + request: RegistrarApiCheckContactsCompatibilityRequest, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'administrative_contact_id', + value: request.administrativeContactId, + }, + { + param: 'administrative_contact', + value: request.administrativeContact + ? marshalNewContact(request.administrativeContact, defaults) + : undefined, + }, + ]), + ...resolveOneOf([ + { + 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([ + { + 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, diff --git a/packages/clients/src/api/domain/v2beta1/types.gen.ts b/packages/clients/src/api/domain/v2beta1/types.gen.ts index dcc320c3f..39b4c958b 100644 --- a/packages/clients/src/api/domain/v2beta1/types.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/types.gen.ts @@ -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 {} @@ -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