Skip to content

Commit 1823af4

Browse files
authored
feat(tem): add domain reputation score (#946)
1 parent aa54478 commit 1823af4

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export type {
1515
DomainLastStatusDkimRecord,
1616
DomainLastStatusRecordStatus,
1717
DomainLastStatusSpfRecord,
18+
DomainReputation,
19+
DomainReputationStatus,
1820
DomainStatistics,
1921
DomainStatus,
2022
Email,

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {
1616
DomainLastStatus,
1717
DomainLastStatusDkimRecord,
1818
DomainLastStatusSpfRecord,
19+
DomainReputation,
1920
DomainStatistics,
2021
Email,
2122
EmailTry,
@@ -24,6 +25,22 @@ import type {
2425
Statistics,
2526
} from './types.gen'
2627

28+
const unmarshalDomainReputation = (data: unknown) => {
29+
if (!isJSONObject(data)) {
30+
throw new TypeError(
31+
`Unmarshalling the type 'DomainReputation' failed as data isn't a dictionary.`,
32+
)
33+
}
34+
35+
return {
36+
previousScore: data.previous_score,
37+
previousScoredAt: unmarshalDate(data.previous_scored_at),
38+
score: data.score,
39+
scoredAt: unmarshalDate(data.scored_at),
40+
status: data.status,
41+
} as DomainReputation
42+
}
43+
2744
const unmarshalDomainStatistics = (data: unknown) => {
2845
if (!isJSONObject(data)) {
2946
throw new TypeError(
@@ -72,6 +89,9 @@ export const unmarshalDomain = (data: unknown) => {
7289
organizationId: data.organization_id,
7390
projectId: data.project_id,
7491
region: data.region,
92+
reputation: data.reputation
93+
? unmarshalDomainReputation(data.reputation)
94+
: undefined,
7595
revokedAt: unmarshalDate(data.revoked_at),
7696
spfConfig: data.spf_config,
7797
statistics: data.statistics

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

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ export type DomainLastStatusRecordStatus =
88
| 'invalid'
99
| 'not_found'
1010

11+
export type DomainReputationStatus =
12+
| 'unknown'
13+
| 'excellent'
14+
| 'good'
15+
| 'average'
16+
| 'bad'
17+
1118
export type DomainStatus =
1219
| 'unknown'
1320
| 'checked'
@@ -103,6 +110,11 @@ export interface Domain {
103110
dkimConfig: string
104111
/** Domain's statistics. */
105112
statistics?: DomainStatistics
113+
/**
114+
* Domain's reputation, available when your domain is checked and has sent
115+
* enough emails.
116+
*/
117+
reputation?: DomainReputation
106118
region: Region
107119
}
108120

@@ -120,7 +132,7 @@ export interface DomainLastStatus {
120132

121133
/** Domain last status. dkim record. */
122134
export interface DomainLastStatusDkimRecord {
123-
/** Status of the DKIM record's configurartion. */
135+
/** Status of the DKIM record's configuration. */
124136
status: DomainLastStatusRecordStatus
125137
/** Time and date the DKIM record was last valid. */
126138
lastValidAt?: Date
@@ -130,14 +142,28 @@ export interface DomainLastStatusDkimRecord {
130142

131143
/** Domain last status. spf record. */
132144
export interface DomainLastStatusSpfRecord {
133-
/** Status of the SPF record's configurartion. */
145+
/** Status of the SPF record's configuration. */
134146
status: DomainLastStatusRecordStatus
135147
/** Time and date the SPF record was last valid. */
136148
lastValidAt?: Date
137149
/** An error text displays in case the record is not valid. */
138150
error?: string
139151
}
140152

153+
/** Domain. reputation. */
154+
export interface DomainReputation {
155+
/** Status of your domain reputation. */
156+
status: DomainReputationStatus
157+
/** Represent a number between 0 and 100 of your domain reputation score. */
158+
score: number
159+
/** Time and date the score was calculated. */
160+
scoredAt?: Date
161+
/** The domain reputation score previously calculated. */
162+
previousScore?: number
163+
/** Time and date the previous score was calculated. */
164+
previousScoredAt?: Date
165+
}
166+
141167
export interface DomainStatistics {
142168
totalCount: number
143169
sentCount: number

0 commit comments

Comments
 (0)