Documentation
¶
Overview ¶
Package clockify provides an API for interacting with the Clockify time tracking service.
See https://clockify.me/developers-api for more information on Clockify's REST API.
Index ¶
- Constants
- Variables
- func DisableLog()
- func EnableLog()
- type Account
- type AccountSettings
- type Client
- type Project
- type Session
- func (session *Session) ContinueTimeEntry(timer TimeEntry, duronly bool) (TimeEntry, error)
- func (session *Session) DeleteTimeEntry(workspaceID, timeEntryID string) ([]byte, error)
- func (session *Session) GetAccount() (Account, error)
- func (session *Session) GetProjects(workspaceID string) (projects []Project, err error)
- func (session *Session) GetTimeEntry(workspaceID, timeEntryID string) (TimeEntry, error)
- func (session *Session) StartTimeEntry(workspaceID string, timeEntryRequest TimeEntryRequest) (TimeEntry, error)
- func (session *Session) StopTimeEntry(workspaceID, userID string) (TimeEntry, error)
- type Tag
- type Task
- type TimeEntry
- type TimeEntryRequest
- type TimeInterval
- type Workspace
Constants ¶
const ( ClockifyAPI = "https://api.clockify.me/api/v1" DefaultAppName = "go-clockify" )
Clockify service constants
Variables ¶
var ( // AppName is the application name used when creating timers. AppName = DefaultAppName )
Functions ¶
Types ¶
type Account ¶
type Account struct { // APIToken string `json:"api_token"` ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` Workspaces []Workspace `json:"workspaces"` Clients []Client `json:"clients"` Projects []Project `json:"projects"` Tasks []Task `json:"tasks"` Tags []Tag `json:"tags"` TimeEntries []TimeEntry `json:"time_entries"` Settings AccountSettings `json:"settings"` }
Account represents a user account.
type AccountSettings ¶
type AccountSettings struct { WeekStart string `json:"weekStart"` TimeZone string `json:"timeZone"` TimeFormat string `json:"timeFormat"` DateFormat string `json:"dateFormat"` }
AccountSettings represents a user account settings.
type Project ¶
type Project struct { Wid string `json:"workspaceId"` ID string `json:"id"` // Cid int `json:"cid"` Name string `json:"name"` Active bool `json:"archived"` Billable bool `json:"billable"` }
Project represents a project.
type Session ¶
type Session struct {
APIToken string
}
Session represents an active connection to the Clockify REST API.
func OpenSession ¶
OpenSession opens a session using an existing API token.
func (*Session) ContinueTimeEntry ¶
ContinueTimeEntry continues a time entry by creating a new entry with the same description. The new entry will have the same description and project ID as the existing one.
func (*Session) DeleteTimeEntry ¶
DeleteTimeEntry deletes a time entry.
func (*Session) GetAccount ¶
GetAccount returns a user's account information, including a list of active projects and timers.
func (*Session) GetProjects ¶
GetProjects allows to query for all projects in a workspace
func (*Session) GetTimeEntry ¶
GetTimeEntry returns the time entry
func (*Session) StartTimeEntry ¶
func (session *Session) StartTimeEntry(workspaceID string, timeEntryRequest TimeEntryRequest) (TimeEntry, error)
StartTimeEntry creates a new time entry.
type TimeEntry ¶
type TimeEntry struct { Wid string `json:"workspaceId,omitempty"` ID string `json:"id,omitempty"` Pid string `json:"pid"` Tid string `json:"taskId"` Description string `json:"description,omitempty"` TimeInterval TimeInterval `json:"timeInterval"` Tags []string `json:"tagIds"` Billable bool `json:"billable"` }
TimeEntry represents a single time entry.
type TimeEntryRequest ¶
type TimeEntryRequest struct { Start string `json:"start,omitempty"` Pid string `json:"projectId,omitempty"` Tid string `json:"taskId,omitempty"` Description string `json:"description,omitempty"` End string `json:"end,omitempty"` Tags []string `json:"tagIds,omitempty"` Billable bool `json:"billable,omitempty"` }
TimeEntryRequest represents a single time entry request.