Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidID(id string) bool
- type AddClientParam
- type AddProjectParam
- type AddTaskParam
- type ChangeInvoicedParam
- type Client
- type CreateTimeEntryParam
- type DeleteProjectParam
- type DeleteTaskParam
- type DeleteTimeEntryParam
- type EntityNotFound
- type EstimateMethod
- type EstimateResetOption
- type EstimateType
- type GetClientsParam
- type GetProjectParam
- type GetProjectsParam
- type GetTagParam
- type GetTagsParam
- type GetTaskParam
- type GetTasksParam
- type GetTimeEntryInProgressParam
- type GetTimeEntryParam
- type GetUser
- type GetUserTimeEntriesParam
- type GetWorkspace
- type GetWorkspaces
- type InvalidIDError
- type InvalidOptionError
- type LogParam
- type LogRangeParam
- type Logger
- type OutParam
- type PaginationParam
- type QueryAppender
- type RequiredFieldError
- type TaskStatus
- type UpdateMembership
- type UpdateProjectEstimateParam
- type UpdateProjectMembershipsParam
- type UpdateProjectParam
- type UpdateProjectTemplateParam
- type UpdateProjectUserRateParam
- type UpdateTaskParam
- type UpdateTimeEntryParam
- type WorkspaceUsersParam
Constants ¶
const ( TaskStatusDefault = "" TaskStatusDone = "DONE" TaskStatusActive = "ACTIVE" )
const ( // EstimateMethodNone dont estimate the project EstimateMethodNone = EstimateMethod("none") // EstimateMethodTime estimate by time EstimateMethodTime = EstimateMethod("time") // EstimateMethodBudget estimate by budget EstimateMethodBudget = EstimateMethod("budget") )
const ( EstimateTypeProject = EstimateType("project") EstimateTypeTask = EstimateType("task") )
const ( EstimateResetOptionDefault = EstimateType("") EstimateResetOptionMonthly = EstimateResetOption("monthly") )
Variables ¶
var ErrorForbidden = dto.Error{Message: "Forbidden", Code: 403}
ErrorForbidden Forbidden
var ErrorMissingAPIKey = errors.New("api Key must be informed")
ErrorMissingAPIKey returned if X-Api-Key is missing
var ErrorMissingAPIURL = errors.New("api URL must be informed")
ErrorMissingAPIURL returned if base url is missing
var ErrorNotFound = dto.Error{Message: "Nothing was found", Code: 404}
ErrorNotFound Not Found
Functions ¶
Types ¶
type AddClientParam ¶ added in v0.31.0
type AddProjectParam ¶ added in v0.31.0
type AddTaskParam ¶ added in v0.31.0
type AddTaskParam struct { Workspace string ProjectID string Name string AssigneeIDs *[]string Estimate *time.Duration Status TaskStatus Billable *bool }
AddTaskParam param to add tasks to a project
type ChangeInvoicedParam ¶ added in v0.24.0
type Client ¶
type Client interface { // SetDebugLogger when set will output the responses of requests to the // logger SetDebugLogger(logger Logger) Client // SetInfoLogger when set will output which requests and params are used to // the logger SetInfoLogger(logger Logger) Client GetWorkspace(GetWorkspace) (dto.Workspace, error) GetWorkspaces(GetWorkspaces) ([]dto.Workspace, error) GetMe() (dto.User, error) GetUser(GetUser) (dto.User, error) WorkspaceUsers(WorkspaceUsersParam) ([]dto.User, error) AddClient(AddClientParam) (dto.Client, error) GetClients(GetClientsParam) ([]dto.Client, error) // GetProjects get all project of a workspace GetProjects(GetProjectsParam) ([]dto.Project, error) // GetProject get a single Project, if exists GetProject(GetProjectParam) (*dto.Project, error) // AddProject creates a new project AddProject(AddProjectParam) (dto.Project, error) // UpdateProject changes basic information about the project UpdateProject(UpdateProjectParam) (dto.Project, error) // UpdateProjectUserCostRate will update the hourly rate of a user on a // project UpdateProjectUserBillableRate(UpdateProjectUserRateParam) ( dto.Project, error) // UpdateProjectUserCostRate will update the cost of a user on a project UpdateProjectUserCostRate(UpdateProjectUserRateParam) ( dto.Project, error) // UpdateProjectEstimate change how the estime of a project is measured UpdateProjectEstimate(UpdateProjectEstimateParam) (dto.Project, error) // UpdateProjectMemberships changes who has access to add time entries to // the project UpdateProjectMemberships(UpdateProjectMembershipsParam) (dto.Project, error) // UpdateProjectTemplate changes if a project is a template or not UpdateProjectTemplate(UpdateProjectTemplateParam) (dto.Project, error) // DeleteProject removes a project forever DeleteProject(DeleteProjectParam) (dto.Project, error) AddTask(AddTaskParam) (dto.Task, error) DeleteTask(DeleteTaskParam) (dto.Task, error) GetTask(GetTaskParam) (dto.Task, error) GetTasks(GetTasksParam) ([]dto.Task, error) UpdateTask(UpdateTaskParam) (dto.Task, error) GetTag(GetTagParam) (*dto.Tag, error) GetTags(GetTagsParam) ([]dto.Tag, error) ChangeInvoiced(ChangeInvoicedParam) error CreateTimeEntry(CreateTimeEntryParam) (dto.TimeEntryImpl, error) DeleteTimeEntry(DeleteTimeEntryParam) error GetHydratedTimeEntry(GetTimeEntryParam) (*dto.TimeEntry, error) GetHydratedTimeEntryInProgress(GetTimeEntryInProgressParam) (*dto.TimeEntry, error) GetTimeEntry(GetTimeEntryParam) (*dto.TimeEntryImpl, error) GetTimeEntryInProgress(GetTimeEntryInProgressParam) (*dto.TimeEntryImpl, error) GetUserTimeEntries(GetUserTimeEntriesParam) ([]dto.TimeEntryImpl, error) GetUsersHydratedTimeEntries(GetUserTimeEntriesParam) ([]dto.TimeEntry, error) Log(LogParam) ([]dto.TimeEntry, error) LogRange(LogRangeParam) ([]dto.TimeEntry, error) UpdateTimeEntry(UpdateTimeEntryParam) (dto.TimeEntryImpl, error) Out(OutParam) error }
Client will help to access Clockify API
func NewClient ¶
NewClient create a new Client, based on: https://clockify.github.io/clockify_api_docs/
func NewClientFromUrlAndKey ¶ added in v0.40.0
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 DeleteProjectParam ¶ added in v0.42.0
DeleteProjectParam identifies which project to delete
type DeleteTaskParam ¶ added in v0.35.0
DeleteTaskParam param to update tasks to a project
type DeleteTimeEntryParam ¶ added in v0.11.0
DeleteTimeEntryParam params to update a new time entry
type EntityNotFound ¶ added in v0.36.0
func (EntityNotFound) Error ¶ added in v0.36.0
func (e EntityNotFound) Error() string
func (EntityNotFound) Unwrap ¶ added in v0.36.0
func (e EntityNotFound) Unwrap() error
type EstimateMethod ¶ added in v0.42.0
type EstimateMethod string
EstimateMethod are methods to estimate projects (none, budget and time)
type EstimateResetOption ¶ added in v0.42.0
type EstimateResetOption string
EstimateResetOption defines the period in which the estimates reset
type EstimateType ¶ added in v0.42.0
type EstimateType string
EstimateType sets if the estimate is for the role project or per task
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 ¶
GetProjectParam params to get a Project
type GetProjectsParam ¶
type GetProjectsParam struct { Workspace string Name string Clients []string Archived *bool Hydrate bool PaginationParam }
GetProjectsParam params to get all project of a workspace
type GetTagParam ¶
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 GetTaskParam ¶
GetTaskParam param to get a task on a project
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
GetTimeEntryInProgressParam params to query entries
type GetTimeEntryParam ¶ added in v0.1.7
GetTimeEntryParam params to get a Time Entry
type GetUserTimeEntriesParam ¶ added in v0.24.0
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 InvalidIDError ¶ added in v0.36.0
InvalidIDError indicates that a field should be a valid ID, but it is not
func (InvalidIDError) Error ¶ added in v0.36.0
func (e InvalidIDError) Error() string
type InvalidOptionError ¶ added in v0.42.0
InvalidOptionError indicates that the parameter has a limited set of valid values, and the one used is not one of them (see Options for the valid ones)
func (*InvalidOptionError) Error ¶ added in v0.42.0
func (i *InvalidOptionError) Error() string
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 ProjectID string TagIDs []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 PaginationParam ¶ added in v0.1.7
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
QueryAppender an interface to identify if the parameters should be sent through the query or body
type RequiredFieldError ¶ added in v0.36.0
type RequiredFieldError struct {
Field string
}
RequiredFieldError indicates that a field should be filled, but was not
func (RequiredFieldError) Error ¶ added in v0.36.0
func (e RequiredFieldError) Error() string
type TaskStatus ¶ added in v0.35.0
type TaskStatus string
type UpdateMembership ¶ added in v0.42.0
UpdateMembership represents the membership of a User or User Group to a project
type UpdateProjectEstimateParam ¶ added in v0.42.0
type UpdateProjectEstimateParam struct { Workspace string ProjectID string Method EstimateMethod Type EstimateType ResetOption EstimateResetOption Estimate int64 }
UpdateProjectEstimateParam holds parameters to change project estimate
type UpdateProjectMembershipsParam ¶ added in v0.42.0
type UpdateProjectMembershipsParam struct { Workspace string ProjectID string Memberships []UpdateMembership }
UpdateProjectMembershipsParam will change which users and groups have access to the project
type UpdateProjectParam ¶ added in v0.40.0
type UpdateProjectParam struct { Workspace string ProjectID string Name string ClientId *string Color string Note *string Billable *bool Public *bool Archived *bool }
UpdateProjectParam sets the properties to change on a project Workspace and ID are required
type UpdateProjectTemplateParam ¶ added in v0.42.0
UpdateProjectTemplateParam sets which project will be updated,and if it will became a template or not
type UpdateProjectUserRateParam ¶ added in v0.42.0
type UpdateProjectUserRateParam struct { Workspace string ProjectID string UserID string Amount uint Since *time.Time }
UpdateProjectUserRateParam sets the parameters to update the billable/cost rate, if Since is not nil, then all time entries after that time will be updated to new rate
type UpdateTaskParam ¶ added in v0.35.0
type UpdateTaskParam struct { Workspace string ProjectID string TaskID string Name string AssigneeIDs *[]string Estimate *time.Duration Status TaskStatus Billable *bool }
UpdateTaskParam param to update tasks to a project
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 PaginationParam }
WorkspaceUsersParam params to query workspace users