@@ -13,43 +13,42 @@ import type {
1313 CreateEmailRequestAttachment ,
1414 CreateEmailResponse ,
1515 Domain ,
16+ DomainStatistics ,
1617 Email ,
1718 EmailTry ,
1819 ListDomainsResponse ,
1920 ListEmailsResponse ,
2021 Statistics ,
2122} from './types.gen'
2223
23- const unmarshalEmailTry = ( data : unknown ) => {
24+ const unmarshalDomainStatistics = ( data : unknown ) => {
2425 if ( ! isJSONObject ( data ) ) {
2526 throw new TypeError (
26- `Unmarshalling the type 'EmailTry ' failed as data isn't a dictionary.` ,
27+ `Unmarshalling the type 'DomainStatistics ' failed as data isn't a dictionary.` ,
2728 )
2829 }
2930
3031 return {
31- code : data . code ,
32- message : data . message ,
33- rank : data . rank ,
34- triedAt : unmarshalDate ( data . tried_at ) ,
35- } as EmailTry
32+ canceledCount : data . canceled_count ,
33+ failedCount : data . failed_count ,
34+ sentCount : data . sent_count ,
35+ totalCount : data . total_count ,
36+ } as DomainStatistics
3637}
3738
38- export const unmarshalStatistics = ( data : unknown ) => {
39+ const unmarshalEmailTry = ( data : unknown ) => {
3940 if ( ! isJSONObject ( data ) ) {
4041 throw new TypeError (
41- `Unmarshalling the type 'Statistics ' failed as data isn't a dictionary.` ,
42+ `Unmarshalling the type 'EmailTry ' failed as data isn't a dictionary.` ,
4243 )
4344 }
4445
4546 return {
46- canceledCount : data . canceled_count ,
47- failedCount : data . failed_count ,
48- newCount : data . new_count ,
49- sendingCount : data . sending_count ,
50- sentCount : data . sent_count ,
51- totalCount : data . total_count ,
52- } as Statistics
47+ code : data . code ,
48+ message : data . message ,
49+ rank : data . rank ,
50+ triedAt : unmarshalDate ( data . tried_at ) ,
51+ } as EmailTry
5352}
5453
5554export const unmarshalDomain = ( data : unknown ) => {
@@ -73,7 +72,7 @@ export const unmarshalDomain = (data: unknown) => {
7372 revokedAt : unmarshalDate ( data . revoked_at ) ,
7473 spfConfig : data . spf_config ,
7574 statistics : data . statistics
76- ? unmarshalStatistics ( data . statistics )
75+ ? unmarshalDomainStatistics ( data . statistics )
7776 : undefined ,
7877 status : data . status ,
7978 } as Domain
@@ -140,6 +139,23 @@ export const unmarshalListEmailsResponse = (data: unknown) => {
140139 } as ListEmailsResponse
141140}
142141
142+ export const unmarshalStatistics = ( data : unknown ) => {
143+ if ( ! isJSONObject ( data ) ) {
144+ throw new TypeError (
145+ `Unmarshalling the type 'Statistics' failed as data isn't a dictionary.` ,
146+ )
147+ }
148+
149+ return {
150+ canceledCount : data . canceled_count ,
151+ failedCount : data . failed_count ,
152+ newCount : data . new_count ,
153+ sendingCount : data . sending_count ,
154+ sentCount : data . sent_count ,
155+ totalCount : data . total_count ,
156+ } as Statistics
157+ }
158+
143159const marshalCreateEmailRequestAddress = (
144160 request : CreateEmailRequestAddress ,
145161 defaults : DefaultValues ,
0 commit comments