Added ConfigurationReference struct and GetTicketConfigurationsByID(ticketID) receiver

This commit is contained in:
Steven Polley 2018-06-26 10:03:11 -06:00
parent b35fcbbbb0
commit ab8a24800f

View File

@ -179,6 +179,15 @@ type TimeEntryReference struct {
} `json:"_info"`
}
type ConfigurationReference struct {
ID int `json:"id"`
DeviceIdentifier string `json:"deviceIdentifier"`
Info struct {
Name string `json:"name"`
ConfigurationHref string `json:"configuration_href"`
} `json:"_info"`
}
func (cw *ConnectwiseSite) GetTicketByID(ticketID int) *Ticket {
Url := cw.BuildUrl(fmt.Sprintf("/service/tickets/%d", ticketID))
@ -200,3 +209,14 @@ func (cw *ConnectwiseSite) GetTicketTimeEntriesByID(ticketID int) *[]TimeEntryRe
return &timeEntryReference
}
func (cw *ConnectwiseSite) GetTicketConfigurationsByID(ticketID int) *[]ConfigurationReference {
Url := cw.BuildUrl(fmt.Sprintf("/service/tickets/%d/configurations", ticketID))
body := cw.GetRequest(Url)
configurationReference := []ConfigurationReference{}
check(json.Unmarshal(body, &configurationReference))
return &configurationReference
}