client

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DateTimeFormat = "2006-01-02"
View Source
const DayDateFormat = "Mon, 2006-02-01"

Variables

This section is empty.

Functions

This section is empty.

Types

type Activities

type Activities []Activity

func (Activities) Names

func (acts Activities) Names() []string

func (Activities) Valid

func (acts Activities) Valid(name string) (int64, bool)

type ActivitiesResponse

type ActivitiesResponse struct {
	Activities Activities `json:"time_entry_activities"`
}

type Activity

type Activity struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type Client

type Client struct {
	HttpClient *http.Client
	UserAgent  string
}

func (*Client) AddTimeEntry

func (c *Client) AddTimeEntry(entry TimeEntryPost) (*TimeEntry, error)

func (*Client) DeleteTimeEntry

func (c *Client) DeleteTimeEntry(id int) error

func (*Client) Do

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

func (*Client) GetActivities

func (c *Client) GetActivities() (Activities, error)

func (*Client) GetIssue

func (c *Client) GetIssue(id int64) (*Issue, error)

func (*Client) GetIssues

func (c *Client) GetIssues(queryParams string) ([]Issue, error)

func (*Client) GetMyIssues

func (c *Client) GetMyIssues() ([]Issue, error)

func (*Client) GetMyWatchedIssues

func (c *Client) GetMyWatchedIssues() ([]Issue, error)

func (*Client) GetProject

func (c *Client) GetProject(id int64) (*Project, error)

func (*Client) GetProjects

func (c *Client) GetProjects() ([]Project, error)

func (*Client) GetSearchResults

func (c *Client) GetSearchResults(query string, offset, limit int) ([]SearchItem, int, error)

func (*Client) GetTimeEntries

func (c *Client) GetTimeEntries(queryParams string) ([]TimeEntry, error)

func (*Client) GetUser

func (c *Client) GetUser() (*User, error)

func (*Client) NewAuthRequest

func (c *Client) NewAuthRequest(ctx context.Context, username, password string) (*http.Request, error)

type DateTime

type DateTime struct {
	time.Time
}

func NewDateTime

func NewDateTime(time time.Time) *DateTime

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(data []byte) error

type Entity

type Entity struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type EntityId

type EntityId struct {
	Id int64 `json:"id"`
}

func (EntityId) String

func (e EntityId) String() string

type Error422Response added in v0.1.1

type Error422Response struct {
	Errors []string `json:"errors"`
}

type Issue

type Issue struct {
	Id          int64  `json:"id"`
	Project     Entity `json:"project"`
	Subject     string `json:"subject"`
	Description string `json:"description"`
}

func (*Issue) URL added in v0.1.1

func (i *Issue) URL() string

type IssueResponse

type IssueResponse struct {
	Issue Issue `json:"issue"`
}

type IssuesResponse

type IssuesResponse struct {
	Issues []Issue `json:"issues"`
}

type Parent

type Parent struct{}

type Project

type Project struct {
	Id          int64     `json:"id"`
	Name        string    `json:"name"`
	Identifier  string    `json:"identifier"`
	Description string    `json:"description"`
	Status      int       `json:"status"`
	CreatedOn   time.Time `json:"created_on"`
	Parent      *Entity   `json:"parent"`
}

func (*Project) URL added in v0.1.1

func (p *Project) URL() string

type ProjectResponse

type ProjectResponse struct {
	Project Project `json:"project"`
}

type ProjectsResponse

type ProjectsResponse struct {
	Projects []Project `json:"projects"`
}

type SearchItem

type SearchItem struct {
	Id          int    `json:"id"`
	Title       string `json:"title"`
	Type        string `json:"type"`
	Url         string `json:"url"`
	Description string `json:"description"`
	DateTime    string `json:"datetime"`
}

type SearchResponse

type SearchResponse struct {
	SearchItems []SearchItem `json:"results"`
	TotalCount  int          `json:"total_count"`
}

type TimeEntriesResponse

type TimeEntriesResponse struct {
	TimeEntries []TimeEntry `json:"time_entries"`
}

type TimeEntry

type TimeEntry struct {
	Id        int64     `json:"id"`
	Project   Entity    `json:"project"`
	Issue     EntityId  `json:"issue"`
	User      Entity    `json:"user"`
	Activity  Entity    `json:"activity"`
	Hours     float64   `json:"hours"`
	Comments  string    `json:"comments"`
	SpentOn   DateTime  `json:"spent_on"`
	CreatedOn time.Time `json:"created_on"`
	UpdatedOn time.Time `json:"updated_on"`
}

func (TimeEntry) PrintTable

func (te TimeEntry) PrintTable()

type TimeEntryBody

type TimeEntryBody struct {
	TimeEntry TimeEntryPost `json:"time_entry"`
}

type TimeEntryPost

type TimeEntryPost struct {
	IssueId    int      `json:"issue_id,omitempty"`
	ProjectId  int      `json:"project_id,omitempty"`
	SpentOn    DateTime `json:"spent_on"`
	Hours      float32  `json:"hours"`
	ActivityId int      `json:"activity_id"`
	Comments   string   `json:"comments"`
}

type TimeEntryResponse

type TimeEntryResponse struct {
	TimeEntry TimeEntry `json:"time_entry"`
}

type User

type User struct {
	Id        int64  `json:"id"`
	Username  string `json:"login"`
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
	Email     string `json:"mail"`
	ApiKey    string `json:"api_key"`
}

type UserApiResponse

type UserApiResponse struct {
	User User `json:"user"`
}

Jump to

Keyboard shortcuts

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