api

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

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"}

ErrorNotFound Not Found

Functions

This section is empty.

Types

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) 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{}) (*http.Response, error)

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

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) GetRecentTimeEntries

func (c *Client) GetRecentTimeEntries(p GetRecentTimeEntries) (dto.TimeEntriesList, error)

GetRecentTimeEntries will return the recent time entries of the user, paginated

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(id string) (*dto.User, error)

GetUser get a specific user by its id

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 GetProjectParam

type GetProjectParam struct {
	Workspace string
	ProjectID string
}

GetProjectParam params to get a Project

type GetProjectsParam

type GetProjectsParam struct {
	Workspace string
	Name      string
	Archived  bool

	PaginationParam
}

GetProjectsParam params to get all project of a workspace

type GetRecentTimeEntries

type GetRecentTimeEntries struct {
	Workspace    string
	UserID       string
	Page         int
	ItemsPerPage int
}

GetRecentTimeEntries params to get recent time entries

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 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
	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
	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

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