Documentation ¶
Index ¶
- Constants
- type Activities
- type Activity
- type Client
- func (c *Client) AddTimeEntry(entry TimeEntryPost) (*TimeEntry, error)
- func (c *Client) DeleteTimeEntry(id int) error
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GetActivities() (Activities, error)
- func (c *Client) GetIssue(id int64) (*Issue, error)
- func (c *Client) GetIssues(queryParams string) ([]Issue, error)
- func (c *Client) GetMyIssues() ([]Issue, error)
- func (c *Client) GetMyRelatedIssues() ([]Issue, error)
- func (c *Client) GetMyWatchedIssues() ([]Issue, error)
- func (c *Client) GetProject(id int64) (*Project, error)
- func (c *Client) GetProjects() ([]Project, error)
- func (c *Client) GetSearchResults(query string, offset, limit int) ([]SearchItem, int, error)
- func (c *Client) GetTimeEntries(queryParams string) ([]TimeEntry, error)
- func (c *Client) GetTimeEntry(id int) (*TimeEntry, error)
- func (c *Client) GetUser() (*User, error)
- func (c *Client) NewAuthRequest(ctx context.Context, username, password string) (*http.Request, error)
- func (c *Client) UpdateTimeEntry(id int, entry TimeEntryPost) error
- type DateTime
- type Issue
- type Project
- type SearchItem
- type TimeEntry
- type TimeEntryPost
- type User
- type UserAPIResponse
Constants ¶
const DateTimeFormat = "2006-01-02"
DateTimeFormat represents date format
const DayDateFormat = "Mon, 2006-01-02"
DayDateFormat represents day and date format
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is main HTTP client for communication with Redmine server.
func (*Client) AddTimeEntry ¶
func (c *Client) AddTimeEntry(entry TimeEntryPost) (*TimeEntry, error)
AddTimeEntry adds new time entry.
func (*Client) DeleteTimeEntry ¶
DeleteTimeEntry deletes time entry with requested ID.
func (*Client) GetActivities ¶
func (c *Client) GetActivities() (Activities, error)
GetActivities fetches all Activities that can be entered in time entry record. Project specific activities cannot be fetched with this method.
func (*Client) GetMyIssues ¶
GetMyIssues fetches issues assigned only to currently logged user.
func (*Client) GetMyRelatedIssues ¶ added in v0.3.0
GetMyRelatedIssues fetches issues assigned to currently logged user.
func (*Client) GetMyWatchedIssues ¶
GetMyWatchedIssues fetches issues that currently logged user watches.
func (*Client) GetProject ¶
GetProject fetches project with requested ID.
func (*Client) GetProjects ¶
GetProjects fetches all projects viewable by currently logged user.
func (*Client) GetSearchResults ¶
GetSearchResults returns search results for given query, offset and limit.
func (*Client) GetTimeEntries ¶
GetTimeEntries fetches time entries for requested queryParams
func (*Client) GetTimeEntry ¶ added in v0.2.0
GetTimeEntry fetches time entry for given ID.
func (*Client) NewAuthRequest ¶
func (c *Client) NewAuthRequest(ctx context.Context, username, password string) (*http.Request, error)
NewAuthRequest fetches user credentials for given username and password. Method uses simple basic authentication.
func (*Client) UpdateTimeEntry ¶ added in v0.2.0
func (c *Client) UpdateTimeEntry(id int, entry TimeEntryPost) error
UpdateTimeEntry updates time entry.
type DateTime ¶
DateTime custom representation of date.
func NewDateTime ¶
NewDateTime creates new DateTime for specific time.Time.
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON override
type Issue ¶
type Issue struct { ID int64 `json:"id"` Project entity `json:"project"` Subject string `json:"subject"` Description string `json:"description"` }
Issue correspond with issue in Redmine.
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"` }
Project represents Redmine project model.
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"` }
SearchItem represents Redmine search item model.
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"` }
TimeEntry represents Redmine time entry model.
func (TimeEntry) PrintTable ¶
func (te TimeEntry) PrintTable()
PrintTable prints table in suitable format.
type TimeEntryPost ¶
type TimeEntryPost struct { IssueID int `json:"issue_id,omitempty"` ProjectID int `json:"project_id,omitempty"` SpentOn DateTime `json:"spent_on,omitempty"` Hours float32 `json:"hours,omitempty"` ActivityID int `json:"activity_id,omitempty"` Comments string `json:"comments,omitempty"` }
TimeEntryPost represents data which should be placed to request body while creating a new 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"` }
User represents user model in Redmine.
type UserAPIResponse ¶ added in v0.2.0
type UserAPIResponse struct {
User User `json:"user"`
}
UserAPIResponse response when user is being fetched.