toggl

package module
v0.0.0-...-f88d36f Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2017 License: MIT Imports: 13 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestCreateResponseHandler

func TestCreateResponseHandler(res TestJSONFileResponse, t *testing.T) http.HandlerFunc

TestCreateResponseHandler test handler

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client toggl client

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient creates toggl client

func TestNewClient

func TestNewClient(t *testing.T, host string) (*Client, context.Context)

TestNewClient creates test client

func (*Client) GetDashboardByWorkspaceID

func (c *Client) GetDashboardByWorkspaceID(ctx context.Context, wid int) (*Dashboard, error)

GetDashboardByWorkspaceID gets dashboard

func (*Client) GetDetailedReport

func (c *Client) GetDetailedReport(ctx context.Context, req *DetailedReportRequest) (*DetailedReport, error)

GetDetailedReport gets dashboard

func (*Client) GetProjectsByWorkspaceID

func (c *Client) GetProjectsByWorkspaceID(ctx context.Context, wid int) ([]Project, error)

GetProjectsByWorkspaceID get projects by workspace id

func (*Client) GetWorkspaceByID

func (c *Client) GetWorkspaceByID(ctx context.Context, wid int) (*Workspace, error)

GetWorkspaceByID gets workspaces

func (*Client) GetWorkspaces

func (c *Client) GetWorkspaces(ctx context.Context) ([]Workspace, error)

GetWorkspaces gets workspaces

type Config

type Config struct {
	HTTPClient *http.Client
	Host       string
	APIKey     string
	Debug      bool
	Logger     *log.Logger
}

Config toggl client config

func TestNewConfig

func TestNewConfig(host string) *Config

TestNewConfig creates test config

type Dashboard

type Dashboard struct {
	MostActiveUser []struct {
		UserID   int `json:"user_id"`
		Duration int `json:"duration"`
	} `json:"most_active_user"`
	Activity []struct {
		UserID      int         `json:"user_id"`
		ProjectID   int         `json:"project_id"`
		Duration    int         `json:"duration"`
		Description string      `json:"description"`
		Stop        interface{} `json:"stop"`
		Tid         interface{} `json:"tid"`
	} `json:"activity"`
}

Dashboard dashboard

type DetailedReport

type DetailedReport struct {
	TotalGrand      int `json:"total_grand"`
	TotalBillable   int `json:"total_billable"`
	TotalCount      int `json:"total_count"`
	PerPage         int `json:"per_page"`
	TotalCurrencies []struct {
		Currency string  `json:"currency"`
		Amount   float64 `json:"amount"`
	} `json:"total_currencies"`
	Data []struct {
		ID          int         `json:"id"`
		Pid         int         `json:"pid"`
		Tid         interface{} `json:"tid"`
		UID         int         `json:"uid"`
		Description string      `json:"description"`
		Start       string      `json:"start"`
		End         string      `json:"end"`
		Updated     string      `json:"updated"`
		Dur         int         `json:"dur"`
		User        string      `json:"user"`
		UseStop     bool        `json:"use_stop"`
		Client      string      `json:"client"`
		Project     string      `json:"project"`
		Task        interface{} `json:"task"`
		Billable    float64     `json:"billable"`
		IsBillable  bool        `json:"is_billable"`
		Cur         string      `json:"cur"`
		Tags        []string    `json:"tags"`
	} `json:"data"`
}

DetailedReport detailed report

type DetailedReportRequest

type DetailedReportRequest struct {
	WorkspaceID int
	Since       time.Time
	Until       time.Time
	UserAgent   string
}

DetailedReportRequest detailed report request

type Project

type Project struct {
	ID            int       `json:"id"`
	Wid           int       `json:"wid"`
	Name          string    `json:"name"`
	Billable      bool      `json:"billable"`
	IsPrivate     bool      `json:"is_private"`
	Active        bool      `json:"active"`
	Template      bool      `json:"template"`
	At            time.Time `json:"at"`
	CreatedAt     time.Time `json:"created_at"`
	Color         string    `json:"color"`
	AutoEstimates bool      `json:"auto_estimates"`
	HexColor      string    `json:"hex_color"`
	ActualHours   int       `json:"actual_hours,omitempty"`
}

Project project

type TestJSONFileResponse

type TestJSONFileResponse struct {
	StatusCode int
	JSONPath   string
}

TestJSONFileResponse test response

type Workspace

type Workspace struct {
	ID                          int       `json:"id"`
	Name                        string    `json:"name"`
	Profile                     int       `json:"profile"`
	Premium                     bool      `json:"premium"`
	Admin                       bool      `json:"admin"`
	DefaultHourlyRate           int       `json:"default_hourly_rate"`
	DefaultCurrency             string    `json:"default_currency"`
	OnlyAdminsMayCreateProjects bool      `json:"only_admins_may_create_projects"`
	OnlyAdminsSeeBillableRates  bool      `json:"only_admins_see_billable_rates"`
	OnlyAdminsSeeTeamDashboard  bool      `json:"only_admins_see_team_dashboard"`
	ProjectsBillableByDefault   bool      `json:"projects_billable_by_default"`
	Rounding                    int       `json:"rounding"`
	RoundingMinutes             int       `json:"rounding_minutes"`
	APIToken                    string    `json:"api_token"`
	At                          time.Time `json:"at"`
	IcalEnabled                 bool      `json:"ical_enabled"`
}

Workspace workspace

Jump to

Keyboard shortcuts

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