toggl

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ISO8601 = "2006-01-02T15:04:05-07:00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL *url.URL
	// contains filtered or unexported fields
}

Client facilitates making HTTP requests to the Toggl API

func NewClient

func NewClient(apiKey string, timeout time.Duration) *Client

NewClient initializes a Client

type Project

type Project struct {
	Data struct {
		ID        int       `json:"id"`
		Wid       int       `json:"wid"`
		Cid       int       `json:"cid"`
		Name      string    `json:"name"`
		Billable  bool      `json:"billable"`
		IsPrivate bool      `json:"is_private"`
		Active    bool      `json:"active"`
		At        time.Time `json:"at"`
		Template  bool      `json:"template"`
		Color     string    `json:"color"`
	} `json:"data"`
}

Project is the object representing project in toggl world. It is bound with Get project data API Response of toggl. See: https://github.com/toggl/toggl_api_docs/blob/master/chapters/projects.md#get-project-data

type ProjectRepository

type ProjectRepository struct {
	*Client
}

func (*ProjectRepository) GetProject

func (r *ProjectRepository) GetProject(ctx context.Context, pid string) (*model.Project, error)

GetProject returns the object representing project in toggl_exporter. It retrive the project detail using passed pid and create peculiar toggl project object.

type TimeEntry

type TimeEntry struct {
	ID          int           `json:"id"`
	Wid         int           `json:"wid"`
	Pid         int           `json:"pid,omitempty"`
	Billable    bool          `json:"billable"`
	Start       time.Time     `json:"start"`
	Stop        time.Time     `json:"stop"`
	Duration    time.Duration `json:"duration"`
	Description string        `json:"description"`
	Tags        []string      `json:"tags"`
	At          time.Time     `json:"at"`
}

TimeEntry is the object representing the time entry in toggl world. It is bound with Get time_entries API Response of toggl. See: https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md#get-time-entry-details

type TimeEntryRepository

type TimeEntryRepository struct {
	*Client
}

func (*TimeEntryRepository) GetTimeEntries

func (r *TimeEntryRepository) GetTimeEntries(ctx context.Context) ([]model.TimeEntry, error)

GetProject returns array of objects representing time entries in toggl_exporter. It retrive time entries data bound with api key and create array of peculiar time entry object.

Jump to

Keyboard shortcuts

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