auxilium

package
v0.0.0-...-7d6bd67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

Types

type Client

type Client struct {

	// Identifier used for requesting token and communicating with the API
	ApplicationIdentifier string

	// Login service
	Login *LoginService
	// TimeTrack service
	TimeTrack *TimeTrackService
	// contains filtered or unexported fields
}

Client for Auxilium's API

func NewClient

func NewClient(httpClient *http.Client, token string, baseURL string) *Client

NewClient return a new Auxlium API Client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide a valid private token.

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

BaseURL return a copy of the baseURL.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

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. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL path can be provided in urlStr, in which case it is resolved relative to the base URL of the Client. Relative URL paths should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(urlStr string) error

SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Message  string
}

An ErrorResponse reports one or more errors caused by an API request.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type LoginService

type LoginService struct {
	// contains filtered or unexported fields
}

LoginService provides a way to fetch an authentification token from Auxilium

func (*LoginService) Authenticate

func (l *LoginService) Authenticate(userName string, password string) (string, *http.Response, error)

Authenticate sends the userName and password and return a token

type TimeTrack

type TimeTrack struct {
	Id        int      `json:"id,omitempty"`
	ProjectId int      `json:"project_id,omitempty"`
	Started   string   `json:"started,omitempty"`
	Duration  int      `json:"duration,omitempty"`
	Notes     int      `json:"notes,omitempty"`
	Billable  bool     `json:"billable,omitempty"`
	Profile   string   `json:"profile,omitempty"`
	Direction bool     `json:"direction,omitempty"`
	Status    string   `json:"status,omitempty"`
	Tickets   []int    `json:"tickets,omitempty"`
	Clients   []int    `json:"clients,omitempty"`
	Tags      []string `json:"tags,omitempty"`
	CreatedAt string   `json:"created_at,omitempty"`
	UpdatedAt string   `json:"updated_at,omitempty"`
	UserId    int      `json:"user_id,omitempty"`
}

A TimeTrack represents a unit of work

type TimeTrackService

type TimeTrackService struct {
	// contains filtered or unexported fields
}

TimeTrackService provides a way to manipulate timetracks

func (*TimeTrackService) Create

func (t *TimeTrackService) Create(time *TimeTrack) (int, *http.Response, error)

Create a new running TimeTrack

func (*TimeTrackService) Show

func (t *TimeTrackService) Show(id int) (*TimeTrack, *http.Response, error)

Show an existing TimeTrack

func (*TimeTrackService) Update

func (t *TimeTrackService) Update(time *TimeTrack) (*http.Response, error)

Update an existing TimeTrack

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL