Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body. The body can contain JSON (if the error is intended) or xml.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
AuthenticationService handles authentication for the Service Manager instance / API.
type BasicAuthTransport ¶
type BasicAuthTransport struct { Username string Password string // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper }
BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.
func (*BasicAuthTransport) Client ¶
func (t *BasicAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication. This is a nice little bit of sugar so we can just get the client instead of creating the client in the calling code. If it's necessary to send more information on client init, the calling code can always skip this and set the transport itself.
type Client ¶
type Client struct { // Services used for talking to different parts of the API. Authentication *AuthenticationService Incident *IMService // contains filtered or unexported fields }
A Client manages communication with the API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. If specified, the value pointed to by body is JSON encoded and included as the request body.
type CookieAuthTransport ¶
type CookieAuthTransport struct { Username string Password string AuthURL string // SessionObject is the authenticated cookie string.s // It's passed in each call to prove the client is authenticated. SessionObject []*http.Cookie // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper }
CookieAuthTransport is an http.RoundTripper that authenticates all requests using cookie-based authentication.
Note that it is generally preferable to use HTTP BASIC authentication with the REST API. However, this resource may be used to mimic the behaviour of login page (e.g. to display login errors to a user).
func (*CookieAuthTransport) Client ¶
func (t *CookieAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using cookie authentication
type Error ¶
type Error struct { HTTPError error ErrorMessages []string `json:"errorMessages"` Errors map[string]string `json:"errors"` }
Error message from the Service Manager
type IM ¶
type IM struct { AffectedCI string `json:"AffectedCI"` Area string `json:"Area"` Assignee string `json:"Assignee"` AssignmentGroup string `json:"AssignmentGroup"` Category string `json:"Category"` ClosedBy string `json:"ClosedBy"` ClosedTime time.Time `json:"ClosedTime"` ClosureCode string `json:"ClosureCode"` Company string `json:"Company"` Description []string `json:"Description"` Impact string `json:"Impact"` IncidentID string `json:"IncidentID"` Location string `json:"Location"` OpenTime time.Time `json:"OpenTime"` OpenedBy string `json:"OpenedBy"` ProblemType string `json:"ProblemType"` SLAAgreementID int `json:"SLAAgreementID"` Service string `json:"Service"` Solution []string `json:"Solution"` Status string `json:"Status"` Subarea string `json:"Subarea"` TicketOwner string `json:"TicketOwner"` Title string `json:"Title"` UpdatedBy string `json:"UpdatedBy"` UpdatedTime time.Time `json:"UpdatedTime"` Urgency string `json:"Urgency"` OtherFields tcontainer.MarshalMap // Rest of the fields should go here. }
IM represents a Service Manager incident.
func (*IM) MarshalJSON ¶
MarshalJSON is a custom JSON marshal function for the IM struct. It handles custom fields and maps those from / to "OtherFields" key.
func (*IM) UnmarshalJSON ¶
UnmarshalJSON is a custom JSON marshal function for the IM struct. It handles custom fields and maps those from / to "OtherFields" key.
type IMService ¶
type IMService struct {
// contains filtered or unexported fields
}
IMService handles IMs for the API.
type SearchOptions ¶
type SearchOptions struct { // Sort: The sort field and order to be returned. {primaryField}:{ascending|descending}[,{secondaryField}] Sort string `url:"sort,omitempty"` // StartAt: The starting index of the returned projects. Base index: 0. StartAt int `url:"start,omitempty"` // Indicates the number of collection members to be included in the response. Min value: 1. Count int `url:"count,omitempty"` // Represents a collection. Values: summary, condense (default), expand. View string `url:"view,omitempty"` }
SearchOptions specifies the optional parameters to methods that support pagination.