Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Float64(v float64) *float64
- func Int(v int) *int
- func Int64(v int64) *int64
- func Ints64(v []int64) *[]int64
- func String(v string) *string
- func Stringify(message interface{}) string
- func TimeTimeP(v time.Time) *time.Time
- type APIClient
- type AbuseRateLimitError
- type Client
- type ClientContact
- type ClientContactCreateRequest
- type ClientContactList
- type ClientContactListOptions
- type ClientContactUpdateRequest
- type ClientCreateRequest
- type ClientList
- type ClientListOptions
- type ClientService
- func (s *ClientService) Create(ctx context.Context, data *ClientCreateRequest) (*Client, *http.Response, error)
- func (s *ClientService) CreateClientContact(ctx context.Context, data *ClientContactCreateRequest) (*ClientContact, *http.Response, error)
- func (s *ClientService) Delete(ctx context.Context, clientID int64) (*http.Response, error)
- func (s *ClientService) DeleteClientContact(ctx context.Context, contactID int64) (*http.Response, error)
- func (s *ClientService) Get(ctx context.Context, clientID int64) (*Client, *http.Response, error)
- func (s *ClientService) GetContact(ctx context.Context, clientContactID int64) (*ClientContact, *http.Response, error)
- func (s *ClientService) List(ctx context.Context, opt *ClientListOptions) (*ClientList, *http.Response, error)
- func (s *ClientService) ListContacts(ctx context.Context, opt *ClientContactListOptions) (*ClientContactList, *http.Response, error)
- func (s *ClientService) Update(ctx context.Context, clientID int64, data *ClientUpdateRequest) (*Client, *http.Response, error)
- func (s *ClientService) UpdateClientContact(ctx context.Context, contactID int64, data *ClientContactUpdateRequest) (*ClientContact, *http.Response, error)
- type ClientUpdateRequest
- type Company
- type CompanyService
- type Date
- type Error
- type ErrorResponse
- type Estimate
- type EstimateEventTypeRequest
- type EstimateItemCategory
- type EstimateItemCategoryList
- type EstimateItemCategoryListOptions
- type EstimateItemCategoryRequest
- type EstimateLineItem
- type EstimateList
- type EstimateListOptions
- type EstimateMessage
- type EstimateMessageCreateRequest
- type EstimateMessageList
- type EstimateMessageListOptions
- type EstimateMessageRecipient
- type EstimateMessageRecipientCreateRequest
- type EstimateService
- func (s *EstimateService) CreateEstimateMessage(ctx context.Context, data *EstimateMessageCreateRequest) (*EstimateMessage, *http.Response, error)
- func (s *EstimateService) CreateItemCategory(ctx context.Context, data *EstimateItemCategoryRequest) (*EstimateItemCategory, *http.Response, error)
- func (s *EstimateService) DeleteEstimateMessage(ctx context.Context, estimateID, estimateMessageID int64) (*http.Response, error)
- func (s *EstimateService) DeleteItemCategory(ctx context.Context, estimateItemCategoryID int64) (*http.Response, error)
- func (s *EstimateService) Get(ctx context.Context, estimateID int64) (*Estimate, *http.Response, error)
- func (s *EstimateService) GetItemCategory(ctx context.Context, estimateItemCategoryID int64) (*EstimateItemCategory, *http.Response, error)
- func (s *EstimateService) List(ctx context.Context, opt *EstimateListOptions) (*EstimateList, *http.Response, error)
- func (s *EstimateService) ListEstimateMessages(ctx context.Context, estimateID int64, opt *EstimateMessageListOptions) (*EstimateList, *http.Response, error)
- func (s *EstimateService) ListItemCategories(ctx context.Context, opt *EstimateItemCategoryListOptions) (*EstimateItemCategoryList, *http.Response, error)
- func (s *EstimateService) MarkAsAccepted(ctx context.Context, estimateID int64) (*EstimateMessage, *http.Response, error)
- func (s *EstimateService) MarkAsDeclined(ctx context.Context, estimateID int64) (*EstimateMessage, *http.Response, error)
- func (s *EstimateService) MarkAsReopen(ctx context.Context, estimateID int64) (*EstimateMessage, *http.Response, error)
- func (s *EstimateService) MarkAsSent(ctx context.Context, estimateID int64) (*EstimateMessage, *http.Response, error)
- func (s *EstimateService) SendEvent(ctx context.Context, estimateID int64, data *EstimateEventTypeRequest) (*EstimateMessage, *http.Response, error)
- func (s *EstimateService) UpdateItemCategory(ctx context.Context, estimateItemCategoryID int64, ...) (*EstimateItemCategory, *http.Response, error)
- type EventTypeRequest
- type Expense
- type ExpenseCategory
- type ExpenseCategoryList
- type ExpenseCategoryListOptions
- type ExpenseCategoryRequest
- type ExpenseCreateRequest
- type ExpenseList
- type ExpenseListOptions
- type ExpenseService
- func (s *ExpenseService) Create(ctx context.Context, data *ExpenseCreateRequest) (*Expense, *http.Response, error)
- func (s *ExpenseService) CreateExpenseCategory(ctx context.Context, data *ExpenseCategoryRequest) (*ExpenseCategory, *http.Response, error)
- func (s *ExpenseService) Delete(ctx context.Context, expenseID int64) (*http.Response, error)
- func (s *ExpenseService) DeleteExpenseCategory(ctx context.Context, expenseCategoryID int64) (*http.Response, error)
- func (s *ExpenseService) Get(ctx context.Context, expenseID int64) (*Expense, *http.Response, error)
- func (s *ExpenseService) GetExpenseCategory(ctx context.Context, expenseCategoryID int64) (*ExpenseCategory, *http.Response, error)
- func (s *ExpenseService) List(ctx context.Context, opt *ExpenseListOptions) (*ExpenseList, *http.Response, error)
- func (s *ExpenseService) ListExpenseCategories(ctx context.Context, opt *ExpenseCategoryListOptions) (*ExpenseCategoryList, *http.Response, error)
- func (s *ExpenseService) Update(ctx context.Context, expenseID int64, data *ExpenseUpdateRequest) (*Expense, *http.Response, error)
- func (s *ExpenseService) UpdateExpenseCategory(ctx context.Context, expenseCategoryID int64, data *ExpenseCategoryRequest) (*ExpenseCategory, *http.Response, error)
- type ExpenseUpdateRequest
- type ExternalReference
- type Invoice
- type InvoiceCreateRequest
- type InvoiceItemCategory
- type InvoiceItemCategoryList
- type InvoiceItemCategoryListOptions
- type InvoiceItemCategoryRequest
- type InvoiceLineItem
- type InvoiceLineItemImportExpenseRequest
- type InvoiceLineItemImportRequest
- type InvoiceLineItemImportTimeRequest
- type InvoiceLineItemRequest
- type InvoiceList
- type InvoiceListOptions
- type InvoiceMessage
- type InvoiceMessageCreateRequest
- type InvoiceMessageList
- type InvoiceMessageListOptions
- type InvoiceMessageRecipient
- type InvoicePayment
- type InvoicePaymentList
- type InvoicePaymentListOptions
- type InvoicePaymentRequest
- type InvoiceService
- func (s *InvoiceService) Create(ctx context.Context, data *InvoiceCreateRequest) (*Invoice, *http.Response, error)
- func (s *InvoiceService) CreateInvoiceMessage(ctx context.Context, invoiceID int64, data *InvoiceMessageCreateRequest) (*InvoiceMessage, *http.Response, error)
- func (s *InvoiceService) CreateItemCategory(ctx context.Context, data *InvoiceItemCategoryRequest) (*InvoiceItemCategory, *http.Response, error)
- func (s *InvoiceService) CreatePayment(ctx context.Context, invoiceID int64, data *InvoicePaymentRequest) (*InvoicePayment, *http.Response, error)
- func (s *InvoiceService) Delete(ctx context.Context, invoiceID int64) (*http.Response, error)
- func (s *InvoiceService) DeleteInvoiceMessage(ctx context.Context, invoiceID, invoiceMessageID int64) (*http.Response, error)
- func (s *InvoiceService) DeleteInvoicePayment(ctx context.Context, invoiceID, invoicePaymentID int64) (*http.Response, error)
- func (s *InvoiceService) DeleteItemCategory(ctx context.Context, invoiceItemCategoryID int64) (*http.Response, error)
- func (s *InvoiceService) Get(ctx context.Context, invoiceID int64) (*Invoice, *http.Response, error)
- func (s *InvoiceService) GetItemCategory(ctx context.Context, invoiceItemCategoryID int64) (*InvoiceItemCategory, *http.Response, error)
- func (s *InvoiceService) List(ctx context.Context, opt *InvoiceListOptions) (*InvoiceList, *http.Response, error)
- func (s *InvoiceService) ListInvoiceMessages(ctx context.Context, invoiceID int64, opt *InvoiceMessageListOptions) (*InvoiceList, *http.Response, error)
- func (s *InvoiceService) ListItemCategories(ctx context.Context, opt *InvoiceItemCategoryListOptions) (*InvoiceItemCategoryList, *http.Response, error)
- func (s *InvoiceService) ListPayments(ctx context.Context, invoiceID int64, opt *InvoicePaymentListOptions) (*InvoicePaymentList, *http.Response, error)
- func (s *InvoiceService) MarkAsClosed(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
- func (s *InvoiceService) MarkAsDraft(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
- func (s *InvoiceService) MarkAsReopen(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
- func (s *InvoiceService) MarkAsSent(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
- func (s *InvoiceService) SendEvent(ctx context.Context, invoiceID int64, data *EventTypeRequest) (*InvoiceMessage, *http.Response, error)
- func (s *InvoiceService) Update(ctx context.Context, invoiceID int64, data *InvoiceUpdateRequest) (*Invoice, *http.Response, error)
- func (s *InvoiceService) UpdateItemCategory(ctx context.Context, invoiceItemCategoryID int64, ...) (*InvoiceItemCategory, *http.Response, error)
- type InvoiceUpdateRequest
- type ListOptions
- type MyProjectAssignmentListOptions
- type PageLinks
- type Pagination
- type PaymentGateway
- type Project
- type ProjectList
- type ProjectListOptions
- type ProjectService
- func (s *ProjectService) CreateTaskAssignment(ctx context.Context, projectID int64, data *ProjectTaskAssignmentCreateRequest) (*ProjectTaskAssignment, *http.Response, error)
- func (s *ProjectService) Get(ctx context.Context, projectID int64) (*Project, *http.Response, error)
- func (s *ProjectService) GetMyProjectAssignments(ctx context.Context, opt *MyProjectAssignmentListOptions) (*UserProjectAssignmentList, *http.Response, error)
- func (s *ProjectService) GetTaskAssignment(ctx context.Context, projectID int64, taskAssignmentID int64) (*ProjectTaskAssignment, *http.Response, error)
- func (s *ProjectService) GetUserAssignment(ctx context.Context, projectID int64, userAssignmentID int64) (*ProjectUserAssignment, *http.Response, error)
- func (s *ProjectService) List(ctx context.Context, opt *ProjectListOptions) (*ProjectList, *http.Response, error)
- func (s *ProjectService) ListProjectAssignments(ctx context.Context, userID int64, opt *UserProjectAssignmentListOptions) (*UserProjectAssignmentList, *http.Response, error)
- func (s *ProjectService) ListTaskAssignments(ctx context.Context, projectID int64, opt *ProjectTaskAssignmentListOptions) (*ProjectTaskAssignmentList, *http.Response, error)
- func (s *ProjectService) ListUserAssignments(ctx context.Context, projectID int64, opt *ProjectUserAssignmentListOptions) (*ProjectUserAssignmentList, *http.Response, error)
- type ProjectTaskAssignment
- type ProjectTaskAssignmentCreateRequest
- type ProjectTaskAssignmentList
- type ProjectTaskAssignmentListOptions
- type ProjectUserAssignment
- type ProjectUserAssignmentList
- type ProjectUserAssignmentListOptions
- type Rate
- type RateLimitError
- type RateLimits
- type Receipt
- type Role
- type RoleCreateRequest
- type RoleList
- type RoleListOptions
- type RoleService
- func (s *RoleService) Create(ctx context.Context, data *RoleCreateRequest) (*Role, *http.Response, error)
- func (s *RoleService) Delete(ctx context.Context, roleID int64) (*http.Response, error)
- func (s *RoleService) Get(ctx context.Context, roleID int64) (*Role, *http.Response, error)
- func (s *RoleService) List(ctx context.Context, opt *RoleListOptions) (*RoleList, *http.Response, error)
- func (s *RoleService) Update(ctx context.Context, roleID int64, data *RoleUpdateRequest) (*Role, *http.Response, error)
- type RoleUpdateRequest
- type Task
- type TaskCreateRequest
- type TaskList
- type TaskListOptions
- type TaskService
- func (s *TaskService) Create(ctx context.Context, data *TaskCreateRequest) (*Task, *http.Response, error)
- func (s *TaskService) Delete(ctx context.Context, taskID int64) (*http.Response, error)
- func (s *TaskService) Get(ctx context.Context, taskID int64) (*Task, *http.Response, error)
- func (s *TaskService) List(ctx context.Context, opt *TaskListOptions) (*TaskList, *http.Response, error)
- func (s *TaskService) Update(ctx context.Context, taskID int64, data *TaskUpdateRequest) (*Task, *http.Response, error)
- type TaskUpdateRequest
- type Time
- type TimeEntry
- type TimeEntryCreateViaDuration
- type TimeEntryCreateViaStartEndTime
- type TimeEntryList
- type TimeEntryListOptions
- type TimeEntryUpdate
- type TimesheetService
- func (s *TimesheetService) CreateTimeEntryViaDuration(ctx context.Context, data *TimeEntryCreateViaDuration) (*TimeEntry, *http.Response, error)
- func (s *TimesheetService) CreateTimeEntryViaStartEndTime(ctx context.Context, data *TimeEntryCreateViaStartEndTime) (*TimeEntry, *http.Response, error)
- func (s *TimesheetService) DeleteTimeEntry(ctx context.Context, timeEntryID int64) (*http.Response, error)
- func (s *TimesheetService) Get(ctx context.Context, timeEntryID int64) (*TimeEntry, *http.Response, error)
- func (s *TimesheetService) List(ctx context.Context, opt *TimeEntryListOptions) (*TimeEntryList, *http.Response, error)
- func (s *TimesheetService) RestartTimeEntry(ctx context.Context, timeEntryID int64) (*TimeEntry, *http.Response, error)
- func (s *TimesheetService) StopTimeEntry(ctx context.Context, timeEntryID int64) (*TimeEntry, *http.Response, error)
- func (s *TimesheetService) UpdateTimeEntry(ctx context.Context, timeEntryID int64, data *TimeEntryUpdate) (*TimeEntry, *http.Response, error)
- type User
- type UserCreateRequest
- type UserList
- type UserListOptions
- type UserProjectAssignment
- type UserProjectAssignmentList
- type UserProjectAssignmentListOptions
- type UserService
- func (s *UserService) Create(ctx context.Context, data *UserCreateRequest) (*User, *http.Response, error)
- func (s *UserService) Current(ctx context.Context) (*User, *http.Response, error)
- func (s *UserService) Delete(ctx context.Context, userID int64) (*http.Response, error)
- func (s *UserService) Get(ctx context.Context, userID int64) (*User, *http.Response, error)
- func (s *UserService) List(ctx context.Context, opt *UserListOptions) (*UserList, *http.Response, error)
- func (s *UserService) Update(ctx context.Context, userID int64, data *UserUpdateRequest) (*User, *http.Response, error)
- type UserUpdateRequest
Constants ¶
const ( LibraryVersion = "1" DefaultBaseURL = "https://api.harvestapp.com/v2/" UserAgent = "becoded/go-harvest/v" + LibraryVersion DefaultMediaType = "application/json" )
Variables ¶
var ErrBaseURLMissingSlash = errors.New("BaseURL must have a trailing slash")
var ErrDateParse = errors.New(`ErrDateParse: should be a string formatted as "2006-01-02"`)
var ErrTimeParse = errors.New(`ErrTimeParse: should be a string formatted as "15:04"`)
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
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 or equal to 202 Accepted. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
The error type will be *RateLimitError for rate limit exceeded errors, and *TwoFactorAuthError for two-factor authentication errors.
func Float64 ¶
Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it.
func Int ¶
Int is a helper routine that allocates a new int value to store v and returns a pointer to it.
func Int64 ¶
Int64 is a helper routine that allocates a new int value to store v and returns a pointer to it.
func Ints64 ¶
Ints64 is a helper routine that allocates a new int slice to store v and returns a pointer to it.
func String ¶
String is a helper routine that allocates a new string value to store v and returns a pointer to it.
Types ¶
type APIClient ¶
type APIClient struct { // Base URL for API requests. Defaults to the public Harvest API. // BaseURL should always be specified with a trailing slash. BaseURL *url.URL AccountID string // User agent used when communicating with the Harvest API. UserAgent string // Services used for talking to different parts of the Harvest API. Client *ClientService Company *CompanyService Project *ProjectService Task *TaskService User *UserService Estimate *EstimateService Invoice *InvoiceService Timesheet *TimesheetService Role *RoleService // contains filtered or unexported fields }
A APIClient manages communication with the Harvest API.
func NewAPIClient ¶
NewAPIClient returns a new Harvest API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).
func (*APIClient) Do ¶
func (c *APIClient) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
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. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.
The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.
func (*APIClient) NewRequest ¶
func (c *APIClient) NewRequest( ctx context.Context, method, urlStr string, body interface{}, ) (*http.Request, error)
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 AbuseRateLimitError ¶
type AbuseRateLimitError struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message // RetryAfter is provided with some abuse rate limit errors. If present, // it is the amount of time that the client should wait before retrying. // Otherwise, the client should try again later (after an unspecified amount of time). RetryAfter *time.Duration }
AbuseRateLimitError occurs when Harvest returns 429 Too many requests response with the "documentation_url" field value equal to "https://help.getharvest.com/api-v2/introduction/overview/general/#rate-limiting".
func (*AbuseRateLimitError) Error ¶
func (r *AbuseRateLimitError) Error() string
type Client ¶
type Client struct { // Unique ID for the client. ID *int64 `json:"id,omitempty"` // A textual description of the client. Name *string `json:"name,omitempty"` // Whether the client is active or archived. IsActive *bool `json:"is_active,omitempty"` // The physical address for the client. Address *string `json:"address,omitempty"` // The currency code associated with this client. Currency *string `json:"currency,omitempty"` // Date and time the client was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the client was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type ClientContact ¶
type ClientContact struct { // Unique ID for the contact. ID *int64 `json:"id,omitempty"` // An object containing the contact’s client id and name. Client *Client `json:"client,omitempty"` // The title of the contact. Title *string `json:"title,omitempty"` // The first name of the contact. FirstName *string `json:"first_name,omitempty"` // The last name of the contact. LastName *string `json:"last_name,omitempty"` // The contact’s email address. Email *string `json:"email,omitempty"` // The contact’s office phone number. PhoneOffice *string `json:"phone_office,omitempty"` // The contact’s mobile phone number. PhoneMobile *string `json:"phone_mobile,omitempty"` // The contact’s fax number. Fax *string `json:"fax,omitempty"` // Date and time the contact was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the contact was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (ClientContact) String ¶
func (p ClientContact) String() string
type ClientContactCreateRequest ¶
type ClientContactCreateRequest struct { // required The ID of the client associated with this contact. ClientID *int64 `json:"client_id"` // optional The title of the contact. Title *string `json:"title,omitempty"` // required The first name of the contact. FirstName *string `json:"first_name"` // optional The last name of the contact. LastName *string `json:"last_name,omitempty"` // optional The contact’s email address. Email *string `json:"email,omitempty"` // optional The contact’s office phone number. PhoneOffice *string `json:"phone_office,omitempty"` // optional The contact’s mobile phone number. PhoneMobile *string `json:"phone_mobile,omitempty"` // optional The contact’s fax number. Fax *string `json:"fax,omitempty"` }
type ClientContactList ¶
type ClientContactList struct { ClientContacts []*ClientContact `json:"contacts"` Pagination }
func (ClientContactList) String ¶
func (p ClientContactList) String() string
type ClientContactListOptions ¶
type ClientContactListOptions struct { // Only return contacts belonging to the client with the given ID. ClientID int64 `url:"client_id,omitempty"` // Only return contacts that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type ClientContactUpdateRequest ¶
type ClientContactUpdateRequest struct { // required The ID of the client associated with this contact. ClientID *int64 `json:"client_id,omitempty"` // optional The title of the contact. Title *string `json:"title,omitempty"` // required The first name of the contact. FirstName *string `json:"first_name,omitempty"` // optional The last name of the contact. LastName *string `json:"last_name,omitempty"` // optional The contact’s email address. Email *string `json:"email,omitempty"` // optional The contact’s office phone number. PhoneOffice *string `json:"phone_office,omitempty"` // optional The contact’s mobile phone number. PhoneMobile *string `json:"phone_mobile,omitempty"` // optional The contact’s fax number. Fax *string `json:"fax,omitempty"` }
type ClientCreateRequest ¶
type ClientCreateRequest struct { // required A textual description of the client. Name *string `json:"name"` // optional Whether the client is active, or archived. Defaults to true. IsActive *bool `json:"is_active,omitempty"` // optional A textual representation of the client’s physical address. May include new line characters. Address *string `json:"address,omitempty"` // optional The currency used by the client. // If not provided, the company’s currency will be used. See a list of supported currencies Currency *string `json:"currency,omitempty"` }
type ClientList ¶
type ClientList struct { Clients []*Client `json:"clients"` Pagination }
func (ClientList) String ¶
func (c ClientList) String() string
type ClientListOptions ¶
type ClientListOptions struct { // Pass true to only return active projects and false to return inactive projects. IsActive bool `url:"is_active,omitempty"` // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type ClientService ¶
type ClientService service
ClientService handles communication with the client related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/clients-api/clients/clients/
func (*ClientService) Create ¶
func (s *ClientService) Create(ctx context.Context, data *ClientCreateRequest) (*Client, *http.Response, error)
Create creates a new client object. Returns a client object and a 201 Created response code if the call succeeded.
func (*ClientService) CreateClientContact ¶
func (s *ClientService) CreateClientContact( ctx context.Context, data *ClientContactCreateRequest, ) (*ClientContact, *http.Response, error)
func (*ClientService) Delete ¶
Delete deletes a specific client. Deleting a client is only possible if it has no projects, invoices, or estimates associated with it. Returns a 200 OK response code if the call succeeded.
func (*ClientService) DeleteClientContact ¶
func (*ClientService) Get ¶
Get retrieves the client with the given ID. Returns a client object and a 200 OK response code if a valid identifier was provided.
func (*ClientService) GetContact ¶
func (s *ClientService) GetContact(ctx context.Context, clientContactID int64) (*ClientContact, *http.Response, error)
func (*ClientService) List ¶
func (s *ClientService) List(ctx context.Context, opt *ClientListOptions) (*ClientList, *http.Response, error)
List returns a list of your clients. The clients are returned sorted by creation date, with the most recently created clients appearing first.
func (*ClientService) ListContacts ¶
func (s *ClientService) ListContacts( ctx context.Context, opt *ClientContactListOptions, ) (*ClientContactList, *http.Response, error)
func (*ClientService) Update ¶
func (s *ClientService) Update( ctx context.Context, clientID int64, data *ClientUpdateRequest, ) (*Client, *http.Response, error)
Update updates the specific client by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a client object and a 200 OK response code if the call succeeded.
func (*ClientService) UpdateClientContact ¶
func (s *ClientService) UpdateClientContact( ctx context.Context, contactID int64, data *ClientContactUpdateRequest, ) (*ClientContact, *http.Response, error)
type ClientUpdateRequest ¶
type ClientUpdateRequest struct { // A textual description of the client. Name *string `json:"name,omitempty"` // Whether the client is active, or archived. Defaults to true. IsActive *bool `json:"is_active,omitempty"` // A textual representation of the client’s physical address. May include new line characters. Address *string `json:"address,omitempty"` // The currency used by the client. // If not provided, the company’s currency will be used. See a list of supported currencies Currency *string `json:"currency,omitempty"` }
type Company ¶
type Company struct { // The Harvest URL for the company. BaseURI *string `json:"base_uri,omitempty"` // The Harvest domain for the company. FullDomain *string `json:"full_domain,omitempty"` // The name of the company. Name *string `json:"name,omitempty"` // Whether the company is active or archived. IsActive *bool `json:"is_active,omitempty"` // The week day used as the start of the week. Returns one of: Saturday, Sunday, or Monday. WeekStartDay *string `json:"week_start_day,omitempty"` // Whether time is tracked via duration or start and end times. WantsTimestampTimers *bool `json:"wants_timestamp_timers,omitempty"` // The format used to display time in Harvest. Returns either decimal or hours_minutes. TimeFormat *string `json:"time_format,omitempty"` // The type of plan the company is on. Examples: trial, free, or simple-v4 PlanType *string `json:"plan_type,omitempty"` // Used to represent whether the company is using a 12-hour or 24-hour clock. Returns either 12h or 24h. Clock *string `json:"clock,omitempty"` // Symbol *used `json:"Symbol,omitempty"` //when *formatting `json:"when,omitempty"` //decimals. DecimalSymbol *string `json:"decimal_symbol,omitempty"` // Separator *used `json:"Separator,omitempty"` //when formatting numbers. ThousandsSeparator *string `json:"thousands_separator,omitempty"` // The color scheme being used in the Harvest web client. ColorScheme *string `json:"color_scheme,omitempty"` // Whether the expense module is enabled. ExpenseFeature *bool `json:"expense_feature,omitempty"` // Whether the invoice module is enabled. InvoiceFeature *bool `json:"invoice_feature,omitempty"` // Whether the estimate module is enabled. EstimateFeature *bool `json:"estimate_feature,omitempty"` // Whether *the `json:"Whether,omitempty"` //approval module is enabled. ApprovalFeature *bool `json:"approval_feature,omitempty"` }
type CompanyService ¶
type CompanyService service
CompanyService handles communication with the company related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/company-api/company/company/
type Date ¶
func DateP ¶
DateP is a helper routine that allocates a new Date value to store v and returns a pointer to it.
func (*Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
type Error ¶
type Error struct { // resource on which the error occurred Resource string `json:"resource"` // field on which the error occurred Field string `json:"field"` // validation error code Code string `json:"code"` // Message describing the error. Errors with Code == "custom" will always have this set. Message string `json:"message"` }
An Error reports more details on an individual error in an ErrorResponse.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message Errors []Error `json:"errors"` // more detail on individual errors Block *struct { Reason string `json:"reason,omitempty"` } `json:"block,omitempty"` DocumentationURL string `json:"documentation_url,omitempty"` }
An ErrorResponse reports one or more errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Estimate ¶
type Estimate struct { // Unique ID for the estimate. ID *int64 `json:"id,omitempty"` // An object containing estimate’s client id and name. Client *Client `json:"client,omitempty"` // Array of estimate line items. LineItems *[]EstimateLineItem `json:"line_items,omitempty"` // An object containing the id and name of the person that created the estimate. Creator *User `json:"creator,omitempty"` // Used to build a URL to the public web invoice for your client: // https://{ACCOUNT_SUBDOMAIN}.harvestapp.com/client/invoices/abc123456 ClientKey *string `json:"client_key,omitempty"` // If no value is set, the number will be automatically generated. Number *string `json:"number,omitempty"` // The purchase order number. PurchaseOrder *string `json:"purchase_order,omitempty"` // The total amount for the estimate, including any discounts and taxes. Amount *float64 `json:"amount,omitempty"` // This percentage is applied to the subtotal, including line items and discounts. Tax *float64 `json:"tax,omitempty"` // The first amount of tax included, calculated from tax. If no tax is defined, this value will be null. TaxAmount *float64 `json:"tax_amount,omitempty"` // This percentage is applied to the subtotal, including line items and discounts. Tax2 *float64 `json:"tax2,omitempty"` // The amount calculated from tax2. Tax2Amount *float64 `json:"tax2_amount,omitempty"` // This percentage is subtracted from the subtotal. Discount *float64 `json:"discount,omitempty"` // The amount calcuated from discount. DiscountAmount *float64 `json:"discount_amount,omitempty"` // The estimate subject. Subject *string `json:"subject,omitempty"` // Any additional notes included on the estimate. Notes *string `json:"notes,omitempty"` // The currency code associated with this estimate. Currency *string `json:"currency,omitempty"` // The current state of the estimate: draft, sent, accepted, or declined. State *string `json:"state,omitempty"` // Date the estimate was issued. IssueDate *Date `json:"issue_date,omitempty"` // Date and time the estimate was sent. SentAt *time.Time `json:"sent_at,omitempty"` // Date and time the estimate was accepted. AcceptedAt *time.Time `json:"accepted_at,omitempty"` // Date and time the estimate was declined. DeclinedAt *time.Time `json:"declined_at,omitempty"` // Date and time the estimate was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the estimate was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type EstimateEventTypeRequest ¶
type EstimateEventTypeRequest struct {
EventType string `json:"event_type"`
}
type EstimateItemCategory ¶
type EstimateItemCategory struct { // Unique ID for the estimate item category. ID *int64 `json:"id,omitempty"` // The name of the estimate item category. Name *string `json:"name,omitempty"` // Date and time the estimate item category was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the estimate item category was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (EstimateItemCategory) String ¶
func (p EstimateItemCategory) String() string
type EstimateItemCategoryList ¶
type EstimateItemCategoryList struct { EstimateItemCategories []*EstimateItemCategory `json:"estimate_item_categories"` Pagination }
func (EstimateItemCategoryList) String ¶
func (p EstimateItemCategoryList) String() string
type EstimateItemCategoryListOptions ¶
type EstimateItemCategoryListOptions struct { // Only return estimate item categories that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type EstimateItemCategoryRequest ¶
type EstimateItemCategoryRequest struct {
Name *string `json:"name,omitempty"` // required The name of the estimate item category.
}
type EstimateLineItem ¶
type EstimateLineItem struct { // Unique ID for the line item. ID *int64 `json:"id,omitempty"` // The name of an estimate item category. Kind *string `json:"kind,omitempty"` // Text description of the line item. Description *string `json:"description,omitempty"` // The unit quantity of the item. Quantity *int64 `json:"quantity,omitempty"` // The individual price per unit. UnitPrice *float64 `json:"unit_price,omitempty"` // The line item subtotal (quantity * unit_price). Amount *float64 `json:"amount,omitempty"` // Whether the estimate’s tax percentage applies to this line item. Taxed *bool `json:"taxed,omitempty"` // Whether the estimate’s tax2 percentage applies to this line item. Taxed2 *bool `json:"taxed2,omitempty"` }
type EstimateList ¶
type EstimateList struct { Estimates []*Estimate `json:"estimates"` Pagination }
func (EstimateList) String ¶
func (p EstimateList) String() string
type EstimateListOptions ¶
type EstimateListOptions struct { // Only return estimates belonging to the client with the given ID. ClientID int64 `url:"client_id,omitempty"` // Only return estimates that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type EstimateMessage ¶
type EstimateMessage struct { // Unique ID for the message. ID *int64 `json:"id,omitempty"` // Name of the user that created the message. SentBy *string `json:"sent_by,omitempty"` // Email of the user that created the message. SentByEmail *string `json:"sent_by_email,omitempty"` // Name of the user that the message was sent from. SentFrom *string `json:"sent_from,omitempty"` // Email of the user that message was sent from. SentFromEmail *string `json:"sent_from_email,omitempty"` // Array of estimate message recipients. Recipients *[]EstimateMessageRecipient `json:"recipients,omitempty"` // The message subject. Subject *string `json:"subject,omitempty"` // The message body. Body *string `json:"body,omitempty"` // Whether to email a copy of the message to the current user. SendMeACopy *bool `json:"send_me_a_copy,omitempty"` // The type of estimate event that occurred with the message: send, accept, decline, re-open, view, or invoice. EventType *bool `json:"event_type,omitempty"` // Date and time the message was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the message was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (EstimateMessage) String ¶
func (p EstimateMessage) String() string
type EstimateMessageCreateRequest ¶
type EstimateMessageCreateRequest struct { // required Array of recipient parameters. See below for details. Recipients *[]EstimateMessageRecipientCreateRequest `json:"recipients,omitempty"` // optional The message subject. Subject *string `json:"subject,omitempty"` // optional The message body. Body *string `json:"body,omitempty"` // optional If set to true, a copy of the message email will be sent to the current user. Defaults to false. SendMeACopy *bool `json:"send_me_a_copy,omitempty"` // optional If provided, runs an event against the estimate. Options: “accept”, “decline”, “re-open”, or “send”. EventType *string `json:"event_type,omitempty"` }
type EstimateMessageList ¶
type EstimateMessageList struct { Estimates []*Estimate `json:"estimates"` Pagination }
func (EstimateMessageList) String ¶
func (p EstimateMessageList) String() string
type EstimateMessageListOptions ¶
type EstimateMessageListOptions struct { UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type EstimateService ¶
type EstimateService service
EstimateService handles communication with the issue related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/
func (*EstimateService) CreateEstimateMessage ¶
func (s *EstimateService) CreateEstimateMessage( ctx context.Context, data *EstimateMessageCreateRequest, ) (*EstimateMessage, *http.Response, error)
CreateEstimateMessage creates a new estimate message object.
func (*EstimateService) CreateItemCategory ¶
func (s *EstimateService) CreateItemCategory( ctx context.Context, data *EstimateItemCategoryRequest, ) (*EstimateItemCategory, *http.Response, error)
CreateItemCategory creates an estimate item category.
func (*EstimateService) DeleteEstimateMessage ¶
func (s *EstimateService) DeleteEstimateMessage( ctx context.Context, estimateID, estimateMessageID int64, ) (*http.Response, error)
DeleteEstimateMessage deletes an estimate message.
func (*EstimateService) DeleteItemCategory ¶
func (s *EstimateService) DeleteItemCategory( ctx context.Context, estimateItemCategoryID int64, ) (*http.Response, error)
DeleteItemCategory deletes an estimate item category.
func (*EstimateService) Get ¶
func (s *EstimateService) Get(ctx context.Context, estimateID int64) (*Estimate, *http.Response, error)
Get retrieves the estimate with the given ID.
func (*EstimateService) GetItemCategory ¶
func (s *EstimateService) GetItemCategory( ctx context.Context, estimateItemCategoryID int64, ) (*EstimateItemCategory, *http.Response, error)
GetItemCategory retrieves the estimate item category with the given ID.
func (*EstimateService) List ¶
func (s *EstimateService) List(ctx context.Context, opt *EstimateListOptions) (*EstimateList, *http.Response, error)
List will return a list of your estimates.
func (*EstimateService) ListEstimateMessages ¶
func (s *EstimateService) ListEstimateMessages( ctx context.Context, estimateID int64, opt *EstimateMessageListOptions, ) (*EstimateList, *http.Response, error)
ListEstimateMessages returns a list of messages associated with a given estimate.
func (*EstimateService) ListItemCategories ¶
func (s *EstimateService) ListItemCategories( ctx context.Context, opt *EstimateItemCategoryListOptions, ) (*EstimateItemCategoryList, *http.Response, error)
ListItemCategories returns a list of your estimate item categories.
func (*EstimateService) MarkAsAccepted ¶
func (s *EstimateService) MarkAsAccepted( ctx context.Context, estimateID int64, ) (*EstimateMessage, *http.Response, error)
MarkAsAccepted marks an open estimate as accepted.
func (*EstimateService) MarkAsDeclined ¶
func (s *EstimateService) MarkAsDeclined( ctx context.Context, estimateID int64, ) (*EstimateMessage, *http.Response, error)
MarkAsDeclined marks an open estimate as declined.
func (*EstimateService) MarkAsReopen ¶
func (s *EstimateService) MarkAsReopen( ctx context.Context, estimateID int64, ) (*EstimateMessage, *http.Response, error)
MarkAsReopen re-opens a closed estimate.
func (*EstimateService) MarkAsSent ¶
func (s *EstimateService) MarkAsSent( ctx context.Context, estimateID int64, ) (*EstimateMessage, *http.Response, error)
MarkAsSent marks a draft estimate as sent.
func (*EstimateService) SendEvent ¶
func (s *EstimateService) SendEvent( ctx context.Context, estimateID int64, data *EstimateEventTypeRequest, ) (*EstimateMessage, *http.Response, error)
SendEvent will send an EstimateEventType.
func (*EstimateService) UpdateItemCategory ¶
func (s *EstimateService) UpdateItemCategory( ctx context.Context, estimateItemCategoryID int64, data *EstimateItemCategoryRequest, ) (*EstimateItemCategory, *http.Response, error)
UpdateItemCategory updates an estimate item category.
type EventTypeRequest ¶
type EventTypeRequest struct {
EventType string `json:"event_type"`
}
type Expense ¶
type Expense struct { // Unique ID for the expense. ID *int64 `json:"id,omitempty"` // An object containing the expense’s client id, name, and currency. Client *Client `json:"client,omitempty"` // An object containing the expense’s project id, name, and code. Project *Project `json:"project,omitempty"` // An object containing the expense’s expense category id, name, unit_price, and unit_name. ExpenseCategory *ExpenseCategory `json:"expense_category,omitempty"` // An object containing the id and name of the user that recorded the expense. User *User `json:"user,omitempty"` // A user assignment object of the user that recorded the expense. UserAssignment *ProjectUserAssignment `json:"user_assignment,omitempty"` // An object containing the expense’s receipt URL and file name. Receipt *Receipt `json:"receipt,omitempty"` // Once the expense has been invoiced, this field will include the associated invoice’s id and number. Invoice *Invoice `json:"invoice,omitempty"` // Textual notes used to describe the expense. Notes *string `json:"notes,omitempty"` // Whether the expense is billable or not. Billable *bool `json:"billable,omitempty"` // Whether the expense has been approved or closed for some other reason. IsClosed *bool `json:"is_closed,omitempty"` // Whether the expense has been been invoiced, approved, or the project or person related to the expense is archived. IsLocked *bool `json:"is_locked,omitempty"` // Whether or not the expense has been marked as invoiced. IsBilled *bool `json:"is_billed,omitempty"` // An explanation of why the expense has been locked. LockedReason *string `json:"locked_reason,omitempty"` // Date the expense occurred. SpentDate *Date `json:"spent_date,omitempty"` // Date and time the expense was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the expense was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type ExpenseCategory ¶
type ExpenseCategory struct { // Unique ID for the expense category. ID *int64 `json:"id,omitempty"` // The name of the expense category. Name *string `json:"name,omitempty"` // The unit name of the expense category. UnitName *string `json:"unit_name,omitempty"` // The unit price of the expense category. UnitPrice *float64 `json:"unit_price,omitempty"` // Whether the expense category is active or archived. IsActive *bool `json:"is_active,omitempty"` // Date and time the expense category was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the expense category was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (ExpenseCategory) String ¶
func (p ExpenseCategory) String() string
type ExpenseCategoryList ¶
type ExpenseCategoryList struct { ExpenseCategories []*ExpenseCategory `json:"invoice_item_categories"` Pagination }
func (ExpenseCategoryList) String ¶
func (p ExpenseCategoryList) String() string
type ExpenseCategoryListOptions ¶
type ExpenseCategoryListOptions struct { // Pass true to only return active expense categories and false to return inactive expense categories. IsActive *bool `url:"is_active,omitempty"` // Only return expense categories that have been updated since the given date and time. UpdatedSince *time.Time `url:"updated_since,omitempty"` ListOptions }
type ExpenseCategoryRequest ¶
type ExpenseCategoryRequest struct { // required The name of the expense category. Name *string `json:"name,omitempty"` // optional The unit name of the expense category. UnitName *string `json:"unit_name,omitempty"` // optional The unit price of the expense category. UnitPrice *float64 `json:"unit_price,omitempty"` // optional Whether the expense category is active or archived. Defaults to true. IsActive *bool `json:"is_active,omitempty"` }
type ExpenseCreateRequest ¶
type ExpenseCreateRequest struct { // optional The ID of the user associated with this expense. Defaults to the ID of the currently authenticated user. UserID *int64 `json:"user_id,omitempty"` // required The ID of the project associated with this expense. ProjectID *int64 `json:"project_id"` // required The ID of the expense category this expense is being tracked against. ExpenseCategoryID *int64 `json:"expense_category_id"` // required Date the expense occurred. SpentDate *Date `json:"spent_date"` // *optional The quantity of units to use in calculating the total_cost of the expense. Units *int64 `json:"units,omitempty"` // *optional The total amount of the expense. TotalCost *float64 `json:"total_cost,omitempty"` // optional Textual notes used to describe the expense. Notes *string `json:"notes,omitempty"` // optional Whether this expense is billable or not. Defaults to true. Billable *bool `json:"billable,omitempty"` }
type ExpenseList ¶
type ExpenseList struct { Expenses []*Expense `json:"expenses"` Pagination }
func (ExpenseList) String ¶
func (p ExpenseList) String() string
type ExpenseListOptions ¶
type ExpenseListOptions struct { // Only return expenses belonging to the user with the given ID. UserID *int64 `url:"user_id,omitempty"` // Only return expenses belonging to the client with the given ID. ClientID *int64 `url:"client_id,omitempty"` // Only return expenses belonging to the project with the given ID. ProjectID *int64 `url:"project_id,omitempty"` // Pass true to only return expenses that have been invoiced and // false to return expenses that have not been invoiced. IsBilled *bool `url:"is_billed,omitempty"` // Only return expenses that have been updated since the given date and time. UpdatedSince *time.Time `url:"updated_since,omitempty"` // Only return expenses with a spent_date on or after the given date. From *Date `url:"from,omitempty"` // Only return expenses with a spent_date on or before the given date. To *Date `url:"to,omitempty"` ListOptions }
type ExpenseService ¶
type ExpenseService service
ExpenseService handles communication with the issue related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/
func (*ExpenseService) Create ¶
func (s *ExpenseService) Create(ctx context.Context, data *ExpenseCreateRequest) (*Expense, *http.Response, error)
Create creates a new expense object.
func (*ExpenseService) CreateExpenseCategory ¶
func (s *ExpenseService) CreateExpenseCategory( ctx context.Context, data *ExpenseCategoryRequest, ) (*ExpenseCategory, *http.Response, error)
CreateExpenseCategory creates a new expense category object.
func (*ExpenseService) DeleteExpenseCategory ¶
func (s *ExpenseService) DeleteExpenseCategory( ctx context.Context, expenseCategoryID int64, ) (*http.Response, error)
DeleteExpenseCategory deletes an expense category.
func (*ExpenseService) Get ¶
func (s *ExpenseService) Get(ctx context.Context, expenseID int64) (*Expense, *http.Response, error)
Get retrieves the expense with the given ID.
func (*ExpenseService) GetExpenseCategory ¶
func (s *ExpenseService) GetExpenseCategory( ctx context.Context, expenseCategoryID int64, ) (*ExpenseCategory, *http.Response, error)
GetExpenseCategory retrieves the expense category with the given ID.
func (*ExpenseService) List ¶
func (s *ExpenseService) List(ctx context.Context, opt *ExpenseListOptions) (*ExpenseList, *http.Response, error)
List returns a list of your expenses.
func (*ExpenseService) ListExpenseCategories ¶
func (s *ExpenseService) ListExpenseCategories( ctx context.Context, opt *ExpenseCategoryListOptions, ) (*ExpenseCategoryList, *http.Response, error)
ListExpenseCategories returns a list of your expense categories.
func (*ExpenseService) Update ¶
func (s *ExpenseService) Update( ctx context.Context, expenseID int64, data *ExpenseUpdateRequest, ) (*Expense, *http.Response, error)
Update Updates the specific expense by setting the values of the parameters passed.
func (*ExpenseService) UpdateExpenseCategory ¶
func (s *ExpenseService) UpdateExpenseCategory( ctx context.Context, expenseCategoryID int64, data *ExpenseCategoryRequest, ) (*ExpenseCategory, *http.Response, error)
UpdateExpenseCategory updates the specific expense category.
type ExpenseUpdateRequest ¶
type ExpenseUpdateRequest struct { // The ID of the project associated with this expense. ProjectID *int64 `json:"project_id,omitempty"` // The ID of the expense category this expense is being tracked against. ExpenseCategoryID *int64 `json:"expense_category_id,omitempty"` // Date the expense occurred. SpentDate *Date `json:"spent_date,omitempty"` // The quantity of units to use in calculating the total_cost of the expense. Units *int64 `json:"units,omitempty"` // The total amount of the expense. TotalCost *float64 `json:"total_cost,omitempty"` // Textual notes used to describe the expense. Notes *string `json:"notes,omitempty"` // Whether this expense is billable or not. Defaults to true. Billable *bool `json:"billable,omitempty"` // TO DO add receipt file // A receipt file to attach to the expense. If including a receipt, you must submit a multipart/form-data request. // Receipt *file `json:"receipt,omitempty"` // Whether an attached expense receipt should be deleted. Pass true to delete the expense receipt. DeleteReceipt *bool `json:"delete_receipt,omitempty"` }
type ExternalReference ¶
type Invoice ¶
type Invoice struct { // Unique ID for the invoice. ID *int64 `json:"id,omitempty"` // An object containing invoice’s client id and name. Client *Client `json:"client,omitempty"` // Array of invoice line items. LineItems *[]InvoiceLineItem `json:"line_items,omitempty"` // An object containing the associated estimate’s id. Estimate *Estimate `json:"estimate,omitempty"` // retainer *object `json:"retainer,omitempty"` // An object containing the associated retainer’s id. // An object containing the id and name of the person that created the invoice. Creator *User `json:"creator,omitempty"` // Used to build a URL to the public web invoice for your client: // https://{ACCOUNT_SUBDOMAIN}.harvestapp.com/client/invoices/abc123456 ClientKey *string `json:"client_key,omitempty"` // If no value is set, the number will be automatically generated. Number *string `json:"number,omitempty"` // The purchase order number. PurchaseOrder *string `json:"purchase_order,omitempty"` // The total amount for the invoice, including any discounts and taxes. Amount *float64 `json:"amount,omitempty"` // The total amount due at this time for this invoice. DueAmount *float64 `json:"due_amount,omitempty"` // This percentage is applied to the subtotal, including line items and discounts. Tax *float64 `json:"tax,omitempty"` // The first amount of tax included, calculated from tax. If no tax is defined, this value will be null. TaxAmount *float64 `json:"tax_amount,omitempty"` // This percentage is applied to the subtotal, including line items and discounts. Tax2 *float64 `json:"tax2,omitempty"` // The amount calculated from tax2. Tax2Amount *float64 `json:"tax2_amount,omitempty"` // This percentage is subtracted from the subtotal. Discount *float64 `json:"discount,omitempty"` // The amount calcuated from discount. DiscountAmount *float64 `json:"discount_amount,omitempty"` // The invoice subject. Subject *string `json:"subject,omitempty"` // Any additional notes included on the invoice. Notes *string `json:"notes,omitempty"` // The currency code associated with this invoice. Currency *string `json:"currency,omitempty"` // The current state of the invoice: draft, open, paid, or closed. State *string `json:"state,omitempty"` // Start of the period during which time entries and expenses were added to this invoice. PeriodStart *Date `json:"period_start,omitempty"` // End of the period during which time entries and expenses were added to this invoice. PeriodEnd *Date `json:"period_end,omitempty"` // Date the invoice was issued. IssueDate *Date `json:"issue_date,omitempty"` // Date the invoice is due. DueDate *Date `json:"due_date,omitempty"` // The timeframe in which the invoice should be paid. Options: upon receipt, net 15, net 30, net 45, net 60, or custom. PaymentTerm *string `json:"payment_term,omitempty"` // The list of payment options enabled for the invoice. Options: [ach, credit_card, paypal] PaymentOptions *[]string `json:"payment_options,omitempty"` // Date and time the invoice was sent. SentAt *time.Time `json:"sent_at,omitempty"` // Date and time the invoice was paid. PaidAt *time.Time `json:"paid_at,omitempty"` // Date and time the invoice was closed. ClosedAt *time.Time `json:"closed_at,omitempty"` // Date and time the invoice was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the invoice was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type InvoiceCreateRequest ¶
type InvoiceCreateRequest struct { // required The ID of the client this invoice belongs to. ClientID *int64 `json:"client_id"` // optional The ID of the retainer associated with this invoice. RetainerID *int64 `json:"retainer_id,omitempty"` // optional The ID of the estimate associated with this invoice. EstimateID *int64 `json:"estimate_id,omitempty"` // optional If no value is set, the number will be automatically generated. Number *string `json:"number,omitempty"` // optional The purchase order number. PurchaseOrder *string `json:"purchase_order,omitempty"` // optional This percentage is applied to the subtotal, including line items and discounts. // Example: use 10.0 for 10.0%. Tax *float64 `json:"tax,omitempty"` // optional This percentage is applied to the subtotal, including line items and discounts. // Example: use 10.0 for 10.0%. Tax2 *float64 `json:"tax2,omitempty"` // optional This percentage is subtracted from the subtotal. Example: use 10.0 for 10.0%. Discount *float64 `json:"discount,omitempty"` // optional The invoice subject. Subject *string `json:"subject,omitempty"` // optional Any additional notes to include on the invoice. Notes *string `json:"notes,omitempty"` // optional The currency used by the invoice. // If not provided, the client’s currency will be used. See a list of supported currencies Currency *string `json:"currency,omitempty"` // optional Date the invoice was issued. Defaults to today’s date. IssueDate *Date `json:"issue_date,omitempty"` // optional Date the invoice is due. Defaults to the issue_date. DueDate *Date `json:"due_date,omitempty"` // The timeframe in which the invoice should be paid. Defaults to custom. // Options: upon receipt, net 15, net 30, net 45, net 60, or custom. PaymentTerm *string `json:"payment_term,omitempty"` // The payment options available to pay the invoice. // Your account must be configured with the appropriate options under // Settings > Integrations > Online payment to assign them. // Options: [ach, credit_card, paypal] PaymentOptions *[]string `json:"payment_options,omitempty"` // optional Array of line item parameters LineItems *[]InvoiceLineItemRequest `json:"line_items,omitempty"` // optional An line items import object LineItemsImport *InvoiceLineItemImportRequest `json:"line_items_import,omitempty"` }
type InvoiceItemCategory ¶
type InvoiceItemCategory struct { // Unique ID for the invoice item category. ID *int64 `json:"id,omitempty"` // The name of the invoice item category. Name *string `json:"name,omitempty"` // Whether this invoice item category is used for billable hours when generating an invoice. UseAsService *bool `json:"use_as_service,omitempty"` // Whether this invoice item category is used for expenses when generating an invoice. UseAsExpense *bool `json:"use_as_expense,omitempty"` // Date and time the invoice item category was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the invoice item category was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (InvoiceItemCategory) String ¶
func (p InvoiceItemCategory) String() string
type InvoiceItemCategoryList ¶
type InvoiceItemCategoryList struct { InvoiceItemCategories []*InvoiceItemCategory `json:"invoice_item_categories"` Pagination }
func (InvoiceItemCategoryList) String ¶
func (p InvoiceItemCategoryList) String() string
type InvoiceItemCategoryListOptions ¶
type InvoiceItemCategoryListOptions struct { // Only return invoice item categories that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type InvoiceItemCategoryRequest ¶
type InvoiceItemCategoryRequest struct { // required The name of the invoice item category. Name *string `json:"name,omitempty"` }
type InvoiceLineItem ¶
type InvoiceLineItem struct { // Unique ID for the line item. ID *int64 `json:"id,omitempty"` // An object containing the associated project’s id, name, and code. Project *Project `json:"project,omitempty"` // The name of an invoice item category. Kind *string `json:"kind,omitempty"` // Text description of the line item. Description *string `json:"description,omitempty"` // The unit quantity of the item. Quantity *float64 `json:"quantity,omitempty"` // The individual price per unit. UnitPrice *float64 `json:"unit_price,omitempty"` // The line item subtotal (quantity * unit_price). Amount *float64 `json:"amount,omitempty"` // Whether the invoice’s tax percentage applies to this line item. Taxed *bool `json:"taxed,omitempty"` // Whether the invoice’s tax2 percentage applies to this line item. Taxed2 *bool `json:"taxed2,omitempty"` }
type InvoiceLineItemImportExpenseRequest ¶
type InvoiceLineItemImportExpenseRequest struct { // required How to summarize the expenses per line item. Options: project, category, people, or detailed. SummaryType *string `json:"summary_type"` // optional Start date for included expenses. // Must be provided if to is present. If neither from or to are provided, all unbilled expenses will be included. From *Date `json:"from,omitempty"` // optional End date for included expenses. // Must be provided if from is present. If neither from or to are provided, all unbilled expenses will be included. To *Date `json:"to,omitempty"` // optional If set to true, a PDF containing an expense report with receipts will be attached to the invoice. // Defaults to false. AttachReceipt *bool `json:"attach_receipt,omitempty"` }
type InvoiceLineItemImportRequest ¶
type InvoiceLineItemImportRequest struct { // required An array of the client’s project IDs you’d like to include time/expenses from. ProjectIds *[]int64 `json:"project_ids"` // optional A time import object. Time *InvoiceLineItemImportTimeRequest `json:"time,omitempty"` // optional An expense import object. Expenses *InvoiceLineItemImportExpenseRequest `json:"expenses,omitempty"` }
type InvoiceLineItemImportTimeRequest ¶
type InvoiceLineItemImportTimeRequest struct { // required How to summarize the time entries per line item. Options: project, task, people, or detailed. SummaryType *string `json:"summary_type"` // optional Start date for included time entries. // Must be provided if to is present. If neither from or to are provided, // all unbilled time entries will be included. From *Date `json:"from,omitempty"` // optional End date for included time entries. // Must be provided if from is present. If neither from or to are provided, // all unbilled time entries will be included. To *Date `json:"to,omitempty"` }
type InvoiceLineItemRequest ¶
type InvoiceLineItemRequest struct { // Unique ID for the line item. ID *int64 `json:"id,omitempty"` // optional The ID of the project associated with this line item. ProjectID *int64 `json:"project_id,omitempty"` // required The name of an invoice item category. Kind *string `json:"kind"` // optional Text description of the line item. Description *string `json:"description,omitempty"` // optional The unit quantity of the item. Defaults to 1. Quantity *int64 `json:"quantity,omitempty"` // required The individual price per unit. UnitPrice *float64 `json:"unit_price"` // optional Whether the invoice’s tax percentage applies to this line item. Defaults to false. Taxed *bool `json:"taxed,omitempty"` // optional Whether the invoice’s tax2 percentage applies to this line item. Defaults to false. Taxed2 *bool `json:"taxed2,omitempty"` // optional Delete an invoice line item Destroy *bool `json:"_destroy,omitempty"` }
type InvoiceList ¶
type InvoiceList struct { Invoices []*Invoice `json:"invoices"` Pagination }
func (InvoiceList) String ¶
func (p InvoiceList) String() string
type InvoiceListOptions ¶
type InvoiceListOptions struct { // Only return invoices belonging to the client with the given ID. ClientID int64 `url:"client_id,omitempty"` // Only return invoices associated with the project with the given ID. ProjectID int64 `url:"project_id,omitempty"` // Only return invoices that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type InvoiceMessage ¶
type InvoiceMessage struct { // Unique ID for the message. ID *int64 `json:"id,omitempty"` // Name of the user that created the message. SentBy *string `json:"sent_by,omitempty"` // Email of the user that created the message. SentByEmail *string `json:"sent_by_email,omitempty"` // Name of the user that the message was sent from. SentFrom *string `json:"sent_from,omitempty"` // Email of the user that message was sent from. SentFromEmail *string `json:"sent_from_email,omitempty"` // Array of invoice message recipients. Recipients *[]InvoiceMessageRecipient `json:"recipients,omitempty"` // The message subject. Subject *string `json:"subject,omitempty"` // The message body. Body *string `json:"body,omitempty"` // Whether to include a link to the client invoice in the message body. Not used when thank_you is true. IncludeLinkToClientInvoice *bool `json:"include_link_to_client_invoice,omitempty"` // Whether to attach the invoice PDF to the message email. AttachPdf *bool `json:"attach_pdf,omitempty"` // Whether to email a copy of the message to the current user. SendMeACopy *bool `json:"send_me_a_copy,omitempty"` // Whether this is a thank you message. ThankYou *bool `json:"thank_you,omitempty"` // The type of invoice event that occurred with the message: send, close, draft, re-open, or view. EventType *bool `json:"event_type,omitempty"` // Whether this is a reminder message. Reminder *bool `json:"reminder,omitempty"` // The date the reminder email will be sent. SendReminderOn *Date `json:"send_reminder_on,omitempty"` // Date and time the message was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the message was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (InvoiceMessage) String ¶
func (p InvoiceMessage) String() string
type InvoiceMessageCreateRequest ¶
type InvoiceMessageCreateRequest struct { // required Array of recipient parameters. See below for details. Recipients *[]InvoiceMessageRecipient `json:"recipients"` // optional The message subject. Subject *string `json:"subject,omitempty"` // optional The message body. Body *string `json:"body,omitempty"` // optional If set to true, a link to the client invoice URL will be included in the message email. // Defaults to false. Ignored when thank_you is set to true. IncludeLinkToClientInvoice *bool `json:"include_link_to_client_invoice,omitempty"` // optional If set to true, a PDF of the invoice will be attached to the message email. Defaults to false. AttachPdf *bool `json:"attach_pdf,omitempty"` // optional If set to true, a copy of the message email will be sent to the current user. Defaults to false. SendMeACopy *bool `json:"send_me_a_copy,omitempty"` // optional If set to true, a thank you message email will be sent. Defaults to false. ThankYou *bool `json:"thank_you,omitempty"` // optional If provided, runs an event against the invoice. Options: close, draft, re-open, or send. EventType *bool `json:"event_type,omitempty"` }
type InvoiceMessageList ¶
type InvoiceMessageList struct { Invoices []*Invoice `json:"invoices"` Pagination }
func (InvoiceMessageList) String ¶
func (p InvoiceMessageList) String() string
type InvoiceMessageListOptions ¶
type InvoiceMessageListOptions struct { UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type InvoiceMessageRecipient ¶
type InvoicePayment ¶
type InvoicePayment struct { // Unique ID for the payment. ID *int64 `json:"id,omitempty"` // The amount of the payment. Amount *string `json:"amount,omitempty"` // Date and time the payment was made. PaidAt *time.Time `json:"paid_at,omitempty"` // The name of the person who recorded the payment. RecordedBy *string `json:"recorded_by,omitempty"` // The email of the person who recorded the payment. RecordedByEmail *string `json:"recorded_by_email,omitempty"` // Any notes associated with the payment. Notes *string `json:"notes,omitempty"` // Either the card authorization or PayPal transaction ID. TransactionID *string `json:"transaction_id,omitempty"` // The payment gateway id and name used to process the payment. PaymentGateway *PaymentGateway `json:"payment_gateway,omitempty"` // Date and time the payment was recorded. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the payment was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (InvoicePayment) String ¶
func (p InvoicePayment) String() string
type InvoicePaymentList ¶
type InvoicePaymentList struct { InvoicePayments []*InvoicePayment `json:"invoice_payments"` Pagination }
func (InvoicePaymentList) String ¶
func (p InvoicePaymentList) String() string
type InvoicePaymentListOptions ¶
type InvoicePaymentListOptions struct { // Only return invoice payments that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type InvoicePaymentRequest ¶
type InvoicePaymentRequest struct { // required The amount of the payment. Amount *float64 `json:"amount"` // optional Date and time the payment was made. Pass either paid_at or paid_date, but not both. PaidAt *time.Time `json:"paid_at,omitempty"` // optional Date the payment was made. Pass either paid_at or paid_date, but not both. PaidDate *Date `json:"paid_date,omitempty"` // optional Any notes to be associated with the payment. Notes *string `json:"notes,omitempty"` }
type InvoiceService ¶
type InvoiceService service
InvoiceService handles communication with the issue related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/
func (*InvoiceService) Create ¶
func (s *InvoiceService) Create(ctx context.Context, data *InvoiceCreateRequest) (*Invoice, *http.Response, error)
Create creates a new invoice object.
func (*InvoiceService) CreateInvoiceMessage ¶
func (s *InvoiceService) CreateInvoiceMessage( ctx context.Context, invoiceID int64, data *InvoiceMessageCreateRequest, ) (*InvoiceMessage, *http.Response, error)
CreateInvoiceMessage creates a new invoice message object.
func (*InvoiceService) CreateItemCategory ¶
func (s *InvoiceService) CreateItemCategory( ctx context.Context, data *InvoiceItemCategoryRequest, ) (*InvoiceItemCategory, *http.Response, error)
CreateItemCategory creates a new invoice item category object.
func (*InvoiceService) CreatePayment ¶
func (s *InvoiceService) CreatePayment( ctx context.Context, invoiceID int64, data *InvoicePaymentRequest, ) (*InvoicePayment, *http.Response, error)
CreatePayment creates a new invoice payment object.
func (*InvoiceService) DeleteInvoiceMessage ¶
func (s *InvoiceService) DeleteInvoiceMessage( ctx context.Context, invoiceID, invoiceMessageID int64, ) (*http.Response, error)
DeleteInvoiceMessage deletes an invoice message.
func (*InvoiceService) DeleteInvoicePayment ¶
func (s *InvoiceService) DeleteInvoicePayment( ctx context.Context, invoiceID, invoicePaymentID int64, ) (*http.Response, error)
DeleteInvoicePayment deletes an invoice payment.
func (*InvoiceService) DeleteItemCategory ¶
func (s *InvoiceService) DeleteItemCategory(ctx context.Context, invoiceItemCategoryID int64) (*http.Response, error)
DeleteItemCategory deletes an invoice item category.
func (*InvoiceService) Get ¶
func (s *InvoiceService) Get(ctx context.Context, invoiceID int64) (*Invoice, *http.Response, error)
Get retrieves the invoice with the given ID.
func (*InvoiceService) GetItemCategory ¶
func (s *InvoiceService) GetItemCategory( ctx context.Context, invoiceItemCategoryID int64, ) (*InvoiceItemCategory, *http.Response, error)
GetItemCategory retrieves the invoice item category with the given ID.
func (*InvoiceService) List ¶
func (s *InvoiceService) List(ctx context.Context, opt *InvoiceListOptions) (*InvoiceList, *http.Response, error)
List returns a list of your invoices.
func (*InvoiceService) ListInvoiceMessages ¶
func (s *InvoiceService) ListInvoiceMessages( ctx context.Context, invoiceID int64, opt *InvoiceMessageListOptions, ) (*InvoiceList, *http.Response, error)
ListInvoiceMessages returns a list of messages associated with a given invoice.
func (*InvoiceService) ListItemCategories ¶
func (s *InvoiceService) ListItemCategories( ctx context.Context, opt *InvoiceItemCategoryListOptions, ) (*InvoiceItemCategoryList, *http.Response, error)
ListItemCategories returns a list of your invoice item categories.
func (*InvoiceService) ListPayments ¶
func (s *InvoiceService) ListPayments( ctx context.Context, invoiceID int64, opt *InvoicePaymentListOptions, ) (*InvoicePaymentList, *http.Response, error)
ListPayments returns a list of payments associate with a given invoice.
func (*InvoiceService) MarkAsClosed ¶
func (s *InvoiceService) MarkAsClosed(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
MarkAsClosed marks an open invoice as closed.
func (*InvoiceService) MarkAsDraft ¶
func (s *InvoiceService) MarkAsDraft(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
MarkAsDraft marks an open invoice as a draft.
func (*InvoiceService) MarkAsReopen ¶
func (s *InvoiceService) MarkAsReopen(ctx context.Context, invoiceID int64) (*InvoiceMessage, *http.Response, error)
MarkAsReopen re-opens a closed invoice.
func (*InvoiceService) MarkAsSent ¶
func (s *InvoiceService) MarkAsSent( ctx context.Context, invoiceID int64, ) (*InvoiceMessage, *http.Response, error)
MarkAsSent marks a draft invoice as sent.
func (*InvoiceService) SendEvent ¶
func (s *InvoiceService) SendEvent( ctx context.Context, invoiceID int64, data *EventTypeRequest, ) (*InvoiceMessage, *http.Response, error)
SendEvent will send an EventType.
func (*InvoiceService) Update ¶
func (s *InvoiceService) Update( ctx context.Context, invoiceID int64, data *InvoiceUpdateRequest, ) (*Invoice, *http.Response, error)
Update updates the specific invoice.
func (*InvoiceService) UpdateItemCategory ¶
func (s *InvoiceService) UpdateItemCategory( ctx context.Context, invoiceItemCategoryID int64, data *InvoiceItemCategoryRequest, ) (*InvoiceItemCategory, *http.Response, error)
UpdateItemCategory updates the specific invoice item category.
type InvoiceUpdateRequest ¶
type InvoiceUpdateRequest struct { // The ID of the client this invoice belongs to. ClientID *int64 `json:"client_id,omitempty"` // The ID of the retainer associated with this invoice. RetainerID *int64 `json:"retainer_id,omitempty"` // The ID of the estimate associated with this invoice. EstimateID *int64 `json:"estimate_id,omitempty"` // If no value is set, the number will be automatically generated. Number *string `json:"number,omitempty"` // The *purchase `json:"The,omitempty"` // order number. PurchaseOrder *string `json:"purchase_order,omitempty"` // This percentage is applied to the subtotal, including line items and discounts.Example: use 10.0 for 10.0%. Tax *float64 `json:"tax,omitempty"` // This percentage is applied to the subtotal, including line items and discounts.Example: use 10.0 for 10.0%. Tax2 *float64 `json:"tax2,omitempty"` // This percentage is subtracted from the subtotal.Example: use 10.0 for 10.0%. Discount *float64 `json:"discount,omitempty"` // The *invoice `json:"The,omitempty"` // subject. Subject *string `json:"subject,omitempty"` // Any additional notes to include on the invoice. Notes *string `json:"notes,omitempty"` // The currency used by the invoice.If not provided, // the client’s currency will be used.See a list of supported currencies Currency *string `json:"currency,omitempty"` // Date the invoice was issued. IssueDate *Date `json:"issue_date,omitempty"` // Date the invoice is due. DueDate *Date `json:"due_date,omitempty"` // Array of line item parameters LineItems *[]InvoiceLineItemRequest `json:"line_items,omitempty"` }
type ListOptions ¶
type ListOptions struct { // For paginated result sets, page of results to retrieve. Page int `url:"page,omitempty"` // For paginated result sets, the number of results to include per page. // The number of records to return per page. Can range between 1 and 100. (Default: 100) PerPage int `url:"per_page,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type MyProjectAssignmentListOptions ¶
type MyProjectAssignmentListOptions struct {
ListOptions
}
type Pagination ¶
type Pagination struct { PerPage *int `json:"per_page,omitempty"` TotalPages *int `json:"total_pages,omitempty"` TotalEntries *int `json:"total_entries,omitempty"` NextPage *int `json:"next_page,omitempty"` PreviousPage *int `json:"previous_page,omitempty"` Page *int `json:"page,omitempty"` Links *PageLinks `json:"links,omitempty"` }
type PaymentGateway ¶
func (PaymentGateway) String ¶
func (p PaymentGateway) String() string
type Project ¶
type Project struct { // Unique ID for the project. ID *int64 `json:"id,omitempty"` // An object containing the project’s client id, name, and currency. Client *Client `json:"client,omitempty"` // Unique name for the project. Name *string `json:"name,omitempty"` // The code associated with the project. Code *string `json:"code,omitempty"` // Whether the project is active or archived. IsActive *bool `json:"is_active,omitempty"` // Whether the project is billable or not. IsBillable *bool `json:"is_billable,omitempty"` // Whether the project is a fixed-fee project or not. IsFixedFee *bool `json:"is_fixed_fee,omitempty"` // The method by which the project is invoiced. BillBy *string `json:"bill_by,omitempty"` // Rate for projects billed by Project Hourly Rate. HourlyRate *float64 `json:"hourly_rate,omitempty"` // The budget in hours for the project when budgeting by time. Budget *float64 `json:"budget,omitempty"` // The method by which the project is budgeted. BudgetBy *string `json:"budget_by,omitempty"` // Whether the project budget is monthly or not. BudgetIsMonthly *bool `json:"budget_is_monthly,omitempty"` // Whether project managers should be notified when the project goes over budget. NotifyWhenOverBudget *bool `json:"notify_when_over_budget,omitempty"` // Percentage value used to trigger over budget email alerts. OverBudgetNotificationPercentage *float64 `json:"over_budget_notification_percentage,omitempty"` // Date of last over budget notification. If none have been sent, this will be null. OverBudgetNotificationDate *Date `json:"over_budget_notification_date,omitempty"` // Option to show project budget to all employees. Does not apply to Total Project Fee projects. ShowBudgetToAll *bool `json:"show_budget_to_all,omitempty"` // The monetary budget for the project when budgeting by money. CostBudget *float64 `json:"cost_budget,omitempty"` // Option for budget of Total Project Fees projects to include tracked expenses. CostBudgetIncludeExpenses *bool `json:"cost_budget_include_expenses,omitempty"` // The amount you plan to invoice for the project. Only used by fixed-fee projects. Fee *float64 `json:"fee,omitempty"` // Project notes. Notes *string `json:"notes,omitempty"` // Date the project was started. StartsOn *Date `json:"starts_on,omitempty"` // Date the project will end. EndsOn *Date `json:"ends_on,omitempty"` // Date and time the project was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the project was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type ProjectList ¶
type ProjectList struct { Projects []*Project `json:"projects"` Pagination }
func (ProjectList) String ¶
func (p ProjectList) String() string
type ProjectListOptions ¶
type ProjectListOptions struct { // Pass true to only return active projects and false to return inactive projects. IsActive bool `url:"is_active,omitempty"` // Only return projects belonging to the client with the given ID. ClientID int64 `url:"client_id,omitempty"` // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type ProjectService ¶
type ProjectService service
ProjectService handles communication with the issue related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/projects-api/projects/projects/
func (*ProjectService) CreateTaskAssignment ¶
func (s *ProjectService) CreateTaskAssignment( ctx context.Context, projectID int64, data *ProjectTaskAssignmentCreateRequest, ) (*ProjectTaskAssignment, *http.Response, error)
CreateTaskAssignment creates a new task assignment object.
func (*ProjectService) Get ¶
func (s *ProjectService) Get(ctx context.Context, projectID int64) (*Project, *http.Response, error)
Get retrieves the project with the given ID.
func (*ProjectService) GetMyProjectAssignments ¶
func (s *ProjectService) GetMyProjectAssignments( ctx context.Context, opt *MyProjectAssignmentListOptions, ) (*UserProjectAssignmentList, *http.Response, error)
GetMyProjectAssignments returns a list of your active project assignments.
func (*ProjectService) GetTaskAssignment ¶
func (s *ProjectService) GetTaskAssignment( ctx context.Context, projectID int64, taskAssignmentID int64, ) (*ProjectTaskAssignment, *http.Response, error)
GetTaskAssignment retrieves the task assignment with the given ID.
func (*ProjectService) GetUserAssignment ¶
func (s *ProjectService) GetUserAssignment( ctx context.Context, projectID int64, userAssignmentID int64, ) (*ProjectUserAssignment, *http.Response, error)
GetUserAssignment retrieves the user assignment with the given ID.
func (*ProjectService) List ¶
func (s *ProjectService) List(ctx context.Context, opt *ProjectListOptions) (*ProjectList, *http.Response, error)
List returns a list of your projects.
func (*ProjectService) ListProjectAssignments ¶
func (s *ProjectService) ListProjectAssignments( ctx context.Context, userID int64, opt *UserProjectAssignmentListOptions, ) (*UserProjectAssignmentList, *http.Response, error)
ListProjectAssignments returns a list of active project assignments for the user.
func (*ProjectService) ListTaskAssignments ¶
func (s *ProjectService) ListTaskAssignments( ctx context.Context, projectID int64, opt *ProjectTaskAssignmentListOptions, ) (*ProjectTaskAssignmentList, *http.Response, error)
ListTaskAssignments returns a list of your task assignments.
func (*ProjectService) ListUserAssignments ¶
func (s *ProjectService) ListUserAssignments( ctx context.Context, projectID int64, opt *ProjectUserAssignmentListOptions, ) (*ProjectUserAssignmentList, *http.Response, error)
ListUserAssignments returns a list of your projects user assignments.
type ProjectTaskAssignment ¶
type ProjectTaskAssignment struct { // Unique ID for the task assignment. ID *int64 `json:"id,omitempty"` // An object containing the id and name of the associated task. Task *Task `json:"task,omitempty"` // Whether the task assignment is active or archived. IsActive *bool `json:"is_active,omitempty"` // Whether the task assignment is billable or not. // For example: if set to true, all time tracked on this project for the associated task will be marked as billable. Billable *bool `json:"billable,omitempty"` // Rate used when the project’s bill_by is Tasks. HourlyRate *float64 `json:"hourly_rate,omitempty"` // Budget used when the project’s budget_by is task or task_fees. Budget *float64 `json:"budget,omitempty"` // Date and time the task assignment was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the task assignment was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (ProjectTaskAssignment) String ¶
func (p ProjectTaskAssignment) String() string
type ProjectTaskAssignmentCreateRequest ¶
type ProjectTaskAssignmentCreateRequest struct { // required The ID of the task to associate with the project. TaskID *int64 `json:"task_id"` // optional Whether the task assignment is active or archived. Defaults to true IsActive *bool `json:"is_active,omitempty"` // optional Whether the task assignment is billable or not. Defaults to false. Billable *bool `json:"billable,omitempty"` // optional Rate used when the project’s bill_by is Tasks. // Defaults to null when billing by task hourly rate, otherwise 0. HourlyRate *float64 `json:"hourly_rate,omitempty"` // optional Budget used when the project’s budget_by is task or task_fees. Budget *float64 `json:"budget,omitempty"` }
type ProjectTaskAssignmentList ¶
type ProjectTaskAssignmentList struct { TaskAssignments []*ProjectTaskAssignment `json:"task_assignments"` Pagination }
func (ProjectTaskAssignmentList) String ¶
func (p ProjectTaskAssignmentList) String() string
type ProjectTaskAssignmentListOptions ¶
type ProjectTaskAssignmentListOptions struct { // Pass true to only return active projects and false to return inactive projects. IsActive bool `url:"is_active,omitempty"` // Only return projects belonging to the client with the given ID. ClientID int64 `url:"client_id,omitempty"` // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type ProjectUserAssignment ¶
type ProjectUserAssignment struct { // Unique ID for the user assignment. ID *int64 `json:"id,omitempty"` // An object containing the id and name of the associated user. User *User `json:"user,omitempty"` // Whether the user assignment is active or archived. IsActive *bool `json:"is_active,omitempty"` // Determines if the user has project manager permissions for the project. IsProjectManager *bool `json:"is_project_manager,omitempty"` // Rate used when the project’s bill_by is People. HourlyRate *float64 `json:"hourly_rate,omitempty"` // Budget used when the project’s budget_by is person. Budget *float64 `json:"budget,omitempty"` // Date and time the user assignment was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the user assignment was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
func (ProjectUserAssignment) String ¶
func (p ProjectUserAssignment) String() string
type ProjectUserAssignmentList ¶
type ProjectUserAssignmentList struct { UserAssignments []*ProjectUserAssignment `json:"user_assignments"` Pagination }
func (ProjectUserAssignmentList) String ¶
func (p ProjectUserAssignmentList) String() string
type ProjectUserAssignmentListOptions ¶
type ProjectUserAssignmentListOptions struct { // Pass true to only return active projects and false to return inactive projects. IsActive bool `url:"is_active,omitempty"` // Only return projects belonging to the client with the given ID. ClientID int64 `url:"client_id,omitempty"` // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type Rate ¶
type Rate struct { // The number of requests per hour the client is currently limited to. Limit int `json:"limit"` // The number of remaining requests the client can make this hour. Remaining int `json:"remaining"` }
Rate represents the rate limit for the current client.
type RateLimitError ¶
type RateLimitError struct { Rate Rate // Rate specifies last known rate limit for the client Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message }
RateLimitError occurs when Harvest returns 429 Forbidden response with a rate limit remaining value of 0, and error message starts with "API rate limit exceeded for ".
func (*RateLimitError) Error ¶
func (r *RateLimitError) Error() string
type RateLimits ¶
type RateLimits struct { // 100 requests per 15 seconds // Harvest API docs: https://help.getharvest.com/api-v2/introduction/overview/general/#rate-limiting Core *Rate `json:"core"` }
RateLimits represents the rate limits for the current client.
func (RateLimits) String ¶
func (r RateLimits) String() string
type Receipt ¶
type Role ¶
type Role struct { ID *int64 `json:"id,omitempty"` // Unique ID for the role. Name *string `json:"name,omitempty"` // The name of the role. UserIDs *[]int64 `json:"user_ids,omitempty"` // of integers The IDs of the users assigned to this role. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the role was created. UpdatedAt *time.Time `json:"updated_at,omitempty"` // Date and time the role was last updated. }
type RoleCreateRequest ¶
type RoleList ¶
type RoleList struct { Roles []*Role `json:"roles"` Pagination }
type RoleListOptions ¶
type RoleListOptions struct {
ListOptions
}
type RoleService ¶
type RoleService service
RoleService handles communication with the issue related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/roles-api/roles/roles/
func (*RoleService) Create ¶
func (s *RoleService) Create(ctx context.Context, data *RoleCreateRequest) (*Role, *http.Response, error)
Create creates a new role object.
func (*RoleService) List ¶
func (s *RoleService) List(ctx context.Context, opt *RoleListOptions) (*RoleList, *http.Response, error)
List returns a list of roles in the account.
type RoleUpdateRequest ¶
type Task ¶
type Task struct { // Unique ID for the task. ID *int64 `json:"id,omitempty"` // The name of the task. Name *string `json:"name,omitempty"` // Used in determining whether default tasks should be marked billable when creating a new project. BillableByDefault *bool `json:"billable_by_default,omitempty"` // The hourly rate to use for this task when it is added to a project. DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // Whether this task should be automatically added to future projects. IsDefault *bool `json:"is_default,omitempty"` // Whether this task is active or archived. IsActive *bool `json:"is_active,omitempty"` // Date and time the task was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the task was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type TaskCreateRequest ¶
type TaskCreateRequest struct { // required The name of the task. Name *string `json:"name"` // optional Used in determining whether default tasks should be marked billable when creating a new project. // Defaults to true. BillableByDefault *bool `json:"billable_by_default,omitempty"` // optional The default hourly rate to use for this task when it is added to a project. Defaults to 0. DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // optional Whether this task should be automatically added to future projects. Defaults to false. IsDefault *bool `json:"is_default,omitempty"` // optional Whether this task is active or archived. Defaults to true. IsActive *bool `json:"is_active,omitempty"` }
type TaskList ¶
type TaskList struct { Tasks []*Task `json:"tasks"` Pagination }
type TaskListOptions ¶
type TaskListOptions struct { // Pass true to only return active projects and false to return inactive projects. IsActive bool `url:"is_active,omitempty"` // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type TaskService ¶
type TaskService service
TaskService handles communication with the task related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/
func (*TaskService) Create ¶
func (s *TaskService) Create(ctx context.Context, data *TaskCreateRequest) (*Task, *http.Response, error)
Create creates a new task object.
func (*TaskService) List ¶
func (s *TaskService) List(ctx context.Context, opt *TaskListOptions) (*TaskList, *http.Response, error)
List returns a list of your tasks.
type TaskUpdateRequest ¶
type TaskUpdateRequest struct { // The name of the task. Name *string `json:"name,omitempty"` // Used in determining whether default tasks should be marked billable when creating a new project. BillableByDefault *bool `json:"billable_by_default,omitempty"` // The default hourly rate to use for this task when it is added to a project. DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // Whether this task should be automatically added to future projects. IsDefault *bool `json:"is_default,omitempty"` // Whether this task is active or archived. IsActive *bool `json:"is_active,omitempty"` }
type Time ¶
func TimeP ¶
TimeP is a helper routine that allocates a new Time value to store v and returns a pointer to it.
func (*Time) MarshalJSON ¶
func (*Time) UnmarshalJSON ¶
type TimeEntry ¶
type TimeEntry struct { // Unique ID for the time entry. ID *int64 `json:"id,omitempty"` // Date of the time entry. SpentDate *Date `json:"spent_date,omitempty"` // An object containing the id and name of the associated user. User *User `json:"user,omitempty"` // A user assignment object of the associated user. UserAssignment *ProjectUserAssignment `json:"user_assignment,omitempty"` // An object containing the id and name of the associated client. Client *Client `json:"client,omitempty"` // An object containing the id and name of the associated project. Project *Project `json:"project,omitempty"` // An object containing the id and name of the associated task. Task *Task `json:"task,omitempty"` // A task assignment object of the associated task. TaskAssignment *ProjectTaskAssignment `json:"task_assignment,omitempty"` // An object containing the id, group_id, permalink, service, and service_icon_url // of the associated external reference. ExternalReference *ExternalReference `json:"external_reference,omitempty"` // Once the time entry has been invoiced, this field will include the associated invoice’s id and number. Invoice *Invoice `json:"invoice,omitempty"` // Number of (decimal time) hours tracked in this time entry. Hours *float64 `json:"hours,omitempty"` // Number of (decimal time) hours tracked in this time entry used in summary reports and invoices. // This value is rounded according to the Time Rounding setting in your Preferences. RoundedHours *float64 `json:"rounded_hours,omitempty"` // Notes attached to the time entry. Notes *string `json:"notes,omitempty"` // Whether or not the time entry has been locked. IsLocked *bool `json:"is_locked,omitempty"` // Why the time entry has been locked. LockedReason *string `json:"locked_reason,omitempty"` // Whether or not the time entry has been approved via Timesheet Approval. IsClosed *bool `json:"is_closed,omitempty"` // Whether or not the time entry has been marked as invoiced. IsBilled *bool `json:"is_billed,omitempty"` // Date and time the timer was started (if tracking by duration). TimerStartedAt *time.Time `json:"timer_started_at,omitempty"` // Time the time entry was started (if tracking by start/end times). StartedTime *Time `json:"started_time,omitempty"` // Time the time entry was ended (if tracking by start/end times). EndedTime *Time `json:"ended_time,omitempty"` // Whether or not the time entry is currently running. IsRunning *bool `json:"is_running,omitempty"` // Whether or not the time entry is billable. Billable *bool `json:"billable,omitempty"` // Whether or not the time entry counts towards the project budget. Budgeted *bool `json:"budgeted,omitempty"` // The billable rate for the time entry. BillableRate *float64 `json:"billable_rate,omitempty"` // The cost rate for the time entry. CostRate *float64 `json:"cost_rate,omitempty"` // Date and time the time entry was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the time entry was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type TimeEntryCreateViaDuration ¶
type TimeEntryCreateViaDuration struct { // optional The ID of the user to associate with the time entry. Defaults to the currently authenticated user’s ID. UserID *int64 `json:"user_id,omitempty"` // required The ID of the project to associate with the time entry. ProjectID *int64 `json:"project_id"` // required The ID of the task to associate with the time entry. TaskID *int64 `json:"task_id"` // required The ISO 8601 formatted date the time entry was spent. SpentDate *Date `json:"spent_date"` // optional The current amount of time tracked. // If provided, the time entry will be created with the specified hours and is_running will be set to false. // If not provided, hours will be set to 0.0 and is_running will be set to true. Hours *float64 `json:"hours,omitempty"` // optional Any notes to be associated with the time entry. Notes *string `json:"notes,omitempty"` }
type TimeEntryCreateViaStartEndTime ¶
type TimeEntryCreateViaStartEndTime struct { // optional The ID of the user to associate with the time entry. Defaults to the currently authenticated user’s ID. UserID *int64 `json:"user_id,omitempty"` // required The ID of the project to associate with the time entry. ProjectID *int64 `json:"project_id"` // required The ID of the task to associate with the time entry. TaskID *int64 `json:"task_id"` // required The ISO 8601 formatted date the time entry was spent. SpentDate *Date `json:"spent_date"` // optional The time the entry started. Defaults to the current time. Example: “8:00am”. StartedTime *Time `json:"started_time,omitempty"` // optional The time the entry ended. If provided, is_running will be set to false. // If not provided, is_running will be set to true. EndedTime *Time `json:"ended_time,omitempty"` // optional Any notes to be associated with the time entry. Notes *string `json:"notes,omitempty"` }
type TimeEntryList ¶
type TimeEntryList struct { TimeEntries []*TimeEntry `json:"time_entries"` Pagination }
func (TimeEntryList) String ¶
func (p TimeEntryList) String() string
type TimeEntryListOptions ¶
type TimeEntryListOptions struct { // Only return time entries belonging to the user with the given ID. UserID *int64 `url:"user_id,omitempty"` // Only return time entries belonging to the client with the given ID. ClientID *int64 `url:"client_id,omitempty"` // Only return time entries belonging to the project with the given ID. ProjectID *int64 `url:"project_id,omitempty"` // Only return time entries belonging to the task with the given ID. TaskID *int64 `url:"task_id,omitempty"` // Pass true to only return time entries that have been invoiced and false to return time // entries that have not been invoiced. IsBilled *bool `url:"is_billed,omitempty"` // Pass true to only return running time entries and false to return non-running time entries. IsRunning *bool `url:"is_running,omitempty"` // Only return time entries that have been updated since the given date and time.*/ UpdatedSince *time.Time `url:"updated_since,omitempty"` // Only return time entries with a spent_date on or after the given date. From *Date `url:"from,omitempty"` // Only return time entries with a spent_date on or before the given date. To *Date `url:"to,omitempty"` ListOptions }
type TimeEntryUpdate ¶
type TimeEntryUpdate struct { // required The ID of the project to associate with the time entry. ProjectID *int64 `json:"project_id"` // required The ID of the task to associate with the time entry. TaskID *int64 `json:"task_id"` // required The ISO 8601 formatted date the time entry was spent. SpentDate *Date `json:"spent_date"` // optional The time the entry started. Defaults to the current time. Example: “8:00am”. StartedTime *Time `json:"started_time,omitempty"` // optional The time the entry ended. If provided, is_running will be set to false. // If not provided, is_running will be set to true. EndedTime *Time `json:"ended_time,omitempty"` // optional The current amount of time tracked. // If provided, the time entry will be created with the specified hours and is_running will be set to false. // If not provided, hours will be set to 0.0 and is_running will be set to true. Hours *float64 `json:"hours,omitempty"` // optional Any notes to be associated with the time entry. Notes *string `json:"notes,omitempty"` }
type TimesheetService ¶
type TimesheetService service
TimeEntryService handles communication with the issue related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/
func (*TimesheetService) CreateTimeEntryViaDuration ¶
func (s *TimesheetService) CreateTimeEntryViaDuration( ctx context.Context, data *TimeEntryCreateViaDuration, ) (*TimeEntry, *http.Response, error)
CreateTimeEntryViaDuration creates a time entry object via duration.
func (*TimesheetService) CreateTimeEntryViaStartEndTime ¶
func (s *TimesheetService) CreateTimeEntryViaStartEndTime( ctx context.Context, data *TimeEntryCreateViaStartEndTime, ) (*TimeEntry, *http.Response, error)
CreateTimeEntryViaStartEndTime creates a time entry object via start and end time.
func (*TimesheetService) DeleteTimeEntry ¶
func (s *TimesheetService) DeleteTimeEntry(ctx context.Context, timeEntryID int64) (*http.Response, error)
DeleteTimeEntry deletes a time entry.
func (*TimesheetService) Get ¶
func (s *TimesheetService) Get(ctx context.Context, timeEntryID int64) (*TimeEntry, *http.Response, error)
Get retrieves the time entry with the given ID.
func (*TimesheetService) List ¶
func (s *TimesheetService) List( ctx context.Context, opt *TimeEntryListOptions, ) (*TimeEntryList, *http.Response, error)
List returns a list of time entries.
func (*TimesheetService) RestartTimeEntry ¶
func (s *TimesheetService) RestartTimeEntry( ctx context.Context, timeEntryID int64, ) (*TimeEntry, *http.Response, error)
RestartTimeEntry restarts a stopped time entry.
func (*TimesheetService) StopTimeEntry ¶
func (s *TimesheetService) StopTimeEntry(ctx context.Context, timeEntryID int64) (*TimeEntry, *http.Response, error)
StopTimeEntry stops a running time entry.
func (*TimesheetService) UpdateTimeEntry ¶
func (s *TimesheetService) UpdateTimeEntry( ctx context.Context, timeEntryID int64, data *TimeEntryUpdate, ) (*TimeEntry, *http.Response, error)
UpdateTimeEntry updates the specific time entry.
type User ¶
type User struct { // Unique ID for the user. ID *int64 `json:"id,omitempty"` // The first name of the user. FirstName *string `json:"first_name,omitempty"` // The last name of the user. LastName *string `json:"last_name,omitempty"` // The email address of the user. Email *string `json:"email,omitempty"` // The telephone number for the user. Telephone *string `json:"telephone,omitempty"` // The user's timezone. Timezone *string `json:"timezone,omitempty"` // Whether the user should be automatically added to future projects. HasAccessToAllFutureProjects *bool `json:"has_access_to_all_future_projects,omitempty"` // Whether the user is a contractor or an employee. IsContractor *bool `json:"is_contractor,omitempty"` // Whether the user has admin permissions. IsAdmin *bool `json:"is_admin,omitempty"` // Whether the user has project manager permissions. IsProjectManager *bool `json:"is_project_manager,omitempty"` // Whether the user can see billable rates on projects. Only applicable to project managers. CanSeeRates *bool `json:"can_see_rates,omitempty"` // Whether the user can create projects. Only applicable to project managers. CanCreateProjects *bool `json:"can_create_projects,omitempty"` // Whether the user can create invoices. Only applicable to project managers. CanCreateInvoices *bool `json:"can_create_invoices,omitempty"` // Whether the user is active or archived. IsActive *bool `json:"is_active,omitempty"` // The number of hours per week this person is available to work in seconds. // For example, if a person's capacity is 35 hours, the API will return 126000 seconds. WeeklyCapacity *int `json:"weekly_capacity,omitempty"` // The billable rate to use for this user when they are added to a project. DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // The cost rate to use for this user when calculating a project's costs vs billable amount. CostRate *float64 `json:"cost_rate,omitempty"` // of strings The role names assigned to this person. Roles *[]string `json:"roles,omitempty"` // The URL to the user's avatar image. AvatarURL *string `json:"avatar_url,omitempty"` // Date and time the user was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the user was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type UserCreateRequest ¶
type UserCreateRequest struct { // required The first name of the user. FirstName *string `json:"first_name"` // required The last name of the user. LastName *string `json:"last_name"` // required The email address of the user. Email *string `json:"email"` // optional The telephone number for the user. Telephone *string `json:"telephone,omitempty"` // optional The user's timezone. Defaults to the company's timezone. See a list of supported time zones. Timezone *string `json:"timezone,omitempty"` // optional Whether the user should be automatically added to future projects. Defaults to false. HasAccessToAllFutureProjects *bool `json:"has_access_to_all_future_projects,omitempty"` // optional Whether the user is a contractor or an employee. Defaults to false. IsContractor *bool `json:"is_contractor,omitempty"` // optional Whether the user has admin permissions. Defaults to false. IsAdmin *bool `json:"is_admin,omitempty"` // optional Whether the user has project manager permissions. Defaults to false. IsProjectManager *bool `json:"is_project_manager,omitempty"` // optional Whether the user can see billable rates on projects. // Only applicable to project managers. Defaults to false. CanSeeRates *bool `json:"can_see_rates,omitempty"` // optional Whether the user can create projects. Only applicable to project managers. Defaults to false. CanCreateProjects *bool `json:"can_create_projects,omitempty"` // optional Whether the user can create invoices. Only applicable to project managers. Defaults to false. CanCreateInvoices *bool `json:"can_create_invoices,omitempty"` // optional Whether the user is active or archived. Defaults to true. IsActive *bool `json:"is_active,omitempty"` // optional The number of hours per week this person is available to work in seconds. // Defaults to 126000 seconds (35 hours). WeeklyCapacity *int `json:"weekly_capacity,omitempty"` // optional The billable rate to use for this user when they are added to a project. Defaults to 0. DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // optional The cost rate to use for this user when calculating a project's costs vs billable amount. Defaults to 0. CostRate *float64 `json:"cost_rate,omitempty"` // of strings optional The role names assigned to this person. Roles []*string `json:"roles,omitempty"` }
type UserList ¶
type UserList struct { Users []*User `json:"users"` Pagination }
type UserListOptions ¶
type UserListOptions struct { // Pass true to only return active projects and false to return inactive projects. IsActive bool `url:"is_active,omitempty"` // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type UserProjectAssignment ¶
type UserProjectAssignment struct { // Unique ID for the project assignment. ID *int64 `json:"id,omitempty"` // Whether the project assignment is active or archived. IsActive *bool `json:"is_active,omitempty"` // Determines if the user has project manager permissions for the project. IsProjectManager *bool `json:"is_project_manager,omitempty"` // Rate used when the project’s bill_by is People. HourlyRate *float64 `json:"hourly_rate,omitempty"` // Budget used when the project’s budget_by is person. Budget *float64 `json:"budget,omitempty"` // Date and time the project assignment was created. CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the project assignment was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` // An object containing the assigned project id, name, and code. Project *Project `json:"project,omitempty"` // An object containing the project’s client id and name. Client *Client `json:"client,omitempty"` // Array of task assignment objects associated with the project. TaskAssignments *[]ProjectTaskAssignment `json:"task_assignments,omitempty"` }
func (UserProjectAssignment) String ¶
func (p UserProjectAssignment) String() string
type UserProjectAssignmentList ¶
type UserProjectAssignmentList struct { UserAssignments []*UserProjectAssignment `json:"project_assignments"` Pagination }
func (UserProjectAssignmentList) String ¶
func (p UserProjectAssignmentList) String() string
type UserProjectAssignmentListOptions ¶
type UserProjectAssignmentListOptions struct { // Only return projects that have been updated since the given date and time. UpdatedSince time.Time `url:"updated_since,omitempty"` ListOptions }
type UserService ¶
type UserService service
UserService handles communication with the user related methods of the Harvest API.
Harvest API docs: https://help.getharvest.com/api-v2/users-api/users/users/
func (*UserService) Create ¶
func (s *UserService) Create(ctx context.Context, data *UserCreateRequest) (*User, *http.Response, error)
Create creates a new user object.
func (*UserService) List ¶
func (s *UserService) List(ctx context.Context, opt *UserListOptions) (*UserList, *http.Response, error)
List returns a list of your users.
type UserUpdateRequest ¶
type UserUpdateRequest struct { // The first name of the user. Can't be updated if the user is inactive. FirstName *string `json:"first_name,omitempty"` // The last name of the user. Can't be updated if the user is inactive. LastName *string `json:"last_name,omitempty"` // The email address of the user. Can't be updated if the user is inactive. Email *string `json:"email,omitempty"` // The telephone number for the user. Telephone *string `json:"telephone,omitempty"` // The user's timezone. Defaults to the company's timezone. See a list of supported time zones. Timezone *string `json:"timezone,omitempty"` // Whether the user should be automatically added to future projects. HasAccessToAllFutureProjects *bool `json:"has_access_to_all_future_projects,omitempty"` // Whether the user is a contractor or an employee. IsContractor *bool `json:"is_contractor,omitempty"` // Whether the user has admin permissions. IsAdmin *bool `json:"is_admin,omitempty"` // Whether the user has project manager permissions. IsProjectManager *bool `json:"is_project_manager,omitempty"` // Whether the user can see billable rates on projects. Only applicable to project managers. CanSeeRates *bool `json:"can_see_rates,omitempty"` // Whether the user can create projects. Only applicable to project managers. CanCreateProjects *bool `json:"can_create_projects,omitempty"` // Whether the user can create invoices. Only applicable to project managers. CanCreateInvoices *bool `json:"can_create_invoices,omitempty"` // Whether the user is active or archived. IsActive *bool `json:"is_active,omitempty"` // The number of hours per week this person is available to work in seconds. WeeklyCapacity *int `json:"weekly_capacity,omitempty"` // The billable rate to use for this user when they are added to a project. DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // The cost rate to use for this user when calculating a project's costs vs billable amount. CostRate *float64 `json:"cost_rate,omitempty"` // of strings The role names assigned to this person. Roles []*string `json:"roles,omitempty"` }
Source Files ¶
- client.go
- client_contact.go
- company.go
- date.go
- estimate.go
- estimate_item_category.go
- estimate_message.go
- expense.go
- expense_category.go
- harvest.go
- invoice.go
- invoice_item_category.go
- invoice_message.go
- invoice_payment.go
- project.go
- project_task_assignment.go
- project_user_assignment.go
- role.go
- strings.go
- task.go
- time.go
- time_entry.go
- user.go
- user_project_assignment.go