@@ -36,6 +36,7 @@ func getRecordFromTypeAndData(dnsType domain.RecordType, data string, records []
3636 flattenCurrentData := flattenDomainData (strings .ToLower (data ), r .Type ).(string )
3737
3838 if strings .HasPrefix (flattedData , flattenCurrentData ) && r .Type == dnsType {
39+
3940 if currentRecord != nil {
4041 return nil , errors .New ("multiple records found with same type and data" )
4142 }
@@ -83,30 +84,39 @@ func ExpandContact(contactMap map[string]interface{}) *domain.Contact {
8384 if v , ok := contactMap ["company_name" ].(string ); ok && v != "" {
8485 contact .CompanyName = v
8586 }
87+
8688 if v , ok := contactMap ["email_alt" ].(string ); ok && v != "" {
8789 contact .EmailAlt = v
8890 }
91+
8992 if v , ok := contactMap ["fax_number" ].(string ); ok && v != "" {
9093 contact .FaxNumber = v
9194 }
95+
9296 if v , ok := contactMap ["address_line_2" ].(string ); ok && v != "" {
9397 contact .AddressLine2 = v
9498 }
99+
95100 if v , ok := contactMap ["vat_identification_code" ].(string ); ok && v != "" {
96101 contact .VatIDentificationCode = v
97102 }
103+
98104 if v , ok := contactMap ["company_identification_code" ].(string ); ok && v != "" {
99105 contact .CompanyIDentificationCode = v
100106 }
107+
101108 if v , ok := contactMap ["lang" ].(string ); ok && v != "" {
102109 contact .Lang = std .LanguageCode (v )
103110 }
111+
104112 if v , ok := contactMap ["resale" ].(bool ); ok {
105113 contact .Resale = v
106114 }
115+
107116 if v , ok := contactMap ["state" ].(string ); ok && v != "" {
108117 contact .State = v
109118 }
119+
110120 if v , ok := contactMap ["whois_opt_in" ].(bool ); ok {
111121 contact .WhoisOptIn = v
112122 }
@@ -213,21 +223,27 @@ func ExpandNewContact(contactMap map[string]interface{}) *domain.NewContact {
213223 if v , ok := contactMap ["company_name" ].(string ); ok {
214224 contact .CompanyName = scw .StringPtr (v )
215225 }
226+
216227 if v , ok := contactMap ["email_alt" ].(string ); ok {
217228 contact .EmailAlt = scw .StringPtr (v )
218229 }
230+
219231 if v , ok := contactMap ["fax_number" ].(string ); ok {
220232 contact .FaxNumber = scw .StringPtr (v )
221233 }
234+
222235 if v , ok := contactMap ["address_line_2" ].(string ); ok {
223236 contact .AddressLine2 = scw .StringPtr (v )
224237 }
238+
225239 if v , ok := contactMap ["vat_identification_code" ].(string ); ok {
226240 contact .VatIDentificationCode = scw .StringPtr (v )
227241 }
242+
228243 if v , ok := contactMap ["company_identification_code" ].(string ); ok {
229244 contact .CompanyIDentificationCode = scw .StringPtr (v )
230245 }
246+
231247 if v , ok := contactMap ["state" ].(string ); ok {
232248 contact .State = scw .StringPtr (v )
233249 }
@@ -267,6 +283,7 @@ func parseEnum(data map[string]interface{}, key string, defaultValue string) str
267283func parseStruct [T any ](data map [string ]interface {}, key string ) * T {
268284 if nested , ok := data [key ].(map [string ]interface {}); ok {
269285 var result T
286+
270287 mapToStruct (nested , & result )
271288
272289 return & result
@@ -347,6 +364,7 @@ func SplitDomains(input *string) []string {
347364 }
348365
349366 domains := strings .Split (* input , "," )
367+
350368 var result []string
351369
352370 for _ , domain := range domains {
@@ -598,6 +616,7 @@ func FlattenDSRecord(dsRecords []*domain.DSRecord) []interface{} {
598616 }
599617
600618 results := make ([]interface {}, 0 , len (dsRecords ))
619+
601620 for _ , dsRecord := range dsRecords {
602621 item := map [string ]interface {}{
603622 "key_id" : dsRecord .KeyID ,
@@ -609,13 +628,15 @@ func FlattenDSRecord(dsRecords []*domain.DSRecord) []interface{} {
609628 "type" : string (dsRecord .Digest .Type ),
610629 "digest" : dsRecord .Digest .Digest ,
611630 }
631+
612632 if dsRecord .Digest .PublicKey != nil {
613633 digest ["public_key" ] = []interface {}{
614634 map [string ]interface {}{
615635 "key" : dsRecord .Digest .PublicKey .Key ,
616636 },
617637 }
618638 }
639+
619640 item ["digest" ] = []interface {}{digest }
620641 }
621642
0 commit comments