@@ -26,7 +26,10 @@ import type {
2626 DomainLastStatusMXRecord ,
2727 DomainLastStatusSpfRecord ,
2828 DomainRecords ,
29+ DomainRecordsDKIM ,
2930 DomainRecordsDMARC ,
31+ DomainRecordsMX ,
32+ DomainRecordsSPF ,
3033 DomainReputation ,
3134 DomainStatistics ,
3235 Email ,
@@ -96,6 +99,19 @@ export const unmarshalEmail = (data: unknown): Email => {
9699 } as Email
97100}
98101
102+ const unmarshalDomainRecordsDKIM = ( data : unknown ) : DomainRecordsDKIM => {
103+ if ( ! isJSONObject ( data ) ) {
104+ throw new TypeError (
105+ `Unmarshalling the type 'DomainRecordsDKIM' failed as data isn't a dictionary.` ,
106+ )
107+ }
108+
109+ return {
110+ name : data . name ,
111+ value : data . value ,
112+ } as DomainRecordsDKIM
113+ }
114+
99115const unmarshalDomainRecordsDMARC = ( data : unknown ) : DomainRecordsDMARC => {
100116 if ( ! isJSONObject ( data ) ) {
101117 throw new TypeError (
@@ -109,6 +125,32 @@ const unmarshalDomainRecordsDMARC = (data: unknown): DomainRecordsDMARC => {
109125 } as DomainRecordsDMARC
110126}
111127
128+ const unmarshalDomainRecordsMX = ( data : unknown ) : DomainRecordsMX => {
129+ if ( ! isJSONObject ( data ) ) {
130+ throw new TypeError (
131+ `Unmarshalling the type 'DomainRecordsMX' failed as data isn't a dictionary.` ,
132+ )
133+ }
134+
135+ return {
136+ name : data . name ,
137+ value : data . value ,
138+ } as DomainRecordsMX
139+ }
140+
141+ const unmarshalDomainRecordsSPF = ( data : unknown ) : DomainRecordsSPF => {
142+ if ( ! isJSONObject ( data ) ) {
143+ throw new TypeError (
144+ `Unmarshalling the type 'DomainRecordsSPF' failed as data isn't a dictionary.` ,
145+ )
146+ }
147+
148+ return {
149+ name : data . name ,
150+ value : data . value ,
151+ } as DomainRecordsSPF
152+ }
153+
112154const unmarshalDomainRecords = ( data : unknown ) : DomainRecords => {
113155 if ( ! isJSONObject ( data ) ) {
114156 throw new TypeError (
@@ -117,7 +159,10 @@ const unmarshalDomainRecords = (data: unknown): DomainRecords => {
117159 }
118160
119161 return {
162+ dkim : data . dkim ? unmarshalDomainRecordsDKIM ( data . dkim ) : undefined ,
120163 dmarc : data . dmarc ? unmarshalDomainRecordsDMARC ( data . dmarc ) : undefined ,
164+ mx : data . mx ? unmarshalDomainRecordsMX ( data . mx ) : undefined ,
165+ spf : data . spf ? unmarshalDomainRecordsSPF ( data . spf ) : undefined ,
121166 } as DomainRecords
122167}
123168
0 commit comments