service

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileProjectStorage

type FileProjectStorage struct{}

func NewFileProjectStorage

func NewFileProjectStorage() *FileProjectStorage

func (FileProjectStorage) GetTrackedProjects

func (f FileProjectStorage) GetTrackedProjects() ([]TrackedProject, error)

func (FileProjectStorage) UpsertTrackedProject

func (f FileProjectStorage) UpsertTrackedProject(project TrackedProject) error

type FileUserSessionManager

type FileUserSessionManager struct{}

func NewFileUserSessionManager

func NewFileUserSessionManager() *FileUserSessionManager

func (*FileUserSessionManager) GetUserSession

func (f *FileUserSessionManager) GetUserSession() (*UserSessionData, error)

func (*FileUserSessionManager) SaveUserSession

func (f *FileUserSessionManager) SaveUserSession(session UserSessionData) error

type FoodEntry

type FoodEntry struct {
	Day time.Time
}

type FoodTrackingService

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

func NewFoodTrackingService

func NewFoodTrackingService(productiveClient *productive.Client) *FoodTrackingService

func (*FoodTrackingService) TrackFood

func (s *FoodTrackingService) TrackFood(request TrackFoodRequest) error

type ProductiveService

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

func NewProductiveService

func NewProductiveService(client *productive.Client) *ProductiveService

func (*ProductiveService) CreateFoodTimeEntry

func (s *ProductiveService) CreateFoodTimeEntry(entry FoodEntry, sessionData *UserSessionData) error

func (*ProductiveService) CreateProjectTimeEntry

func (s *ProductiveService) CreateProjectTimeEntry(entry ProjectEntry, sessionData *UserSessionData) error

func (*ProductiveService) FindDeals

func (s *ProductiveService) FindDeals(dealQuery string, day time.Time, sessionData *UserSessionData) ([]productive.Deal, error)

func (*ProductiveService) FindFoodService

func (s *ProductiveService) FindFoodService(day time.Time, sessionData *UserSessionData) (*productive.Service, error)

func (*ProductiveService) FindSavedProject

func (s *ProductiveService) FindSavedProject(project *TrackedProject, day time.Time, sessionData *UserSessionData) *TrackedProject

func (*ProductiveService) FindServices

func (s *ProductiveService) FindServices(serviceQuery string, deal *productive.Deal, day time.Time, sessionData *UserSessionData) ([]productive.Service, error)

func (*ProductiveService) GetOrganizationMemberships added in v0.0.3

func (s *ProductiveService) GetOrganizationMemberships(sessionData *UserSessionData) ([]productive.OrganizationMembership, error)

func (*ProductiveService) Login added in v0.0.3

func (s *ProductiveService) Login(username string, password string) (*productive.SessionResponse, error)

func (*ProductiveService) ValidateSession added in v0.0.3

func (s *ProductiveService) ValidateSession(otp string, password string, sessionResponse *productive.SessionResponse) (*productive.SessionResponse, error)

type ProjectEntry

type ProjectEntry struct {
	Service  *productive.Service
	Day      time.Time
	Duration string
	Notes    []string
}

type ProjectStorage

type ProjectStorage interface {
	UpsertTrackedProject(project TrackedProject) error
	GetTrackedProjects() ([]TrackedProject, error)
}

type ProjectTrackingService

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

func NewProjectTrackingService

func NewProjectTrackingService(client *productive.Client) *ProjectTrackingService

func (*ProjectTrackingService) TrackProject

func (s *ProjectTrackingService) TrackProject(request TrackProjectRequest) error

type Prompt

type Prompt interface {
	Input(label string) (string, error)
	InputMasked(label string) (string, error)
	InputMultiline(label string) ([]string, error)
	SelectDeal(label string, deals []productive.Deal) (*productive.Deal, error)
	SelectService(label string, services []productive.Service) (*productive.Service, error)
	SelectOneWithSearch(label string, options []TrackedProject, searchFunction func(string, int) bool) (interface{}, error)
}

type SessionService

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

func NewSessionService

func NewSessionService(
	productiveService *ProductiveService,
	prompt Prompt,
	sessionManager UserSessionManager,
) *SessionService

func (*SessionService) ObtainUserSession added in v0.0.3

func (s *SessionService) ObtainUserSession() (*UserSessionData, error)

type StdinPrompt

type StdinPrompt struct{}

func NewStdinPrompt

func NewStdinPrompt() StdinPrompt

func (StdinPrompt) Input

func (stdIn StdinPrompt) Input(label string) (string, error)

func (StdinPrompt) InputMasked

func (stdIn StdinPrompt) InputMasked(label string) (string, error)

func (StdinPrompt) InputMultiline

func (stdIn StdinPrompt) InputMultiline(label string) ([]string, error)

func (StdinPrompt) SelectDeal

func (stdIn StdinPrompt) SelectDeal(label string, deals []productive.Deal) (*productive.Deal, error)

func (StdinPrompt) SelectOneWithSearch

func (stdIn StdinPrompt) SelectOneWithSearch(
	label string,
	options []TrackedProject,
	searchFunction func(string, int) bool,
) (interface{}, error)

func (StdinPrompt) SelectService

func (stdIn StdinPrompt) SelectService(label string, services []productive.Service) (*productive.Service, error)

type TrackFoodRequest

type TrackFoodRequest struct {
	IsWeekTracking bool
	Day            string
}

func (TrackFoodRequest) IsValid

func (trackFoodRequest TrackFoodRequest) IsValid() bool

type TrackProjectRequest

type TrackProjectRequest struct {
	Day string
}

type TrackedProject

type TrackedProject struct {
	DealID      string
	DealName    string
	ServiceID   string
	ServiceName string
}

type TrackedProjects

type TrackedProjects struct {
	Projects []TrackedProject `json:"projects,omitempty"`
}

type UserSessionData

type UserSessionData struct {
	PersonID            string `json:"person_id,omitempty"`
	Token               string `json:"session_token,omitempty"`
	TokenExpirationDate string `json:"token_expiration_date,omitempty"`
}

type UserSessionManager

type UserSessionManager interface {
	GetUserSession() (*UserSessionData, error)
	SaveUserSession(session UserSessionData) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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