gotick

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

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

Go to latest
Published: Jun 21, 2016 License: MIT Imports: 7 Imported by: 0

README

gotick

GoDoc License Badge

Go-based client for Tick's API.

Contributing

gotick is developed using Scott Chacon's GitHub Flow. To contribute, fork gotick, create a feature branch, and then submit a pull request. GitHub Flow is summarized as:

  • Anything in the master branch is deployable
  • To work on something new, create a descriptively named branch off of master (e.g., new-oauth2-scopes)
  • Commit to that branch locally and regularly push your work to the same named branch on the server
  • When you need feedback or help, or you think the branch is ready for merging, open a pull request.
  • After someone else has reviewed and signed off on the feature, you can merge it into master.
  • Once it is merged and pushed to master, you can and should deploy immediately.

License

gotick is released under the MIT license. Please see the LICENSE.txt file for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entries

type Entries []Entry

func GetEntriesBetweenDates

func GetEntriesBetweenDates(tickData JSONGetter, startDate, endDate string) (Entries, error)

func GetEntriesBetweenDatesOnPage

func GetEntriesBetweenDatesOnPage(tickData JSONGetter, startDate, endDate string, page int) (Entries, error)

func GetProjectEntriesBetweenDates

func GetProjectEntriesBetweenDates(
	tickData JSONGetter, projectID uint, startDate, endDate string,
) (Entries, error)

func GetProjectEntriesBetweenDatesOnPage

func GetProjectEntriesBetweenDatesOnPage(
	tickData JSONGetter, projectID uint, startDate, endDate string, page int,
) (Entries, error)

type Entry

type Entry struct {
	ID        uint     `json:"id"`
	Date      TickDate `json:"date"`
	Hours     float64  `json:"hours"`
	Notes     string   `json:"notes"`
	TaskID    uint     `json:"task_id"`
	UserID    uint     `json:"user_id"`
	URL       string   `json:"url"`
	CreatedAt string   `json:"created_at"`
	UpdatedAt string   `json:"updated_at"`
}

type JSONGetter

type JSONGetter interface {
	GetJSON(string) ([]byte, error)
}

type Project

type Project struct {
	ID            uint    `json:"id"`
	Name          string  `json:"name"`
	Budget        float32 `json:"budget"`
	DateClosed    string  `json:"date_closed"`
	Notifications bool    `json:"notifications"`
	Billable      bool    `json:"billable"`
	Recurring     bool    `json:"recurring"`
	ClientID      uint    `json:"client_id"`
	OwnerID       uint    `json:"owner_id"`
	URL           string  `json:"url"`
	CreatedAt     string  `json:"created_at"`
	UpdatedAt     string  `json:"updated_at"`
}

Project models a Tick project.

func GetProject

func GetProject(tickData JSONGetter, projectID int) (Project, error)

type Projects

type Projects []Project

FIXME(mdr): This should probably be a map[uint]Project using the Project.ID as the key

func GetOpenProjects

func GetOpenProjects(tickData JSONGetter) (Projects, error)

func GetOpenProjectsOnPage

func GetOpenProjectsOnPage(tickData JSONGetter, page int) (Projects, error)

type Task

type Task struct {
	ID         uint    `json:"id"`
	Name       string  `json:"name"`
	Budget     float64 `json:"budget"`
	Position   uint    `json:"position"`
	ProjectID  uint    `json:"project_id"`
	DateClosed string  `json:"date_closed"`
	Billable   bool    `json:"billable"`
	URL        string  `json:"url"`
	CreatedAt  string  `json:"created_at"`
	UpdatedAt  string  `json:"updated_at"`
	TotalHours float64 `json:"total_hours"`
	Project    Project
}

Task models a Tick task associated with a particular project.

func GetTask

func GetTask(tickData JSONGetter, id int) (Task, error)

GetTask uses Tick's API to return a specific Task identified by its ID.

type Tasks

type Tasks []Task

func GetOpenTasks

func GetOpenTasks(tickData JSONGetter) (Tasks, error)

func GetOpenTasksOnPage

func GetOpenTasksOnPage(tickData JSONGetter, page int) (Tasks, error)

type TickDate

type TickDate struct{ time.Time }

func (*TickDate) UnmarshalJSON

func (d *TickDate) UnmarshalJSON(data []byte) error

type TickSession

type TickSession struct {
	APIToken       string
	SubscriptionID string
	UserAgent      string
}

func NewTickSession

func NewTickSession(apiToken, subscriptionID, userAgent string) (*TickSession, error)

func (*TickSession) GetJSON

func (tickSession *TickSession) GetJSON(url string) ([]byte, error)

type User

type User struct {
	ID             uint   `json:"id"`
	FirstName      string `json:"first_name"`
	LastName       string `json:"last_name"`
	Email          string `json:"email"`
	AvatarFileName string `json:"avatar_file_name"`
	Timezone       string `json:"timezone"`
	UpdatedAt      string `json:"updated_at"`
}

User models a Tick user.

type Users

type Users []User

func GetUsers

func GetUsers(tickData JSONGetter) (Users, error)

Jump to

Keyboard shortcuts

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