Skip to content

Commit 999d052

Browse files
authored
feat: update generated APIs (#702)
1 parent 83841e1 commit 999d052

File tree

4 files changed

+134
-6
lines changed

4 files changed

+134
-6
lines changed

packages/clients/src/api/tem/v1alpha1/api.gen.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ import {
1717
marshalCreateEmailRequest,
1818
unmarshalCreateEmailResponse,
1919
unmarshalDomain,
20+
unmarshalDomainLastStatus,
2021
unmarshalEmail,
2122
unmarshalListDomainsResponse,
2223
unmarshalListEmailsResponse,
2324
unmarshalStatistics,
2425
} from './marshalling.gen'
2526
import type {
2627
CancelEmailRequest,
28+
CheckDomainLastStatusRequest,
2729
CheckDomainRequest,
2830
CreateDomainRequest,
2931
CreateEmailRequest,
3032
CreateEmailResponse,
3133
Domain,
34+
DomainLastStatus,
3235
Email,
3336
GetDomainRequest,
3437
GetEmailRequest,
@@ -339,4 +342,29 @@ export class API extends ParentAPI {
339342
},
340343
unmarshalDomain,
341344
)
345+
346+
/**
347+
* Display SPF and DKIM records status and potential errors. Display SPF and
348+
* DKIM records status and potential errors, including the found records to
349+
* make debugging easier.
350+
*
351+
* @param request - The request {@link CheckDomainLastStatusRequest}
352+
* @returns A Promise of DomainLastStatus
353+
*/
354+
checkDomainLastStatus = (request: Readonly<CheckDomainLastStatusRequest>) =>
355+
this.client.fetch<DomainLastStatus>(
356+
{
357+
body: '{}',
358+
headers: jsonContentHeaders,
359+
method: 'POST',
360+
path: `/transactional-email/v1alpha1/regions/${validatePathParam(
361+
'region',
362+
request.region ?? this.client.settings.defaultRegion,
363+
)}/domains/${validatePathParam(
364+
'domainId',
365+
request.domainId,
366+
)}/verification`,
367+
},
368+
unmarshalDomainLastStatus,
369+
)
342370
}

packages/clients/src/api/tem/v1alpha1/index.gen.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ export { API } from './api.gen'
44
export * from './content.gen'
55
export type {
66
CancelEmailRequest,
7+
CheckDomainLastStatusRequest,
78
CheckDomainRequest,
89
CreateDomainRequest,
910
CreateEmailRequest,
1011
CreateEmailRequestAddress,
1112
CreateEmailRequestAttachment,
1213
CreateEmailResponse,
1314
Domain,
15+
DomainLastStatus,
16+
DomainLastStatusDkimRecord,
17+
DomainLastStatusRecordStatus,
18+
DomainLastStatusSpfRecord,
1419
DomainStatistics,
1520
DomainStatus,
1621
Email,

packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import type {
1313
CreateEmailRequestAttachment,
1414
CreateEmailResponse,
1515
Domain,
16+
DomainLastStatus,
17+
DomainLastStatusDkimRecord,
18+
DomainLastStatusSpfRecord,
1619
DomainStatistics,
1720
Email,
1821
EmailTry,
@@ -78,6 +81,34 @@ export const unmarshalDomain = (data: unknown) => {
7881
} as Domain
7982
}
8083

84+
const unmarshalDomainLastStatusDkimRecord = (data: unknown) => {
85+
if (!isJSONObject(data)) {
86+
throw new TypeError(
87+
`Unmarshalling the type 'DomainLastStatusDkimRecord' failed as data isn't a dictionary.`,
88+
)
89+
}
90+
91+
return {
92+
error: data.error,
93+
lastValidAt: unmarshalDate(data.last_valid_at),
94+
status: data.status,
95+
} as DomainLastStatusDkimRecord
96+
}
97+
98+
const unmarshalDomainLastStatusSpfRecord = (data: unknown) => {
99+
if (!isJSONObject(data)) {
100+
throw new TypeError(
101+
`Unmarshalling the type 'DomainLastStatusSpfRecord' failed as data isn't a dictionary.`,
102+
)
103+
}
104+
105+
return {
106+
error: data.error,
107+
lastValidAt: unmarshalDate(data.last_valid_at),
108+
status: data.status,
109+
} as DomainLastStatusSpfRecord
110+
}
111+
81112
export const unmarshalEmail = (data: unknown) => {
82113
if (!isJSONObject(data)) {
83114
throw new TypeError(
@@ -115,6 +146,25 @@ export const unmarshalCreateEmailResponse = (data: unknown) => {
115146
} as CreateEmailResponse
116147
}
117148

149+
export const unmarshalDomainLastStatus = (data: unknown) => {
150+
if (!isJSONObject(data)) {
151+
throw new TypeError(
152+
`Unmarshalling the type 'DomainLastStatus' failed as data isn't a dictionary.`,
153+
)
154+
}
155+
156+
return {
157+
dkimRecord: data.dkim_record
158+
? unmarshalDomainLastStatusDkimRecord(data.dkim_record)
159+
: undefined,
160+
domainId: data.domain_id,
161+
domainName: data.domain_name,
162+
spfRecord: data.spf_record
163+
? unmarshalDomainLastStatusSpfRecord(data.spf_record)
164+
: undefined,
165+
} as DomainLastStatus
166+
}
167+
118168
export const unmarshalListDomainsResponse = (data: unknown) => {
119169
if (!isJSONObject(data)) {
120170
throw new TypeError(

packages/clients/src/api/tem/v1alpha1/types.gen.ts

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
import type { Region } from '../../../bridge'
44

5+
export type DomainLastStatusRecordStatus =
6+
| 'unknown_record_status'
7+
| 'valid'
8+
| 'invalid'
9+
| 'not_found'
10+
511
export type DomainStatus =
612
| 'unknown'
713
| 'checked'
@@ -79,7 +85,7 @@ export interface Domain {
7985
lastValidAt?: Date
8086
/** Date and time of the domain's deletion. */
8187
revokedAt?: Date
82-
/** Error message returned if the last check failed. */
88+
/** @deprecated Error message returned if the last check failed. */
8389
lastError?: string
8490
/** Snippet of the SPF record to register in the DNS zone. */
8591
spfConfig: string
@@ -90,6 +96,38 @@ export interface Domain {
9096
region: Region
9197
}
9298

99+
/** Domain last status. */
100+
export interface DomainLastStatus {
101+
/** The id of the domain. */
102+
domainId: string
103+
/** The domain name (example.com). */
104+
domainName: string
105+
/** The SPF record verification data. */
106+
spfRecord?: DomainLastStatusSpfRecord
107+
/** The DKIM record verification data. */
108+
dkimRecord?: DomainLastStatusDkimRecord
109+
}
110+
111+
/** Domain last status. dkim record. */
112+
export interface DomainLastStatusDkimRecord {
113+
/** Status of the DKIM record's configurartion. */
114+
status: DomainLastStatusRecordStatus
115+
/** Time and date the DKIM record was last valid. */
116+
lastValidAt?: Date
117+
/** An error text displays in case the record is not valid. */
118+
error?: string
119+
}
120+
121+
/** Domain last status. spf record. */
122+
export interface DomainLastStatusSpfRecord {
123+
/** Status of the SPF record's configurartion. */
124+
status: DomainLastStatusRecordStatus
125+
/** Time and date the SPF record was last valid. */
126+
lastValidAt?: Date
127+
/** An error text displays in case the record is not valid. */
128+
error?: string
129+
}
130+
93131
export interface DomainStatistics {
94132
totalCount: number
95133
sentCount: number
@@ -107,7 +145,7 @@ export interface Email {
107145
projectId: string
108146
/** Email address of the sender. */
109147
mailFrom: string
110-
/** @deprecated (Deprecated) Email address of the recipient. */
148+
/** @deprecated Email address of the recipient. */
111149
rcptTo?: string
112150
/** Email address of the recipient. */
113151
mailRcpt: string
@@ -251,10 +289,7 @@ export type ListEmailsRequest = {
251289
until?: Date
252290
/** (Optional) List emails sent with this sender's email address. */
253291
mailFrom?: string
254-
/**
255-
* @deprecated (Deprecated) List emails sent to this recipient's email
256-
* address.
257-
*/
292+
/** @deprecated List emails sent to this recipient's email address. */
258293
mailTo?: string
259294
/** (Optional) List emails sent to this recipient's email address. */
260295
mailRcpt?: string
@@ -358,3 +393,13 @@ export type CheckDomainRequest = {
358393
/** ID of the domain to check. */
359394
domainId: string
360395
}
396+
397+
export type CheckDomainLastStatusRequest = {
398+
/**
399+
* Region to target. If none is passed will use default region from the
400+
* config.
401+
*/
402+
region?: Region
403+
/** ID of the domain to delete. */
404+
domainId: string
405+
}

0 commit comments

Comments
 (0)