API changes: Update company schema

This commit is contained in:
Steven Polley 2019-04-06 14:36:38 -06:00
parent c539729232
commit a396f83e13
1 changed files with 25 additions and 25 deletions

View File

@ -18,13 +18,6 @@ type Company struct {
StatusHref string `json:"status_href"` StatusHref string `json:"status_href"`
} `json:"_info"` } `json:"_info"`
} `json:"status"` } `json:"status"`
Type struct {
ID int `json:"id"`
Name string `json:"name"`
Info struct {
TypeHref string `json:"type_href"`
} `json:"_info"`
} `json:"type"`
AddressLine1 string `json:"addressLine1"` AddressLine1 string `json:"addressLine1"`
City string `json:"city"` City string `json:"city"`
State string `json:"state"` State string `json:"state"`
@ -36,11 +29,23 @@ type Company struct {
CountryHref string `json:"country_href"` CountryHref string `json:"country_href"`
} `json:"_info"` } `json:"_info"`
} `json:"country"` } `json:"country"`
PhoneNumber string `json:"phoneNumber"` PhoneNumber string `json:"phoneNumber"`
FaxNumber string `json:"faxNumber"` FaxNumber string `json:"faxNumber"`
Website string `json:"website"` Website string `json:"website"`
TerritoryID int `json:"territoryId"` Territory struct {
MarketID int `json:"marketId"` ID int `json:"id"`
Name string `json:"name"`
Info struct {
LocationHref string `json:"location_href"`
} `json:"_info"`
} `json:"territory"`
Market struct {
ID int `json:"id"`
Name string `json:"name"`
Info struct {
MarketHref string `json:"Market_href"`
} `json:"_info"`
} `json:"market"`
AccountNumber string `json:"accountNumber"` AccountNumber string `json:"accountNumber"`
DefaultContact struct { DefaultContact struct {
ID int `json:"id"` ID int `json:"id"`
@ -52,19 +57,20 @@ type Company struct {
DateAcquired time.Time `json:"dateAcquired"` DateAcquired time.Time `json:"dateAcquired"`
AnnualRevenue float64 `json:"annualRevenue"` AnnualRevenue float64 `json:"annualRevenue"`
NumberOfEmployees int `json:"numberOfEmployees"` NumberOfEmployees int `json:"numberOfEmployees"`
TimeZone struct { TimeZoneSetup struct {
ID int `json:"id"` ID int `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Info struct { Info struct {
TimeZoneSetupHref string `json:"timeZoneSetup_href"` TimeZoneSetupHref string `json:"timeZoneSetup_href"`
} `json:"_info"` } `json:"_info"`
} `json:"timeZone"` } `json:"timeZoneSetup"`
LeadFlag bool `json:"leadFlag"` LeadFlag bool `json:"leadFlag"`
UnsubscribeFlag bool `json:"unsubscribeFlag"` UnsubscribeFlag bool `json:"unsubscribeFlag"`
UserDefinedField1 string `json:"userDefinedField1"` UserDefinedField1 string `json:"userDefinedField1"`
UserDefinedField2 string `json:"userDefinedField2"` UserDefinedField2 string `json:"userDefinedField2"`
UserDefinedField3 string `json:"userDefinedField3"` UserDefinedField3 string `json:"userDefinedField3"`
UserDefinedField7 string `json:"userDefinedField7"` UserDefinedField4 string `json:"userDefinedField4"`
UserDefinedField5 string `json:"userDefinedField5"`
VendorIdentifier string `json:"vendorIdentifier"` VendorIdentifier string `json:"vendorIdentifier"`
TaxIdentifier string `json:"taxIdentifier"` TaxIdentifier string `json:"taxIdentifier"`
TaxCode struct { TaxCode struct {
@ -107,16 +113,8 @@ type Company struct {
InvoiceToEmailAddress string `json:"invoiceToEmailAddress"` InvoiceToEmailAddress string `json:"invoiceToEmailAddress"`
DeletedFlag bool `json:"deletedFlag"` DeletedFlag bool `json:"deletedFlag"`
MobileGUID string `json:"mobileGuid"` MobileGUID string `json:"mobileGuid"`
Currency struct { TypeIds []int `json:"typeIds"`
ID int `json:"id"` Info struct {
Symbol string `json:"symbol"`
IsoCode string `json:"isoCode"`
Name string `json:"name"`
Info struct {
CurrencyHref string `json:"currency_href"`
} `json:"_info"`
} `json:"currency"`
Info struct {
LastUpdated time.Time `json:"lastUpdated"` LastUpdated time.Time `json:"lastUpdated"`
UpdatedBy string `json:"updatedBy"` UpdatedBy string `json:"updatedBy"`
DateEntered time.Time `json:"dateEntered"` DateEntered time.Time `json:"dateEntered"`
@ -384,6 +382,8 @@ func (cw *Site) GetCompanyByName(companyName string) (*Company, error) {
return nil, fmt.Errorf("request failed for %s: %s", req.RestAction, err) return nil, fmt.Errorf("request failed for %s: %s", req.RestAction, err)
} }
fmt.Println(string(req.Body))
co := &[]Company{} co := &[]Company{}
err = json.Unmarshal(req.Body, co) err = json.Unmarshal(req.Body, co)
if err != nil { if err != nil {