model

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 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 ClientAPI added in v0.2.0

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

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

The ClientAPI interface provides functions for creating and fetching clients.

type Project

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

Project defines the key properties of a Toggl project

type ProjectAPI added in v0.2.0

type ProjectAPI 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 ProjectAPI 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 TimeEntryAPI added in v0.2.0

type TimeEntryAPI 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 TimeEntryAPI interface provides functions for fetching and creating time entries.

type TogglAPI

type TogglAPI interface {
	WorkspaceAPI
	ProjectAPI
	TimeEntryAPI
	ClientAPI
}

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 WorkspaceAPI added in v0.2.0

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

The WorkspaceAPI interface provides functions for fetching workspacs.

Jump to

Keyboard shortcuts

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