api

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorForbidden = dto.Error{Message: "Forbidden", Code: 403}

ErrorForbidden Forbidden

View Source
var ErrorMissingAPIKey = errors.New("api Key must be informed")

ErrorMissingAPIKey returned if X-Api-Key is missing

View Source
var ErrorNotFound = dto.Error{Message: "Nothing was found", Code: 404}

ErrorNotFound Not Found

Functions

This section is empty.

Types

type AddClientParam added in v0.31.0

type AddClientParam struct {
	Workspace string
	Name      string
}

type AddProjectParam added in v0.31.0

type AddProjectParam struct {
	Workspace string
	Name      string
	ClientId  string
	Color     string
	Note      string
	Billable  bool
	Public    bool
}

type AddTaskParam added in v0.31.0

type AddTaskParam struct {
	Workspace string
	ProjectID string
	Name      string
}

AddTaskParam param to add tasks to a project

type ChangeInvoicedParam added in v0.24.0

type ChangeInvoicedParam struct {
	Workspace    string
	TimeEntryIDs []string
	Invoiced     bool
}

type Client

type Client struct {
	http.Client
	// contains filtered or unexported fields
}

Client will help to access Clockify API

func NewClient

func NewClient(apiKey string) (*Client, error)

NewClient create a new Client, based on: https://clockify.github.io/clockify_api_docs/

func (*Client) AddClient added in v0.31.0

func (c *Client) AddClient(p AddClientParam) (dto.Client, error)

AddClient adds a new client to a workspace

func (*Client) AddProject added in v0.31.0

func (c *Client) AddProject(p AddProjectParam) (dto.Project, error)

AddProject adds a new project to a workspace

func (*Client) AddTask added in v0.31.0

func (c *Client) AddTask(p AddTaskParam) (dto.Task, error)

func (*Client) ChangeInvoiced added in v0.24.0

func (c *Client) ChangeInvoiced(p ChangeInvoicedParam) error

ChangeInvoiced changes time entries to invoiced or not

func (*Client) CreateTimeEntry

func (c *Client) CreateTimeEntry(p CreateTimeEntryParam) (dto.TimeEntryImpl, error)

CreateTimeEntry create a new time entry

func (*Client) DeleteTimeEntry added in v0.11.0

func (c *Client) DeleteTimeEntry(p DeleteTimeEntryParam) error

DeleteTimeEntry deletes a time entry

func (*Client) Do

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

Do executes a http.Request inside the Clockify's Client

func (*Client) GetClients added in v0.31.0

func (c *Client) GetClients(p GetClientsParam) ([]dto.Client, error)

GetClients gets all clients of a workspace

func (*Client) GetHydratedTimeEntry added in v0.22.0

func (c *Client) GetHydratedTimeEntry(p GetTimeEntryParam) (timeEntry *dto.TimeEntry, err error)

func (*Client) GetHydratedTimeEntryInProgress added in v0.22.0

func (c *Client) GetHydratedTimeEntryInProgress(p GetTimeEntryInProgressParam) (timeEntry *dto.TimeEntry, err error)

GetHydratedTimeEntryInProgress show hydrated time entry in progress (if any)

func (*Client) GetMe added in v0.5.0

func (c *Client) GetMe() (dto.User, error)

GetMe get details about the user who created the token

func (*Client) GetProject

func (c *Client) GetProject(p GetProjectParam) (*dto.Project, error)

GetProject get a single Project, if exists

func (*Client) GetProjects

func (c *Client) GetProjects(p GetProjectsParam) ([]dto.Project, error)

GetProjects get all project of a workspace

func (*Client) GetTag

func (c *Client) GetTag(p GetTagParam) (*dto.Tag, error)

GetTag get a single tag, if it exists

func (*Client) GetTags

func (c *Client) GetTags(p GetTagsParam) ([]dto.Tag, error)

GetTags get all tags of a workspace

func (*Client) GetTasks added in v0.23.0

func (c *Client) GetTasks(p GetTasksParam) ([]dto.Task, error)

GetTasks get tasks of a project

func (*Client) GetTimeEntry added in v0.1.7

func (c *Client) GetTimeEntry(p GetTimeEntryParam) (timeEntry *dto.TimeEntryImpl, err error)

GetTimeEntry will retrieve a Time Entry using its Workspace and ID

func (*Client) GetTimeEntryInProgress added in v0.22.0

func (c *Client) GetTimeEntryInProgress(p GetTimeEntryInProgressParam) (timeEntryImpl *dto.TimeEntryImpl, err error)

GetTimeEntryInProgress show time entry in progress (if any)

func (*Client) GetUser

func (c *Client) GetUser(p GetUser) (dto.User, error)

GetUser filters the wanted user from the workspace users

func (*Client) GetUserTimeEntries added in v0.24.0

func (c *Client) GetUserTimeEntries(p GetUserTimeEntriesParam) ([]dto.TimeEntryImpl, error)

GetUserTimeEntries will list the time entries of a user on a workspace, can be paginated

func (*Client) GetUsersHydratedTimeEntries added in v0.24.0

func (c *Client) GetUsersHydratedTimeEntries(p GetUserTimeEntriesParam) ([]dto.TimeEntry, error)

GetUsersHydratedTimeEntries will list hydrated time entries of a user on a workspace, can be paginated

func (*Client) GetWorkspace added in v0.18.0

func (c *Client) GetWorkspace(p GetWorkspace) (dto.Workspace, error)

func (*Client) GetWorkspaces added in v0.15.0

func (c *Client) GetWorkspaces(f GetWorkspaces) ([]dto.Workspace, error)

Workspaces list all the user's workspaces

func (*Client) Log

func (c *Client) Log(p LogParam) ([]dto.TimeEntry, error)

Log list time entries from a date

func (*Client) LogRange added in v0.1.2

func (c *Client) LogRange(p LogRangeParam) ([]dto.TimeEntry, error)

LogRange list time entries by date range

func (*Client) NewRequest

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

NewRequest to be used in Client

func (*Client) Out

func (c *Client) Out(p OutParam) error

Out create a new time entry

func (*Client) SetDebugLogger

func (c *Client) SetDebugLogger(logger Logger) *Client

SetDebugLogger debug logger

func (*Client) UpdateTimeEntry

func (c *Client) UpdateTimeEntry(p UpdateTimeEntryParam) (dto.TimeEntryImpl, error)

UpdateTimeEntry update a time entry

func (*Client) WorkspaceUsers

func (c *Client) WorkspaceUsers(p WorkspaceUsersParam) ([]dto.User, error)

WorkspaceUsers all users in a Workspace

type CreateTimeEntryParam

type CreateTimeEntryParam struct {
	Workspace   string
	Start       time.Time
	End         *time.Time
	Billable    bool
	Description string
	ProjectID   string
	TaskID      string
	TagIDs      []string
}

CreateTimeEntryParam params to create a new time entry

type DeleteTimeEntryParam added in v0.11.0

type DeleteTimeEntryParam struct {
	Workspace   string
	TimeEntryID string
}

DeleteTimeEntryParam params to update a new time entry

type GetClientsParam added in v0.31.0

type GetClientsParam struct {
	Workspace string
	Name      string
	Archived  *bool

	PaginationParam
}

GetClientsParam params to get all clients of a workspace

type GetProjectParam

type GetProjectParam struct {
	Workspace string
	ProjectID string
}

GetProjectParam params to get a Project

type GetProjectsParam

type GetProjectsParam struct {
	Workspace string
	Name      string
	Clients   []string
	Archived  *bool

	PaginationParam
}

GetProjectsParam params to get all project of a workspace

type GetTagParam

type GetTagParam struct {
	Workspace string
	TagID     string
}

GetTagParam params to find a tag

type GetTagsParam

type GetTagsParam struct {
	Workspace string
	Name      string
	Archived  bool

	PaginationParam
}

GetTagsParam params to get all tags of a workspace

type GetTasksParam added in v0.23.0

type GetTasksParam struct {
	Workspace string
	ProjectID string
	Active    bool
	Name      string

	PaginationParam
}

GetTasksParam param to find tasks of a project

type GetTimeEntryInProgressParam added in v0.22.0

type GetTimeEntryInProgressParam struct {
	Workspace string
	UserID    string
}

GetTimeEntryInProgressParam params to query entries

type GetTimeEntryParam added in v0.1.7

type GetTimeEntryParam struct {
	Workspace              string
	TimeEntryID            string
	ConsiderDurationFormat bool
}

GetTimeEntryParam params to get a Time Entry

type GetUser added in v0.24.0

type GetUser struct {
	Workspace string
	UserID    string
}

GetUser params to get a user

type GetUserTimeEntriesParam added in v0.24.0

type GetUserTimeEntriesParam struct {
	Workspace      string
	UserID         string
	OnlyInProgress *bool
	Start          *time.Time
	End            *time.Time
	Description    string

	PaginationParam
}

type GetWorkspace added in v0.18.0

type GetWorkspace struct {
	ID string
}

type GetWorkspaces added in v0.15.0

type GetWorkspaces struct {
	Name string
}

GetWorkspaces will be used to filter the workspaces

type LogParam

type LogParam struct {
	Workspace string
	UserID    string
	Date      time.Time
	PaginationParam
}

LogParam params to query entries

type LogRangeParam added in v0.1.2

type LogRangeParam struct {
	Workspace   string
	UserID      string
	FirstDate   time.Time
	LastDate    time.Time
	Description string
	PaginationParam
}

LogRangeParam params to query entries

type Logger

type Logger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

Logger for the Client

type OutParam

type OutParam struct {
	Workspace string
	UserID    string
	End       time.Time
}

OutParam params to end the current time entry

type PaginationParam added in v0.1.7

type PaginationParam struct {
	AllPages bool
	Page     int
	PageSize int
}

PaginationParam parameters about pagination

func AllPages added in v0.30.0

func AllPages() PaginationParam

AllPages sets the query to retrieve all pages

type QueryAppender added in v0.1.5

type QueryAppender interface {
	AppendToQuery(url.URL) url.URL
}

QueryAppender an interface to identify if the parameters should be sent through the query or body

type UpdateTimeEntryParam

type UpdateTimeEntryParam struct {
	Workspace   string
	TimeEntryID string
	Start       time.Time
	End         *time.Time
	Billable    bool
	Description string
	ProjectID   string
	TaskID      string
	TagIDs      []string
}

UpdateTimeEntryParam params to update a new time entry

type WorkspaceUsersParam

type WorkspaceUsersParam struct {
	Workspace string
	Email     string
}

WorkspaceUsersParam params to query workspace users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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