82 lines
1.8 KiB
Go
82 lines
1.8 KiB
Go
package app
|
|
|
|
import (
|
|
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
|
|
)
|
|
|
|
// Address address struct
|
|
type Address struct {
|
|
City string
|
|
Country string
|
|
CountryCode string
|
|
PostalCode string
|
|
State string
|
|
StateCode string
|
|
Street string
|
|
}
|
|
|
|
// 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,
|
|
}
|
|
}
|