add getTicketNotes - Lots of dates are now strings
This commit is contained in:
parent
386a7d75ca
commit
c341f047a5
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//ServiceTeam is a struct to hold the unmarshaled JSON data when making a call to the service API
|
//ServiceTeam is a struct to hold the unmarshaled JSON data when making a call to the service API
|
||||||
@ -36,9 +35,9 @@ type ServiceTeam struct {
|
|||||||
} `json:"department"`
|
} `json:"department"`
|
||||||
DeleteNotifyFlag bool `json:"deleteNotifyFlag"`
|
DeleteNotifyFlag bool `json:"deleteNotifyFlag"`
|
||||||
Info struct {
|
Info struct {
|
||||||
LastUpdated time.Time `json:"lastUpdated"`
|
LastUpdated string `json:"lastUpdated"`
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
DateEntered time.Time `json:"dateEntered"`
|
DateEntered string `json:"dateEntered"`
|
||||||
EnteredBy string `json:"enteredBy"`
|
EnteredBy string `json:"enteredBy"`
|
||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
}
|
}
|
||||||
@ -62,7 +61,7 @@ type BoardTeam struct {
|
|||||||
LocationID int `json:"locationId"`
|
LocationID int `json:"locationId"`
|
||||||
BusinessUnitID int `json:"businessUnitId"`
|
BusinessUnitID int `json:"businessUnitId"`
|
||||||
Info struct {
|
Info struct {
|
||||||
LastUpdated time.Time `json:"lastUpdated"`
|
LastUpdated string `json:"lastUpdated"`
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
}
|
}
|
||||||
@ -102,9 +101,9 @@ type BoardStatus struct {
|
|||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
} `json:"emailTemplate,omitempty"`
|
} `json:"emailTemplate,omitempty"`
|
||||||
Info struct {
|
Info struct {
|
||||||
LastUpdated time.Time `json:"lastUpdated"`
|
LastUpdated string `json:"lastUpdated"`
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
DateEntered time.Time `json:"dateEntered"`
|
DateEntered string `json:"dateEntered"`
|
||||||
EnteredBy string `json:"enteredBy"`
|
EnteredBy string `json:"enteredBy"`
|
||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
}
|
}
|
||||||
@ -196,10 +195,10 @@ type Ticket struct {
|
|||||||
AutomaticEmailContactFlag bool `json:"automaticEmailContactFlag"`
|
AutomaticEmailContactFlag bool `json:"automaticEmailContactFlag"`
|
||||||
AutomaticEmailResourceFlag bool `json:"automaticEmailResourceFlag"`
|
AutomaticEmailResourceFlag bool `json:"automaticEmailResourceFlag"`
|
||||||
AutomaticEmailCcFlag bool `json:"automaticEmailCcFlag"`
|
AutomaticEmailCcFlag bool `json:"automaticEmailCcFlag"`
|
||||||
ClosedDate time.Time `json:"closedDate"`
|
ClosedDate string `json:"closedDate"`
|
||||||
ClosedBy string `json:"closedBy"`
|
ClosedBy string `json:"closedBy"`
|
||||||
ClosedFlag bool `json:"closedFlag"`
|
ClosedFlag bool `json:"closedFlag"`
|
||||||
DateEntered time.Time `json:"dateEntered"`
|
DateEntered string `json:"dateEntered"`
|
||||||
EnteredBy string `json:"enteredBy"`
|
EnteredBy string `json:"enteredBy"`
|
||||||
ActualHours float64 `json:"actualHours,omitempty"`
|
ActualHours float64 `json:"actualHours,omitempty"`
|
||||||
Approved bool `json:"approved"`
|
Approved bool `json:"approved"`
|
||||||
@ -211,9 +210,9 @@ type Ticket struct {
|
|||||||
EstimatedTimeRevenue float64 `json:"estimatedTimeRevenue"`
|
EstimatedTimeRevenue float64 `json:"estimatedTimeRevenue"`
|
||||||
BillingMethod string `json:"billingMethod"`
|
BillingMethod string `json:"billingMethod"`
|
||||||
SubBillingMethod string `json:"subBillingMethod"`
|
SubBillingMethod string `json:"subBillingMethod"`
|
||||||
DateResolved time.Time `json:"dateResolved"`
|
DateResolved string `json:"dateResolved"`
|
||||||
DateResplan time.Time `json:"dateResplan"`
|
DateResplan string `json:"dateResplan"`
|
||||||
DateResponded time.Time `json:"dateResponded"`
|
DateResponded string `json:"dateResponded"`
|
||||||
ResolveMinutes int `json:"resolveMinutes"`
|
ResolveMinutes int `json:"resolveMinutes"`
|
||||||
ResPlanMinutes int `json:"resPlanMinutes"`
|
ResPlanMinutes int `json:"resPlanMinutes"`
|
||||||
RespondMinutes int `json:"respondMinutes"`
|
RespondMinutes int `json:"respondMinutes"`
|
||||||
@ -242,7 +241,7 @@ type Ticket struct {
|
|||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
} `json:"currency"`
|
} `json:"currency"`
|
||||||
Info struct {
|
Info struct {
|
||||||
LastUpdated time.Time `json:"lastUpdated"`
|
LastUpdated string `json:"lastUpdated"`
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
ActivitiesHref string `json:"activities_href"`
|
ActivitiesHref string `json:"activities_href"`
|
||||||
ScheduleentriesHref string `json:"scheduleentries_href"`
|
ScheduleentriesHref string `json:"scheduleentries_href"`
|
||||||
@ -263,7 +262,7 @@ type Ticket struct {
|
|||||||
//It's not always a string. I need to somehow *puts on sunglasses*... reflect on this as this is a dynamic type.
|
//It's not always a string. I need to somehow *puts on sunglasses*... reflect on this as this is a dynamic type.
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
} `json:"customFields"`
|
} `json:"customFields"`
|
||||||
RequiredDate time.Time `json:"requiredDate,omitempty"`
|
RequiredDate string `json:"requiredDate,omitempty"`
|
||||||
BudgetHours float64 `json:"budgetHours,omitempty"`
|
BudgetHours float64 `json:"budgetHours,omitempty"`
|
||||||
AddressLine2 string `json:"addressLine2,omitempty"`
|
AddressLine2 string `json:"addressLine2,omitempty"`
|
||||||
Contact struct {
|
Contact struct {
|
||||||
@ -277,6 +276,39 @@ type Ticket struct {
|
|||||||
ContactPhoneExtension string `json:"contactPhoneExtension,omitempty"`
|
ContactPhoneExtension string `json:"contactPhoneExtension,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TicketNote struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
TicketID int `json:"ticketId"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
DetailDescriptionFlag bool `json:"detailDescriptionFlag"`
|
||||||
|
InternalAnalysisFlag bool `json:"internalAnalysisFlag"`
|
||||||
|
ResolutionFlag bool `json:"resolutionFlag"`
|
||||||
|
Contact struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Info struct {
|
||||||
|
ContactHref string `json:"contact_href"`
|
||||||
|
} `json:"_info"`
|
||||||
|
} `json:"contact,omitempty"`
|
||||||
|
DateCreated string `json:"dateCreated"`
|
||||||
|
CreatedBy string `json:"createdBy"`
|
||||||
|
InternalFlag bool `json:"internalFlag"`
|
||||||
|
ExternalFlag bool `json:"externalFlag"`
|
||||||
|
Info struct {
|
||||||
|
LastUpdated string `json:"lastUpdated"`
|
||||||
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
} `json:"_info"`
|
||||||
|
Member struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Info struct {
|
||||||
|
MemberHref string `json:"member_href"`
|
||||||
|
ImageHref string `json:"image_href"`
|
||||||
|
} `json:"_info"`
|
||||||
|
} `json:"member,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
//Board is a struct to hold the unmarshaled JSON data when making a call to the Service API
|
//Board is a struct to hold the unmarshaled JSON data when making a call to the Service API
|
||||||
type Board struct {
|
type Board struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
@ -397,7 +429,7 @@ type Board struct {
|
|||||||
ClosedLoopAllFlag bool `json:"closedLoopAllFlag"`
|
ClosedLoopAllFlag bool `json:"closedLoopAllFlag"`
|
||||||
AllSort string `json:"allSort"`
|
AllSort string `json:"allSort"`
|
||||||
Info struct {
|
Info struct {
|
||||||
LastUpdated time.Time `json:"lastUpdated"`
|
LastUpdated string `json:"lastUpdated"`
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
ShowDependenciesFlag bool `json:"showDependenciesFlag,omitempty"`
|
ShowDependenciesFlag bool `json:"showDependenciesFlag,omitempty"`
|
||||||
@ -413,11 +445,11 @@ type Source struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DefaultFlag bool `json:"defaultFlag"`
|
DefaultFlag bool `json:"defaultFlag"`
|
||||||
Info struct {
|
Info struct {
|
||||||
LastUpdated time.Time `json:"lastUpdated"`
|
LastUpdated string `json:"lastUpdated"`
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
} `json:"_info"`
|
} `json:"_info"`
|
||||||
EnteredBy string `json:"enteredBy"`
|
EnteredBy string `json:"enteredBy"`
|
||||||
DateEntered time.Time `json:"dateEntered"`
|
DateEntered string `json:"dateEntered"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//TimeEntryReference is a struct to hold the unmarshaled JSON data when making a call to the Service API
|
//TimeEntryReference is a struct to hold the unmarshaled JSON data when making a call to the Service API
|
||||||
@ -645,3 +677,19 @@ func (cw *Site) GetSources() (*[]Source, error) {
|
|||||||
|
|
||||||
return source, nil
|
return source, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cw *Site) GetTicketNotes(ticketID int) (*[]TicketNote, error) {
|
||||||
|
req := cw.NewRequest(fmt.Sprintf("/service/tickets/%d/notes", ticketID), "GET", nil)
|
||||||
|
err := req.Do()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("request failed for %s: %s", req.RestAction, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ticketNotes := &[]TicketNote{}
|
||||||
|
err = json.Unmarshal(req.Body, ticketNotes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to unmarshal body into struct: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return ticketNotes, nil
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user