Skip to content

Commit

Permalink
feat(tem): add domain records and DMARC configuration (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Mar 15, 2024
1 parent 1a23b6a commit 5d43aaa
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/clients/src/api/tem/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export type {
DomainLastStatusDmarcRecord,
DomainLastStatusRecordStatus,
DomainLastStatusSpfRecord,
DomainRecords,
DomainRecordsDMARC,
DomainReputation,
DomainReputationStatus,
DomainStatistics,
Expand Down
28 changes: 28 additions & 0 deletions packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import type {
DomainLastStatusDkimRecord,
DomainLastStatusDmarcRecord,
DomainLastStatusSpfRecord,
DomainRecords,
DomainRecordsDMARC,
DomainReputation,
DomainStatistics,
Email,
Expand Down Expand Up @@ -68,6 +70,31 @@ export const unmarshalEmail = (data: unknown): Email => {
} as Email
}

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

return {
name: data.name,
value: data.value,
} as DomainRecordsDMARC
}

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

return {
dmarc: data.dmarc ? unmarshalDomainRecordsDMARC(data.dmarc) : undefined,
} as DomainRecords
}

const unmarshalDomainReputation = (data: unknown): DomainReputation => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down Expand Up @@ -116,6 +143,7 @@ export const unmarshalDomain = (data: unknown): Domain => {
nextCheckAt: unmarshalDate(data.next_check_at),
organizationId: data.organization_id,
projectId: data.project_id,
records: data.records ? unmarshalDomainRecords(data.records) : undefined,
region: data.region,
reputation: data.reputation
? unmarshalDomainReputation(data.reputation)
Expand Down
14 changes: 14 additions & 0 deletions packages/clients/src/api/tem/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export type ListEmailsRequestOrderBy =
| 'subject_desc'
| 'subject_asc'

export interface DomainRecordsDMARC {
/** Name of the DMARC TXT record. */
name: string
/** Value of the DMARC TXT record. */
value: string
}

export interface EmailTry {
/** Rank number of this attempt to send the email. */
rank: number
Expand All @@ -75,6 +82,11 @@ export interface EmailTry {
message: string
}

export interface DomainRecords {
/** DMARC TXT record specification. */
dmarc?: DomainRecordsDMARC
}

export interface DomainReputation {
/** Status of your domain's reputation. */
status: DomainReputationStatus
Expand Down Expand Up @@ -217,6 +229,8 @@ export interface Domain {
* sent enough emails.
*/
reputation?: DomainReputation
/** List of records to configure to validate a domain. */
records?: DomainRecords
/**
* Region to target. If none is passed will use default region from the
* config.
Expand Down

0 comments on commit 5d43aaa

Please sign in to comment.