Documentation ¶
Index ¶
- Constants
- func ContainsTaskID(taskID int64, tas []*TaskAssignment) bool
- func ContainsUserID(userID int64, uas []*UserAssignment) bool
- func HaveSameFloat64Value(a, b *float64) bool
- func TaskAssignmentAttributesDiffer(ta1, ta2 *TaskAssignment) bool
- func UserAssignmentAttributesDiffer(ua1, ua2 *UserAssignment) bool
- type API
- func (a *API) AddHeaders(req *http.Request)
- func (a *API) CopyTaskAssignments(destProjectID int64, sourceProjectID int64) error
- func (a *API) CopyUserAssignments(destProjectID int64, sourceProjectID int64) error
- func (a *API) CreateProject(p *Project, args Arguments) error
- func (a *API) CreateTaskAssignment(projectID int64, ta *TaskAssignment, args Arguments) error
- func (a *API) CreateUserAssignment(ua *UserAssignment, args Arguments) error
- func (a *API) Delete(path string, args Arguments) error
- func (a *API) DeleteProject(p *Project, args Arguments) error
- func (a *API) DeleteTaskAssignment(projectID int64, ta *TaskAssignment, args Arguments) error
- func (a *API) DeleteUserAssignment(ua *UserAssignment, args Arguments) error
- func (a *API) DuplicateProject(sourceProjectID int64, newName string) (*Project, error)
- func (a *API) Get(path string, args Arguments, target interface{}) error
- func (a *API) GetClient(clientID int64, args Arguments) (client *Client, err error)
- func (a *API) GetClientContacts(clientID int64, args Arguments) (contacts []*Contact, err error)
- func (a *API) GetClients(args Arguments) (clients []*Client, err error)
- func (a *API) GetContact(contactID int64, args Arguments) (contact *Contact, err error)
- func (a *API) GetContacts(args Arguments) (contacts []*Contact, err error)
- func (a *API) GetEstimate(estimateID int64, args Arguments) (estimate *Estimate, err error)
- func (a *API) GetEstimates(args Arguments) (estimates []*Estimate, err error)
- func (a *API) GetExpense(expenseID int64, args Arguments) (expense *Expense, err error)
- func (a *API) GetExpenseCategories(args Arguments) (expenseCategories []*ExpenseCategory, err error)
- func (a *API) GetExpenseCategory(expenseCategoryID int64, args Arguments) (expenseCategory *ExpenseCategory, err error)
- func (a *API) GetExpenses(args Arguments) (expenses []*Expense, err error)
- func (a *API) GetInvoice(invoiceID int64, args Arguments) (invoice *Invoice, err error)
- func (a *API) GetInvoiceMessage(invoiceID int64, messageID int64, args Arguments) (invoiceMessage *InvoiceMessage, err error)
- func (a *API) GetInvoiceMessages(invoiceID int64, args Arguments) (invoiceMessages []*InvoiceMessage, err error)
- func (a *API) GetInvoices(args Arguments) (invoices []*Invoice, err error)
- func (a *API) GetPaginated(path string, args Arguments, target Pageable, afterFetch func()) error
- func (a *API) GetProject(projectID int64, args Arguments) (project *Project, err error)
- func (a *API) GetProjects(args Arguments) (projects []*Project, err error)
- func (a *API) GetTask(taskID int64, args Arguments) (task *Task, err error)
- func (a *API) GetTaskAssignment(projectID int64, taskAssignmentID int64, args Arguments) (taskAssignment *TaskAssignment, err error)
- func (a *API) GetTaskAssignments(projectID int64, args Arguments) (taskAssignments []*TaskAssignment, err error)
- func (a *API) GetTasks(args Arguments) (tasks []*Task, err error)
- func (a *API) GetTimeEntries(args Arguments) ([]*TimeEntry, error)
- func (a *API) GetTimeEntriesBetween(fromDate time.Time, toDate time.Time, args Arguments) ([]*TimeEntry, error)
- func (a *API) GetTimeEntriesForProjectBetween(projectID int64, fromDate time.Time, toDate time.Time, args Arguments) ([]*TimeEntry, error)
- func (a *API) GetTimeEntriesForUserBetween(userID int64, fromDate time.Time, toDate time.Time, args Arguments) ([]*TimeEntry, error)
- func (a *API) GetTimeEntriesUpdatedSince(sinceDate time.Time, args Arguments) ([]*TimeEntry, error)
- func (a *API) GetUser(userID int64, args Arguments) (user *User, err error)
- func (a *API) GetUserAssignment(projectID int64, userAssignmentID int64, args Arguments) (userAssignment *UserAssignment, err error)
- func (a *API) GetUserAssignments(projectID int64, args Arguments) (userAssignments []*UserAssignment, err error)
- func (a *API) GetUsers(args Arguments) (users []*User, err error)
- func (a *API) Post(path string, args Arguments, postData interface{}, target interface{}) error
- func (a *API) Put(path string, args Arguments, postData interface{}, target interface{}) error
- func (a *API) SaveProject(p *Project, args Arguments) error
- func (a *API) UpdateProject(p *Project, args Arguments) error
- func (a *API) UpdateTaskAssignment(projectID int64, ta *TaskAssignment, args Arguments) error
- func (a *API) UpdateUserAssignment(ua *UserAssignment, args Arguments) error
- type Arguments
- type Client
- type ClientStub
- type ClientsResponse
- type Contact
- type ContactsResponse
- type Date
- type Estimate
- type EstimateLineItem
- type EstimatesResponse
- type Expense
- type ExpenseCategoriesResponse
- type ExpenseCategory
- type ExpensesResponse
- type Invoice
- type InvoiceMessage
- type InvoiceMessagesResponse
- type InvoicesResponse
- type LineItem
- type Pageable
- type PagedResponse
- type Project
- type ProjectStub
- type ProjectsResponse
- type Task
- type TaskAssignment
- type TaskAssignmentsResponse
- type TaskStub
- type TasksResponse
- type TimeEntriesResponse
- type TimeEntry
- type User
- type UserAssignment
- type UserAssignmentsResponse
- type UserStub
- type UsersResponse
Constants ¶
View Source
const CLIENT_VERSION = "1.0"
View Source
const HARVEST_API_VERSION = "v2"
View Source
const HARVEST_DOMAIN = "api.harvestapp.com"
Variables ¶
This section is empty.
Functions ¶
func ContainsTaskID ¶
func ContainsTaskID(taskID int64, tas []*TaskAssignment) bool
func ContainsUserID ¶
func ContainsUserID(userID int64, uas []*UserAssignment) bool
func HaveSameFloat64Value ¶
func TaskAssignmentAttributesDiffer ¶
func TaskAssignmentAttributesDiffer(ta1, ta2 *TaskAssignment) bool
func UserAssignmentAttributesDiffer ¶
func UserAssignmentAttributesDiffer(ua1, ua2 *UserAssignment) bool
Types ¶
type API ¶
type API struct { Logger logger BaseURL string AccountID string AccessToken string RefreshToken string UserAgent string // contains filtered or unexported fields }
func NewTokenAPI ¶
func (*API) AddHeaders ¶
Applies relevant User-Agent, Accept, Authorization headers
func (*API) CopyTaskAssignments ¶
func (*API) CopyUserAssignments ¶
func (*API) CreateTaskAssignment ¶
func (a *API) CreateTaskAssignment(projectID int64, ta *TaskAssignment, args Arguments) error
func (*API) CreateUserAssignment ¶
func (a *API) CreateUserAssignment(ua *UserAssignment, args Arguments) error
func (*API) DeleteTaskAssignment ¶
func (a *API) DeleteTaskAssignment(projectID int64, ta *TaskAssignment, args Arguments) error
func (*API) DeleteUserAssignment ¶
func (a *API) DeleteUserAssignment(ua *UserAssignment, args Arguments) error
func (*API) DuplicateProject ¶
func (*API) GetClientContacts ¶
func (*API) GetContact ¶
func (*API) GetContacts ¶
func (*API) GetEstimate ¶
func (*API) GetEstimates ¶
func (*API) GetExpense ¶
func (*API) GetExpenseCategories ¶
func (a *API) GetExpenseCategories(args Arguments) (expenseCategories []*ExpenseCategory, err error)
func (*API) GetExpenseCategory ¶
func (a *API) GetExpenseCategory(expenseCategoryID int64, args Arguments) (expenseCategory *ExpenseCategory, err error)
func (*API) GetExpenses ¶
func (*API) GetInvoice ¶
func (*API) GetInvoiceMessage ¶
func (*API) GetInvoiceMessages ¶
func (a *API) GetInvoiceMessages(invoiceID int64, args Arguments) (invoiceMessages []*InvoiceMessage, err error)
func (*API) GetInvoices ¶
func (*API) GetPaginated ¶
func (*API) GetProject ¶
func (*API) GetProjects ¶
func (*API) GetTaskAssignment ¶
func (*API) GetTaskAssignments ¶
func (a *API) GetTaskAssignments(projectID int64, args Arguments) (taskAssignments []*TaskAssignment, err error)
func (*API) GetTimeEntriesBetween ¶
func (*API) GetTimeEntriesForProjectBetween ¶
func (*API) GetTimeEntriesForUserBetween ¶
func (*API) GetTimeEntriesUpdatedSince ¶
func (*API) GetUserAssignment ¶
func (*API) GetUserAssignments ¶
func (a *API) GetUserAssignments(projectID int64, args Arguments) (userAssignments []*UserAssignment, err error)
func (*API) UpdateTaskAssignment ¶
func (a *API) UpdateTaskAssignment(projectID int64, ta *TaskAssignment, args Arguments) error
func (*API) UpdateUserAssignment ¶
func (a *API) UpdateUserAssignment(ua *UserAssignment, args Arguments) error
type Arguments ¶
func (Arguments) ToURLValues ¶
type ClientStub ¶
type ClientsResponse ¶
type ClientsResponse struct { PagedResponse Clients []*Client `json:"clients"` }
type Contact ¶
type Contact struct { ID int64 `json:"id"` Title string `json:"title"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` PhoneOffice string `json:"phone_office"` PhoneMobile string `json:"phone_mobile"` Fax string `json:"fax"` Client ClientStub `json:"client"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type ContactsResponse ¶
type ContactsResponse struct { PagedResponse Contacts []*Contact `json:"contacts"` }
type Estimate ¶
type Estimate struct { ID int64 `json:"id"` Subject string `json:"subject"` Client ClientStub `json:"client,omitempty"` Creator UserStub `json:"creator,omitempty"` ClientKey string `json:"client_key"` Number string `json:"number"` PurchaseOrder string `json:"purchase_order"` Amount float64 `json:"amount"` Tax *float64 `json:"tax"` TaxAmount float64 `json:"tax_amount"` Tax2 *float64 `json:"tax2"` Tax2Amount float64 `json:"tax2_amount"` Discount *float64 `json:"discount"` DiscountAmount float64 `json:"discount_amount"` Notes string `json:"notes"` Currency string `json:"currency"` IssueDate *Date `json:"issue_date,omitempty"` SentAt *time.Time `json:"sent_at,omitempty"` LineItems []*EstimateLineItem `json:"line_items"` AcceptedAt *time.Time `json:"accepted_at,omitempty"` DeclinedAt *time.Time `json:"declined_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type EstimateLineItem ¶
type EstimatesResponse ¶
type EstimatesResponse struct { PagedResponse Estimates []*Estimate `json:"estimates"` }
type Expense ¶
type Expense struct { ID int64 `json:"id"` Notes string `json:"notes"` TotalCost float64 `json:"total_cost"` Units float64 `json:"units"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ProjectID int64 `json:"project_id"` ExpenseCategoryID int64 `json:"expense_category_id"` UserID int64 `json:"user_id"` SpentAt string `json:"spent_at"` IsClosed bool `json:"is_closed"` InvoiceID int64 `json:"invoice_id"` Billable bool `json:"billable"` CompanyID int64 `json:"company_id"` HasReceipt bool `json:"has_receipt"` ReceiptURL string `json:"receipt_url"` IsLocked bool `json:"is_locked"` LockedReason string `json:"locked_reason"` }
type ExpenseCategoriesResponse ¶
type ExpenseCategoriesResponse struct { PagedResponse ExpenseCategories []*ExpenseCategory `json:"expense_categories"` }
type ExpenseCategory ¶
type ExpensesResponse ¶
type ExpensesResponse struct { PagedResponse Expenses []*Expense `json:"expenses"` }
type Invoice ¶
type Invoice struct { ID int64 `json:"id"` Client *ClientStub `json:"client,omitempty"` PeriodStart Date `json:"period_start"` PeriodEnd Date `json:"period_end"` Number string `json:"number"` IssueDate Date `json:"issue_date"` DueDate Date `json:"due_date"` Amount float64 `json:"amount"` Currency string `json:"currency"` State string `json:"state"` Notes string `json:"notes"` PurchaseOrder string `json:"purchase_order"` DueAmount float64 `json:"due_amount"` DueAtHumanFormat string `json:"due_at_human_format"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` SentAt time.Time `json:"sent_at"` PaidAt time.Time `json:"paid_at"` ClosedAt time.Time `json:"closed_at"` Tax float64 `json:"tax"` TaxAmount float64 `json:"tax_amount"` Subject string `json:"subject"` RecurringInvoiceID int64 `json:"recurring_invoice_id"` Tax2 float64 `json:"tax2"` Tax2Amount float64 `json:"tax2_amount"` ClientKey string `json:"client_key"` EstimateID int64 `json:"estimate_id"` Discount float64 `json:"discount"` DiscountAmount float64 `json:"discount_amount"` RetainerID int64 `json:"retainer_id"` CreatedByID int64 `json:"created_by_id"` LineItems []*LineItem `json:"line_items"` }
type InvoiceMessage ¶
type InvoiceMessage struct { ID int64 `json:"id"` InvoiceID int64 `json:"invoice_id"` SendMeACopy bool `json:"send_me_a_copy"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` SentBy string `json:"sent_by"` SentByEmail string `json:"sent_by_email"` ThankYou bool `json:"thank_you"` Subject string `json:"subject"` IncludePayPalLink bool `json:"include_pay_pal_link"` UpdatedAt time.Time `json:"updated_at"` SentFromEmail string `json:"sent_from_email"` SentFrom string `json:"sent_from"` SendReminderOn Date `json:"send_reminder_on"` FullRecipientList string `json:"full_recipient_list"` }
type InvoiceMessagesResponse ¶
type InvoiceMessagesResponse struct { PagedResponse InvoiceMessages []*InvoiceMessage `json:"invoice_messages"` }
type InvoicesResponse ¶
type InvoicesResponse struct { PagedResponse Invoices []*Invoice `json:"invoices"` }
type LineItem ¶
type LineItem struct { ID int64 `json:"id"` Kind string `json:"kind"` Description string `json:"description"` Quantity float64 `json:"quantity"` UnitPrice float64 `json:"unit_price"` Amount float64 `json:"amount"` Taxed bool `json:"taxed"` Taxed2 bool `json:"taxed2"` Project *ProjectStub `json:"project"` }
type PagedResponse ¶
type PagedResponse struct { PerPage int64 `json:"per_page"` TotalPages int64 `json:"total_pages"` TotalEntries int64 `json:"total_entries"` NextPage *int64 `json:"next_page"` PreviousPage *int64 `json:"previous_page"` Page int64 `json:"page"` }
func (*PagedResponse) HasNextPage ¶
func (r *PagedResponse) HasNextPage() bool
type Project ¶
type Project struct { ID int64 `json:"id,omitempty"` ClientID int64 `json:"client_id,omitempty"` Client *ClientStub `json:"client,omitempty"` Name string `json:"name,omitempty"` Code string `json:"code,omitempty"` IsActive bool `json:"is_active"` IsBillable bool `json:"is_billable"` BillBy string `json:"bill_by,omitempty"` HourlyRate *float64 `json:"hourly_rate,omitempty"` BudgetBy string `json:"budget_by,omitempty"` Budget *float64 `json:"budget,omitempty"` NotifyWhenOverBudget bool `json:"notify_when_over_budget"` OverBudgetNotificationPercentage float64 `json:"over_budget_notification_percentage,omitempty"` OverBudgetNotifiedAt *Date `json:"over_budget_notified_at,omitempty"` ShowBudgetToAll bool `json:"show_budget_to_all"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` StartsOn Date `json:"starts_on,omitempty"` EndsOn Date `json:"ends_on,omitempty"` Estimate *float64 `json:"estimate,omitempty"` EstimateBy string `json:"estimate_by,omitempty"` HintEarliestRecordAt Date `json:"hint_earliest_record_at,omitempty"` HintLatestRecordAt Date `json:"hint_latest_record_at,omitempty"` Notes string `json:"notes,omitempty"` CostBudget *float64 `json:"cost_budget,omitempty"` CostBudgetIncludeExpenses bool `json:"cost_budget_include_expenses"` }
type ProjectStub ¶
type ProjectsResponse ¶
type ProjectsResponse struct { PagedResponse Projects []*Project `json:"projects"` }
type Task ¶
type Task struct { ID int64 `json:"id"` Name string `json:"name"` BillableByDefault bool `json:"billable_by_default"` Deactivated bool `json:"deactivated"` DefaultHourlyRate float64 `json:"default_hourly_rate"` IsDefault bool `json:"is_default"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type TaskAssignment ¶
type TaskAssignment struct { ID int64 `json:"id,omitempty"` Task TaskStub `json:"task,omitempty"` Billable bool `json:"billable"` IsActive bool `json:"is_active"` Budget *float64 `json:"budget"` HourlyRate *float64 `json:"hourly_rate"` UpdatedAt time.Time `json:"updated_at"` CreatedAt time.Time `json:"created_at"` }
type TaskAssignmentsResponse ¶
type TaskAssignmentsResponse struct { TaskAssignments []*TaskAssignment `json:"task_assignments"` PerPage int64 `json:"per_page"` TotalPages int64 `json:"total_pages"` TotalEntries int64 `json:"total_entries"` NextPage *int64 `json:"next_page"` PreviousPage *int64 `json:"previous_page"` Page int64 `json:"page"` }
type TasksResponse ¶
type TasksResponse struct { PagedResponse Tasks []*Task `json:"tasks"` }
type TimeEntriesResponse ¶
type TimeEntriesResponse struct { PagedResponse TimeEntries []*TimeEntry `json:"time_entries"` }
type TimeEntry ¶
type TimeEntry struct { ID int64 `json:"id"` SpentDate Date `json:"spent_date"` User *UserStub `json:"user,omitempty"` Client *ClientStub `json:"client,omitempty"` Project *ProjectStub `json:"project,omitempty"` Task *TaskStub `json:"task,omitempty"` HoursWithTimer float64 `json:"hours_with_timer"` Hours float64 `json:"hours"` Notes string `json:"notes"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` IsLocked bool `json:"is_locked"` LockedReason string `json:"locked_reason"` IsClosed bool `json:"is_closed"` IsBilled bool `json:"is_billed"` TimerStartedAt *time.Time `json:"timer_started_at"` StartedTime string `json:"started_time"` EndedTime string `json:"ended_time"` IsRunning bool `json:"is_running"` IsBillable bool `json:"billable"` IsBudgeted bool `json:"budgeted"` BillableRate float64 `json:"billable_rate"` CostRate float64 `json:"cost_rate"` }
type User ¶
type User struct { ID int64 `json:"id"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` IsAdmin bool `json:"is_admin"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Timezone string `json:"timezone"` IsContractor bool `json:"is_contractor"` Telephone string `json:"telephone"` IsActive bool `json:"is_active"` HasAccessToAllFutureProjects bool `json:"has_access_to_all_future_projects"` DefaultHourlyRate float64 `json:"default_hourly_rate"` Department string `json:"department"` WantsNewsletter bool `json:"wants_newsletter"` UpdatedAt time.Time `json:"updated_at"` CostRate float64 `json:"cost_rate"` WeeklyCapacity int64 `json:"weekly_capacity"` IdentityAccountID int64 `json:"identity_account_id"` IdentityUserID int64 `json:"identity_user_id"` }
type UserAssignment ¶
type UserAssignment struct { ID int64 `json:"id,omitempty"` UserID int64 `json:"user_id"` ProjectID int64 `json:"project_id"` Deactivated bool `json:"deactivated"` HourlyRate *float64 `json:"hourly_rate"` IsProjectManager bool `json:"is_project_manager"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Estimate float64 `json:"estimate"` }
type UserAssignmentsResponse ¶
type UserAssignmentsResponse struct { UserAssignments []*UserAssignment `json:"user_assignments"` PerPage int64 `json:"per_page"` TotalPages int64 `json:"total_pages"` TotalEntries int64 `json:"total_entries"` NextPage *int64 `json:"next_page"` PreviousPage *int64 `json:"previous_page"` Page int64 `json:"page"` }
type UsersResponse ¶
type UsersResponse struct { PagedResponse Users []*User `json:"users"` }
Click to show internal directories.
Click to hide internal directories.