lib/app/address.go

82 lines
1.8 KiB
Go
Raw Permalink Normal View History

2021-01-10 23:44:39 +00:00
package app
2021-01-14 06:36:35 +00:00
import (
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
2021-01-10 23:44:39 +00:00
// Address address struct
type Address struct {
City string
Country string
CountryCode string
PostalCode string
State string
StateCode string
Street string
}
2021-01-14 06:36:35 +00:00
// MarshalToCrm converts a first class object to swagger
func (obj *Address) MarshalToCrm() *crm_models.Address {
if obj == nil {
return nil
}
return &crm_models.Address{
City: obj.City,
Country: obj.Country,
CountryCode: obj.CountryCode,
PostalCode: obj.PostalCode,
State: obj.State,
StateCode: obj.StateCode,
Street: obj.Street,
}
}
// MarshalToOps converts a first class object to swagger
func (obj *Address) MarshalToOps() *ops_models.Address {
if obj == nil {
return nil
}
return &ops_models.Address{
City: obj.City,
Country: obj.Country,
CountryCode: obj.CountryCode,
PostalCode: obj.PostalCode,
State: obj.State,
StateCode: obj.StateCode,
Street: obj.Street,
}
}
// UnMarshalCrmAddress converts a first class object to swagger
func UnMarshalCrmAddress(s *crm_models.Address) *Address {
if s == nil {
return nil
}
return &Address{
City: s.City,
Country: s.Country,
CountryCode: s.CountryCode,
PostalCode: s.PostalCode,
State: s.State,
StateCode: s.StateCode,
Street: s.Street,
}
}
// UnMarshalOpsAddress converts a first class object to swagger
func UnMarshalOpsAddress(s *ops_models.Address) *Address {
if s == nil {
return nil
}
return &Address{
City: s.City,
Country: s.Country,
CountryCode: s.CountryCode,
PostalCode: s.PostalCode,
State: s.State,
StateCode: s.StateCode,
Street: s.Street,
}
}