toggl

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientGateway

type ClientGateway interface {
	GetClients(filter string) (TogglClients, error)
}

type ClientService

type ClientService struct {
	ClientGateway ClientGateway
}

func NewClientService

func NewClientService(clientGateway ClientGateway) ClientService

func (*ClientService) GetClients

func (c *ClientService) GetClients(filter string) (TogglClients, error)

type ClientsByName

type ClientsByName TogglClients

ByName implements sort.Interface based on the Name field of TogglClientElement.

func (ClientsByName) Len

func (a ClientsByName) Len() int

func (ClientsByName) Less

func (a ClientsByName) Less(i, j int) bool

func (ClientsByName) Swap

func (a ClientsByName) Swap(i, j int)

type DaySection

type DaySection struct {
	Date             time.Time
	IntervalSections []*IntervalSection
}

func NewDaySection

func NewDaySection() *DaySection

func (*DaySection) Duration

func (d *DaySection) Duration() float64

type GetProjectsOpts

type GetProjectsOpts struct {
	Name string
}

type IntervalSection

type IntervalSection struct {
	StartDateTime time.Time
	EndDateTime   time.Time
	Description   string
	Duration      float64
}

func (*IntervalSection) DurationS

func (i *IntervalSection) DurationS() string

type ProjectGateway

type ProjectGateway interface {
	GetProjects(filter *GetProjectsOpts) (TogglProjects, error)
	CreateProject(projectName string, clientID int64) error
}

type ProjectKey

type ProjectKey struct {
	Client    string
	Project   string
	ProjectID int64
}

type ProjectSection

type ProjectSection struct {
	TaskID      int
	IsTask      bool
	ClientID    string
	ProjectID   string
	Client      string
	Project     string
	DaySections []*DaySection
}

func NewProjectSection

func NewProjectSection() *ProjectSection

func (*ProjectSection) Duration

func (p *ProjectSection) Duration() float64

type ProjectService

type ProjectService struct {
	ProjectGateway ProjectGateway
}

func NewProjectService

func NewProjectService(projectGateway ProjectGateway) ProjectService

func (*ProjectService) CreateProject

func (p *ProjectService) CreateProject(projectName string, clientID int64) error

func (*ProjectService) GetProjects

func (p *ProjectService) GetProjects(filter *GetProjectsOpts) (TogglProjects, error)

func (*ProjectService) ParseProjectTitle

func (p *ProjectService) ParseProjectTitle(project string) (ProjectTitle, error)

func (*ProjectService) ValidProjectName

func (p *ProjectService) ValidProjectName(name string) bool

type ProjectTitle

type ProjectTitle struct {
	Client   string
	Project  string
	IsTask   bool
	TaskID   int
	TicketID string
}

type ProjectsByName

type ProjectsByName TogglProjects

ProjectsByName implements sort.Interface based on the Name field of TogglClientElement.

func (ProjectsByName) Len

func (a ProjectsByName) Len() int

func (ProjectsByName) Less

func (a ProjectsByName) Less(i, j int) bool

func (ProjectsByName) Swap

func (a ProjectsByName) Swap(i, j int)

type Report

type Report struct {
	StartDate       time.Time
	EndDate         time.Time
	ProjectSections []*ProjectSection
}

func NewReport

func NewReport(sd, ed time.Time) (*Report, error)

func (*Report) Duration

func (r *Report) Duration() float64

type ReportRange

type ReportRange int
const (
	Today ReportRange = iota
	Yesterday
	LastWeek
	ThisWeek
	Custom
	EYesterday
)

type ReportService

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

func NewReportService

func NewReportService(timeService TimeService, projectService ProjectService) ReportService

func (*ReportService) GetReport

func (r *ReportService) GetReport(sd, ed time.Time) (*Report, error)

type TimeEntryGateway

type TimeEntryGateway interface {
	GetTimeEntries(start, end time.Time) (TogglTimeEntries, error)
}

type TimeService

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

func NewTimeService

func NewTimeService(timeEntryGateway TimeEntryGateway, clientService ClientService, projectService ProjectService) TimeService

func (*TimeService) GetTimeEntries

func (t *TimeService) GetTimeEntries(start, end time.Time) (TogglTimeEntries, error)

type TogglClientElement

type TogglClientElement struct {
	ID       int64  `json:"id"`
	Wid      int64  `json:"wid"`
	Archived bool   `json:"archived"`
	Name     string `json:"name"`
	At       string `json:"at"`
}

type TogglClients

type TogglClients []*TogglClientElement

type TogglProjectElement

type TogglProjectElement struct {
	ID                  int64       `json:"id"`
	WorkspaceID         int64       `json:"workspace_id"`
	ClientID            int64       `json:"client_id"`
	Name                string      `json:"name"`
	IsPrivate           bool        `json:"is_private"`
	Active              bool        `json:"active"`
	At                  string      `json:"at"`
	CreatedAt           string      `json:"created_at"`
	ServerDeletedAt     interface{} `json:"server_deleted_at"`
	Color               string      `json:"color"`
	Billable            interface{} `json:"billable"`
	Template            interface{} `json:"template"`
	AutoEstimates       interface{} `json:"auto_estimates"`
	EstimatedHours      interface{} `json:"estimated_hours"`
	Rate                interface{} `json:"rate"`
	RateLastUpdated     interface{} `json:"rate_last_updated"`
	Currency            interface{} `json:"currency"`
	Recurring           bool        `json:"recurring"`
	RecurringParameters interface{} `json:"recurring_parameters"`
	CurrentPeriod       interface{} `json:"current_period"`
	FixedFee            interface{} `json:"fixed_fee"`
	ActualHours         int64       `json:"actual_hours"`

	// Derived
	Client string
}

type TogglProjects

type TogglProjects []*TogglProjectElement

type TogglTimeEntries

type TogglTimeEntries []*TogglTimeEntry

type TogglTimeEntry

type TogglTimeEntry struct {
	ID              int64       `json:"id"`
	WorkspaceID     int64       `json:"workspace_id"`
	ProjectID       int64       `json:"project_id"`
	TaskID          int64       `json:"task_id"`
	Billable        bool        `json:"billable"`
	Start           time.Time   `json:"start"`
	Stop            time.Time   `json:"stop"`
	Duration        int64       `json:"duration"`
	Description     string      `json:"description"`
	ServerDeletedAt interface{} `json:"server_deleted_at"`

	// Fields populated by IncludeMissingV9Fields
	Client   string
	ClientID int64
	Project  string
}

Directories

Path Synopsis
Implements the ClientGateway by reading from a file
Implements the ClientGateway by reading from a file

Jump to

Keyboard shortcuts

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