model

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Overview

Package model contains the models and interface for the Toggl API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID          int    `json:"id"`
	WorkspaceID int    `json:"wid"`
	Name        string `json:"name"`
	Notes       string `json:"notes"`
}

Client defines the key properties of a Toggl client

type ClientRepository

type ClientRepository interface {
	// CreateClient creates a new client.
	CreateClient(client Client) (Client, error)

	// GetClients returns all clients.
	GetClients() ([]Client, error)
}

The ClientRepository interface provides functions for creating and fetching clients.

type Project

type Project struct {
	ID          int    `json:"id"`
	WorkspaceID int    `json:"wid"`
	Name        string `json:"name"`
}

Project defines the key properties of a Toggl project

type ProjectRepository

type ProjectRepository interface {
	// CreateProject creates a new project.
	CreateProject(project Project) (Project, error)

	// GetProjects returns all projects for the given workspace.
	GetProjects(workspaceID int) ([]Project, error)
}

The ProjectRepository interface provides functions for creating and fetching projects.

type TimeEntry

type TimeEntry struct {

	// ID contains the id of the time entry
	ID int `json:"id"`

	// Wid contains the workspace ID
	Wid int `json:"wid"`

	// Pid contains the project id
	Pid int `json:"pid"`

	// Start contains the start time of the entry.
	Start time.Time `json:"start"`

	// Stop contains the end time of the entry.
	Stop time.Time `json:"stop"`

	// Billable contains a flag indicating whether this time entry is billable or not.
	Billable bool `json:"billable"`

	// The Description of the time entry
	Description string `json:"description"`

	// Tags contains a list of names for the time entry
	Tags []string `json:"tags"`

	CreatedWith string `json:"created_with"`
}

TimeEntry represents a single Toggle time tracking record

type TimeEntryRepository

type TimeEntryRepository interface {
	// CreateTimeEntry creates a new time entry.
	CreateTimeEntry(timeEntry TimeEntry) (TimeEntry, error)

	// GetTimeEntries returns all time entries created between the given start and end date.
	// Returns nil and an error if the time entries could not be retrieved.
	GetTimeEntries(start, end time.Time) ([]TimeEntry, error)
}

The TimeEntryRepository interface provides functions for fetching and creating time entries.

type TogglAPI

A TogglAPI interface implements some of the Toggl API methods.

type Workspace

type Workspace struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Workspace defines the key properties of a Toggl workspace

type WorkspaceRepository

type WorkspaceRepository interface {
	// GetWorkspaces returns all workspaces for the current user.
	GetWorkspaces() ([]Workspace, error)
}

The WorkspaceRepository interface provides functions for fetching workspacs.

Jump to

Keyboard shortcuts

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