Skip to content

Commit 05b2f56

Browse files
authored
feat(tem): add mx records validation in get domain last status (#2409)
1 parent 7c5ad71 commit 05b2f56

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

packages_generated/tem/src/v1alpha1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ export class API extends ParentAPI {
358358
)
359359

360360
/**
361-
* Display SPF and DKIM records status and potential errors. Display SPF and DKIM records status and potential errors, including the found records to make debugging easier.
361+
* Display SPF, DKIM, DMARC and MX records status and potential errors. Display SPF, DKIM, DMARC and MX records status and potential errors, including the found records to make debugging easier.
362362
*
363363
* @param request - The request {@link GetDomainLastStatusRequest}
364364
* @returns A Promise of DomainLastStatus

packages_generated/tem/src/v1alpha1/index.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export type {
2525
DomainLastStatusAutoconfigStateReason,
2626
DomainLastStatusDkimRecord,
2727
DomainLastStatusDmarcRecord,
28+
DomainLastStatusMXRecord,
2829
DomainLastStatusRecordStatus,
2930
DomainLastStatusSpfRecord,
3031
DomainRecords,

packages_generated/tem/src/v1alpha1/marshalling.gen.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type {
2323
DomainLastStatusAutoconfigState,
2424
DomainLastStatusDkimRecord,
2525
DomainLastStatusDmarcRecord,
26+
DomainLastStatusMXRecord,
2627
DomainLastStatusSpfRecord,
2728
DomainRecords,
2829
DomainRecordsDMARC,
@@ -323,6 +324,22 @@ const unmarshalDomainLastStatusDmarcRecord = (
323324
} as DomainLastStatusDmarcRecord
324325
}
325326

327+
const unmarshalDomainLastStatusMXRecord = (
328+
data: unknown,
329+
): DomainLastStatusMXRecord => {
330+
if (!isJSONObject(data)) {
331+
throw new TypeError(
332+
`Unmarshalling the type 'DomainLastStatusMXRecord' failed as data isn't a dictionary.`,
333+
)
334+
}
335+
336+
return {
337+
error: data.error,
338+
lastValidAt: unmarshalDate(data.last_valid_at),
339+
status: data.status,
340+
} as DomainLastStatusMXRecord
341+
}
342+
326343
const unmarshalDomainLastStatusSpfRecord = (
327344
data: unknown,
328345
): DomainLastStatusSpfRecord => {
@@ -358,6 +375,9 @@ export const unmarshalDomainLastStatus = (data: unknown): DomainLastStatus => {
358375
: undefined,
359376
domainId: data.domain_id,
360377
domainName: data.domain_name,
378+
mxRecord: data.mx_record
379+
? unmarshalDomainLastStatusMXRecord(data.mx_record)
380+
: undefined,
361381
spfRecord: data.spf_record
362382
? unmarshalDomainLastStatusSpfRecord(data.spf_record)
363383
: undefined,

packages_generated/tem/src/v1alpha1/types.gen.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,21 @@ export interface DomainLastStatusDmarcRecord {
365365
error?: string
366366
}
367367

368+
export interface DomainLastStatusMXRecord {
369+
/**
370+
* Status of the MX record's configuration. This record is optional to validate a domain, but highly recommended.
371+
*/
372+
status: DomainLastStatusRecordStatus
373+
/**
374+
* Time and date the MX record was last valid.
375+
*/
376+
lastValidAt?: Date
377+
/**
378+
* An error text displays in case the record is not valid.
379+
*/
380+
error?: string
381+
}
382+
368383
export interface DomainLastStatusSpfRecord {
369384
/**
370385
* Status of the SPF record's configuration.
@@ -891,6 +906,10 @@ export interface DomainLastStatus {
891906
* The DMARC record verification data.
892907
*/
893908
dmarcRecord?: DomainLastStatusDmarcRecord
909+
/**
910+
* The MX record verification data.
911+
*/
912+
mxRecord?: DomainLastStatusMXRecord
894913
/**
895914
* The verification state of domain auto-configuration.
896915
*/
@@ -903,7 +922,7 @@ export type GetDomainLastStatusRequest = {
903922
*/
904923
region?: ScwRegion
905924
/**
906-
* ID of the domain to delete.
925+
* ID of the domain to get records status.
907926
*/
908927
domainId: string
909928
}

0 commit comments

Comments
 (0)