Documentation
¶
Index ¶
- type Client
- type ClientRepository
- func (repository *ClientRepository) CreateClient(workspaceID int, name string) (Client, error)
- func (repository *ClientRepository) GetClientByID(clientID int) (Client, error)
- func (repository *ClientRepository) GetClientByName(workspaceName, clientName string) (Client, error)
- func (repository *ClientRepository) GetClients() ([]Client, error)
- type Clienter
- type Project
- type ProjectRepository
- func (repository *ProjectRepository) CreateProject(projectName, workspaceName, clientName string) (Project, error)
- func (repository *ProjectRepository) GetProjectByID(projectID int) (Project, error)
- func (repository *ProjectRepository) GetProjectByName(projectName, workspaceName, clientName string) (Project, error)
- func (repository *ProjectRepository) GetProjects() ([]Project, error)
- type Projecter
- type TimeRecord
- type TimeRecordRepository
- type TimeRecorder
- type Workspace
- type WorkspaceRepository
- func (repository *WorkspaceRepository) CreateWorkspace(name string) (Workspace, error)
- func (repository *WorkspaceRepository) GetWorkspaceByID(workspaceID int) (Workspace, error)
- func (repository *WorkspaceRepository) GetWorkspaceByName(workspaceName string) (Workspace, error)
- func (repository *WorkspaceRepository) GetWorkspaces() ([]Workspace, error)
- type Workspacer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientRepository ¶
type ClientRepository struct {
// contains filtered or unexported fields
}
ClientRepository provides read/write access to Toggl clients.
func (*ClientRepository) CreateClient ¶
func (repository *ClientRepository) CreateClient(workspaceID int, name string) (Client, error)
CreateClient creates a new client with the given name. Returns an error of the creation failed.
func (*ClientRepository) GetClientByID ¶
func (repository *ClientRepository) GetClientByID(clientID int) (Client, error)
GetClientByID returns the client for the given client id. Returns an error if the client was not found.
func (*ClientRepository) GetClientByName ¶
func (repository *ClientRepository) GetClientByName(workspaceName, clientName string) (Client, error)
GetClientByName returns the client for the given client name. Returns an error if no matching client was found.
func (*ClientRepository) GetClients ¶
func (repository *ClientRepository) GetClients() ([]Client, error)
GetClients returns all clients.
type Clienter ¶
type Clienter interface {
// CreateClient creates a new client with the given name.
// Returns an error of the creation failed.
CreateClient(workspaceID int, name string) (Client, error)
// GetClients returns all clients.
GetClients() ([]Client, error)
// GetClientByID returns the client for the given client id.
// Returns an error if the client was not found.
GetClientByID(clientID int) (Client, error)
// GetClientByName returns the client for the given client name.
// Returns an error if no matching client was found.
GetClientByName(workspaceName, clientName string) (Client, error)
}
A Clienter interface provides read/write access to Toggl clients.
func NewClientRepository ¶
func NewClientRepository(clientAPI model.ClientAPI, workspaceProvider Workspacer) Clienter
NewClientRepository creates a new client repository instance.
type ProjectRepository ¶
type ProjectRepository struct {
// contains filtered or unexported fields
}
ProjectRepository provides read/write access to Toggl projects.
func (*ProjectRepository) CreateProject ¶
func (repository *ProjectRepository) CreateProject(projectName, workspaceName, clientName string) (Project, error)
CreateProject creates a new project with the given name. Returns an error of the creation failed.
func (*ProjectRepository) GetProjectByID ¶
func (repository *ProjectRepository) GetProjectByID(projectID int) (Project, error)
GetProjectByID returns the project for the given project id. Returns an error if the project was not found.
func (*ProjectRepository) GetProjectByName ¶
func (repository *ProjectRepository) GetProjectByName(projectName, workspaceName, clientName string) (Project, error)
GetProjectByName returns the project for the given project name. Returns an error if no matching project was found.
func (*ProjectRepository) GetProjects ¶
func (repository *ProjectRepository) GetProjects() ([]Project, error)
GetProjects returns all projects.
type Projecter ¶
type Projecter interface {
// CreateProject creates a new project with the given name.
// Returns an error of the creation failed.
CreateProject(projectName, workspaceName, clientName string) (Project, error)
// GetProjects returns all projects.
GetProjects() ([]Project, error)
// GetProjectByID returns the project for the given project id.
// Returns an error if the project was not found.
GetProjectByID(projectID int) (Project, error)
// GetProjectByName returns the project for the given project name.
// Returns an error if no matching project was found.
GetProjectByName(projectName, workspaceName, clientName string) (Project, error)
}
A Projecter interface provides read/write access to Toggl projects.
func NewProjectRepository ¶
func NewProjectRepository(projectAPI model.ProjectAPI, workspaceProvider Workspacer, clientProvider Clienter) Projecter
NewProjectRepository creates a new project repository instance.
type TimeRecord ¶
type TimeRecord struct {
WorkspaceName string
ProjectName string
ClientName string
Start time.Time
Stop time.Time
Description string
Tags []string
}
TimeRecord represents a single time tracking record
type TimeRecordRepository ¶
type TimeRecordRepository struct {
// contains filtered or unexported fields
}
TimeRecordRepository provides read/write access to the Toggl time records.
func (*TimeRecordRepository) CreateTimeRecord ¶
func (repository *TimeRecordRepository) CreateTimeRecord(timeRecord TimeRecord) error
CreateTimeRecord creates a new time record. Returns an error if the creation failed.
func (*TimeRecordRepository) GetTimeRecords ¶
func (repository *TimeRecordRepository) GetTimeRecords(start, stop time.Time) ([]TimeRecord, error)
GetTimeRecords returns all time records from the given start date until the given stop date. Returns an error of the time records could not be retrieved.
type TimeRecorder ¶
type TimeRecorder interface {
// CreateTimeRecord creates a new time record.
// Returns an error if the creation failed.
CreateTimeRecord(timeRecord TimeRecord) error
// GetTimeRecords returns all time records from the given start date until the given stop date.
// Returns an error of the time records could not be retrieved.
GetTimeRecords(start, stop time.Time) ([]TimeRecord, error)
}
A TimeRecorder interface provides functions for reading and writing time records.
func NewTimeRecordRepository ¶
func NewTimeRecordRepository( timeEntryAPI model.TimeEntryAPI, workspaceRepository Workspacer, projectRepository Projecter, clientRepository Clienter) TimeRecorder
NewTimeRecordRepository creates a new time record repository instance.
type WorkspaceRepository ¶
type WorkspaceRepository struct {
// contains filtered or unexported fields
}
WorkspaceRepository provides read access to the Toggl workspaces. Write is unfortunately not supported by the Toggl API.
func (*WorkspaceRepository) CreateWorkspace ¶
func (repository *WorkspaceRepository) CreateWorkspace(name string) (Workspace, error)
CreateWorkspace creates a new Toggl workspace.
func (*WorkspaceRepository) GetWorkspaceByID ¶
func (repository *WorkspaceRepository) GetWorkspaceByID(workspaceID int) (Workspace, error)
GetWorkspaceByID returns the workspace for the given workspace id. Returns an error if the workspace was not found.
func (*WorkspaceRepository) GetWorkspaceByName ¶
func (repository *WorkspaceRepository) GetWorkspaceByName(workspaceName string) (Workspace, error)
GetWorkspaceByName returns the workspace for the given workspace name. Returns an error if no matching workspace was found.
func (*WorkspaceRepository) GetWorkspaces ¶
func (repository *WorkspaceRepository) GetWorkspaces() ([]Workspace, error)
GetWorkspaces returns all available workspaces.
type Workspacer ¶
type Workspacer interface {
// CreateWorkspace creates a new Toggl workspace.
CreateWorkspace(name string) (Workspace, error)
// GetWorkspaces returns all available workspaces.
GetWorkspaces() ([]Workspace, error)
// GetWorkspaceByID returns the workspace for the given workspace id.
// Returns an error if the workspace was not found.
GetWorkspaceByID(workspaceID int) (Workspace, error)
// GetWorkspaceByName returns the workspace for the given workspace name.
// Returns an error if no matching workspace was found.
GetWorkspaceByName(workspaceName string) (Workspace, error)
}
A Workspacer interface provides read/write access to Toggl workspaces.
func NewWorkspaceRepository ¶
func NewWorkspaceRepository(workspaceAPI model.WorkspaceAPI) Workspacer
NewWorkspaceRepository creates a new workspace provider instance.