Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- type AuthenticationService
- type Client
- type DayEntries
- type DayEntryDetail
- type People
- type PeopleOptions
- type ProjectDetail
- type ProjectOptions
- type ProjectService
- func (s *ProjectService) CreateProject(project *models.Project) (*http.Response, error)
- func (s *ProjectService) DeleteProject(projectId int) (*http.Response, error)
- func (s *ProjectService) GetProject(projectId int) (*models.Project, *http.Response, error)
- func (s *ProjectService) Projects(opt *ProjectOptions) (*Projects, *http.Response, error)
- func (s *ProjectService) UpdateProject(project *models.Project) (*http.Response, error)
- type Projects
- type ReportOptions
- type ReportService
- type Session
- type UserDetail
- type UserParameters
- type UserService
- func (s *UserService) CreateUser(user *models.UserParameters) (*http.Response, error)
- func (s *UserService) GetUser(userId int) (*models.User, *http.Response, error)
- func (s *UserService) People(opt *PeopleOptions) (*People, *http.Response, error)
- func (s *UserService) UpdateUser(user *models.UserParameters) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body. The body can contain JSON (if the error is intended) or xml (sometimes Harvest just failes).
Types ¶
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
func (*AuthenticationService) Acquire ¶
func (s *AuthenticationService) Acquire(username, password string) (bool, error)
func (*AuthenticationService) Authenticated ¶
func (s *AuthenticationService) Authenticated() bool
Authenticated reports if the current Client has an authenticated session with Harvest
type Client ¶
type Client struct { // Services used for talking to different parts of the Harvest API. Authentication *AuthenticationService User *UserService Project *ProjectService Report *ReportService // contains filtered or unexported fields }
A Client manages communication with the Harvest API.
func NewClient ¶
NewClient returns a new Harvest API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication: http://help.getharvest.com/api/authentication/authentication/http-basic/ baseURL is the HTTP endpoint of your Harvest instance and should always be specified with a trailing slash.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) GetBaseURL ¶
GetBaseURL will return you the Base URL. This is the same URL as in the NewClient constructor
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type DayEntries ¶
Type for day entry list
type DayEntryDetail ¶
type PeopleOptions ¶
type PeopleOptions struct { // You can also filter by updated_since to only show people that have been updated since the date you pass // UpdatedSince=2015-04-25+18%3A30 UpdatedSince string `url:"updated_since,omitempty"` }
type ProjectDetail ¶
type ProjectOptions ¶
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
func (*ProjectService) CreateProject ¶
Create A New Project HTTP Response: 201 Created The method by which the project is budgeted or estimated. Parameter: BudgetBy or EstimateBy Options: Project (Hours Per Project),
Project_Cost (Total Project Fees), Task (Hours Per Task), Person (Hours Per Person), None (No Budget).\
func (*ProjectService) DeleteProject ¶
func (s *ProjectService) DeleteProject(projectId int) (*http.Response, error)
func (*ProjectService) GetProject ¶
func (*ProjectService) Projects ¶
func (s *ProjectService) Projects(opt *ProjectOptions) (*Projects, *http.Response, error)
func (*ProjectService) UpdateProject ¶
The method by which the project is budgeted or estimated. Parameter: BudgetBy or EstimateBy Options: Project (Hours Per Project),
Project_Cost (Total Project Fees), Task (Hours Per Task), Person (Hours Per Person), None (No Budget).\
type ReportOptions ¶
type ReportOptions struct { // Requests can be filtered by From and To parameters // From=2015-04-25 // To=2015-04-25 // Acceptable values for the OnlyBilled, OnlyUnbilled, IsClosed parameter are yes and no. // UpdatedSince=2015-04-25+18%3A30 From string `url:"from"` To string `url:"to"` OnlyBilled string `url:"only_billed,omitempty"` OnlyUnbilled string `url:"only_unbilled,omitempty"` IsClosed string `url:"is_closed,omitempty"` UpdatedSince string `url:"updated_since,omitempty"` UserId string `url:"user_id,omitempty"` }
type ReportService ¶
type ReportService struct {
// contains filtered or unexported fields
}
func (*ReportService) DayEntriesByProject ¶
func (s *ReportService) DayEntriesByProject(projectId int, opt *ReportOptions) (*DayEntries, *http.Response, error)
func (*ReportService) DayEntriesByUser ¶
func (s *ReportService) DayEntriesByUser(userId int, opt *ReportOptions) (*DayEntries, *http.Response, error)
type UserDetail ¶
type UserParameters ¶
type UserParameters struct {
User models.UserParameters `json:"user"`
}
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (*UserService) CreateUser ¶
func (s *UserService) CreateUser(user *models.UserParameters) (*http.Response, error)
Create new user POST https://YOURACCOUNT.harvestapp.com/people HTTP Response: 201 Created Upon creation, we’ll send an email to the user with instructions for setting a password. At minimum, you’ll need to include values for email, first-name, and last-name
func (*UserService) People ¶
func (s *UserService) People(opt *PeopleOptions) (*People, *http.Response, error)
func (*UserService) UpdateUser ¶
func (s *UserService) UpdateUser(user *models.UserParameters) (*http.Response, error)
Update user by ID PUT https://YOURACCOUNT.harvestapp.com/people/{USERID} HTTP Response: 200 OK You can update selected attributes for a user with this request. Note, updates to password are disregarded.