api

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 14 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) ConvertIntoFullTimeEntry

func (c *Client) ConvertIntoFullTimeEntry(tei dto.TimeEntryImpl) (dto.TimeEntry, error)

ConvertIntoFullTimeEntry converts a dto.TimeEntryImpl into a dto.TimeEntry

func (*Client) CreateTimeEntry

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

CreateTimeEntry create a new 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) 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) GetTask

func (c *Client) GetTask(p GetTaskParam) (*dto.Task, error)

GetTask get a single Task, if exists

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

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

GetUser get a specific user by its id

func (*Client) Log

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

Log list time entries from a date

func (*Client) LogInProgress

func (c *Client) LogInProgress(p LogInProgressParam) (*dto.TimeEntryImpl, error)

LogInProgress show time entry in progress (if any)

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

func (*Client) Workspaces

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

Workspaces list all the user's workspaces

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

GetTagsParam params to get all tags of a workspace

type GetTaskParam

type GetTaskParam struct {
	Workspace string
	TaskID    string
}

GetTaskParam params to get a Task

type GetTimeEntryParam added in v0.1.7

type GetTimeEntryParam struct {
	Workspace   string
	TimeEntryID string
}

GetTimeEntryParam params to get a Time Entry

type LogInProgressParam

type LogInProgressParam struct {
	Workspace string
}

LogInProgressParam params to query entries

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

type WorkspacesFilter

type WorkspacesFilter struct {
	Name string
}

WorkspacesFilter will be used to filter the workspaces

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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