Documentation
¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- func Create[T any](ctx context.Context, c *API, path string, body any) (*T, error)
- func Delete(ctx context.Context, c *API, path string) error
- func Get[T any](ctx context.Context, c *API, path string) (*T, error)
- func List[T any](ctx context.Context, c *API, path string, opts *ListOptions) ([]T, error)
- func Update[T any](ctx context.Context, c *API, path string, body any) (*T, error)
- type API
- type Client
- type ClientCreateRequest
- type ClientList
- type ClientListOptions
- type ClientUpdateRequest
- type ClientsService
- func (s *ClientsService) Create(ctx context.Context, client *ClientCreateRequest) (*Client, error)
- func (s *ClientsService) Delete(ctx context.Context, clientID int64) error
- func (s *ClientsService) Get(ctx context.Context, clientID int64) (*Client, error)
- func (s *ClientsService) List(ctx context.Context, opts *ClientListOptions) ([]Client, error)
- func (s *ClientsService) ListPage(ctx context.Context, opts *ClientListOptions) (*ClientList, error)
- func (s *ClientsService) Update(ctx context.Context, clientID int64, client *ClientUpdateRequest) (*Client, error)
- type Company
- type CompanyService
- type Contact
- type ContactCreateRequest
- type ContactList
- type ContactListOptions
- type ContactUpdateRequest
- type ContactsService
- func (s *ContactsService) Create(ctx context.Context, contact *ContactCreateRequest) (*Contact, error)
- func (s *ContactsService) Delete(ctx context.Context, contactID int64) error
- func (s *ContactsService) Get(ctx context.Context, contactID int64) (*Contact, error)
- func (s *ContactsService) List(ctx context.Context, opts *ContactListOptions) ([]Contact, error)
- func (s *ContactsService) ListPage(ctx context.Context, opts *ContactListOptions) (*ContactList, error)
- func (s *ContactsService) Update(ctx context.Context, contactID int64, contact *ContactUpdateRequest) (*Contact, error)
- type Date
- type EffectiveWorkSchedule
- type ErrorResponse
- type Estimate
- type EstimateCreateRequest
- type EstimateItem
- type EstimateItemCategory
- type EstimateItemCategoryCreateRequest
- type EstimateItemCategoryList
- type EstimateItemCategoryListOptions
- type EstimateItemCategoryUpdateRequest
- type EstimateLineItemRequest
- type EstimateList
- type EstimateListOptions
- type EstimateUpdateRequest
- type EstimatesService
- func (s *EstimatesService) Create(ctx context.Context, estimate *EstimateCreateRequest) (*Estimate, error)
- func (s *EstimatesService) CreateItemCategory(ctx context.Context, category *EstimateItemCategoryCreateRequest) (*EstimateItemCategory, error)
- func (s *EstimatesService) Delete(ctx context.Context, estimateID int64) error
- func (s *EstimatesService) DeleteItemCategory(ctx context.Context, categoryID int64) error
- func (s *EstimatesService) Get(ctx context.Context, estimateID int64) (*Estimate, error)
- func (s *EstimatesService) GetItemCategory(ctx context.Context, categoryID int64) (*EstimateItemCategory, error)
- func (s *EstimatesService) List(ctx context.Context, opts *EstimateListOptions) ([]Estimate, error)
- func (s *EstimatesService) ListItemCategories(ctx context.Context, opts *EstimateItemCategoryListOptions) ([]EstimateItemCategory, error)
- func (s *EstimatesService) ListItemCategoriesPage(ctx context.Context, opts *EstimateItemCategoryListOptions) (*EstimateItemCategoryList, error)
- func (s *EstimatesService) ListPage(ctx context.Context, opts *EstimateListOptions) (*EstimateList, error)
- func (s *EstimatesService) MarkAsAccepted(ctx context.Context, estimateID int64) (*Estimate, error)
- func (s *EstimatesService) MarkAsDeclined(ctx context.Context, estimateID int64) (*Estimate, error)
- func (s *EstimatesService) MarkAsSent(ctx context.Context, estimateID int64) (*Estimate, error)
- func (s *EstimatesService) Reopen(ctx context.Context, estimateID int64) (*Estimate, error)
- func (s *EstimatesService) Update(ctx context.Context, estimateID int64, estimate *EstimateUpdateRequest) (*Estimate, error)
- func (s *EstimatesService) UpdateItemCategory(ctx context.Context, categoryID int64, ...) (*EstimateItemCategory, error)
- type Expense
- type ExpenseCategory
- type ExpenseCategoryCreateRequest
- type ExpenseCategoryList
- type ExpenseCategoryListOptions
- type ExpenseCategoryUpdateRequest
- type ExpenseCreateRequest
- type ExpenseList
- type ExpenseListOptions
- type ExpenseReport
- type ExpenseReportResults
- type ExpenseReportsOptions
- type ExpenseUpdateRequest
- type ExpensesService
- func (s *ExpensesService) Create(ctx context.Context, expense *ExpenseCreateRequest) (*Expense, error)
- func (s *ExpensesService) CreateCategory(ctx context.Context, category *ExpenseCategoryCreateRequest) (*ExpenseCategory, error)
- func (s *ExpensesService) Delete(ctx context.Context, expenseID int64) error
- func (s *ExpensesService) DeleteCategory(ctx context.Context, categoryID int64) error
- func (s *ExpensesService) Get(ctx context.Context, expenseID int64) (*Expense, error)
- func (s *ExpensesService) GetCategory(ctx context.Context, categoryID int64) (*ExpenseCategory, error)
- func (s *ExpensesService) List(ctx context.Context, opts *ExpenseListOptions) ([]Expense, error)
- func (s *ExpensesService) ListCategories(ctx context.Context, opts *ExpenseCategoryListOptions) ([]ExpenseCategory, error)
- func (s *ExpensesService) ListCategoriesPage(ctx context.Context, opts *ExpenseCategoryListOptions) (*ExpenseCategoryList, error)
- func (s *ExpensesService) ListPage(ctx context.Context, opts *ExpenseListOptions) (*ExpenseList, error)
- func (s *ExpensesService) Update(ctx context.Context, expenseID int64, expense *ExpenseUpdateRequest) (*Expense, error)
- func (s *ExpensesService) UpdateCategory(ctx context.Context, categoryID int64, category *ExpenseCategoryUpdateRequest) (*ExpenseCategory, error)
- type ExternalReference
- type ExternalReferenceRequest
- type HolidayCalendar
- type HolidayCalendarEntry
- type IDName
- type Invoice
- type InvoiceCreateRequest
- type InvoiceItem
- type InvoiceItemCategory
- type InvoiceItemCategoryCreateRequest
- type InvoiceItemCategoryList
- type InvoiceItemCategoryListOptions
- type InvoiceItemCategoryUpdateRequest
- type InvoiceLineItemRequest
- type InvoiceList
- type InvoiceListOptions
- type InvoiceMessage
- type InvoiceMessageList
- type InvoiceMessageListOptions
- type InvoiceMessageRecipient
- type InvoiceMessageRequest
- type InvoicePayment
- type InvoicePaymentListOptions
- type InvoiceUpdateRequest
- type InvoicesService
- func (s *InvoicesService) Create(ctx context.Context, invoice *InvoiceCreateRequest) (*Invoice, error)
- func (s *InvoicesService) CreateItemCategory(ctx context.Context, category *InvoiceItemCategoryCreateRequest) (*InvoiceItemCategory, error)
- func (s *InvoicesService) Delete(ctx context.Context, invoiceID int64) error
- func (s *InvoicesService) DeleteItemCategory(ctx context.Context, categoryID int64) error
- func (s *InvoicesService) Get(ctx context.Context, invoiceID int64) (*Invoice, error)
- func (s *InvoicesService) GetItemCategory(ctx context.Context, categoryID int64) (*InvoiceItemCategory, error)
- func (s *InvoicesService) List(ctx context.Context, opts *InvoiceListOptions) ([]Invoice, error)
- func (s *InvoicesService) ListItemCategories(ctx context.Context, opts *InvoiceItemCategoryListOptions) ([]InvoiceItemCategory, error)
- func (s *InvoicesService) ListItemCategoriesPage(ctx context.Context, opts *InvoiceItemCategoryListOptions) (*InvoiceItemCategoryList, error)
- func (s *InvoicesService) ListMessages(ctx context.Context, invoiceID int64, opts *InvoiceMessageListOptions) ([]InvoiceMessage, error)
- func (s *InvoicesService) ListMessagesPage(ctx context.Context, invoiceID int64, opts *InvoiceMessageListOptions) (*InvoiceMessageList, error)
- func (s *InvoicesService) ListPage(ctx context.Context, opts *InvoiceListOptions) (*InvoiceList, error)
- func (s *InvoicesService) ListPayments(ctx context.Context, invoiceID int64, opts *InvoicePaymentListOptions) ([]InvoicePayment, error)
- func (s *InvoicesService) MarkAsClosed(ctx context.Context, invoiceID int64) (*Invoice, error)
- func (s *InvoicesService) MarkAsDraft(ctx context.Context, invoiceID int64) (*InvoiceMessage, error)
- func (s *InvoicesService) MarkAsSent(ctx context.Context, invoiceID int64) (*InvoiceMessage, error)
- func (s *InvoicesService) Reopen(ctx context.Context, invoiceID int64) (*Invoice, error)
- func (s *InvoicesService) Update(ctx context.Context, invoiceID int64, invoice *InvoiceUpdateRequest) (*Invoice, error)
- func (s *InvoicesService) UpdateItemCategory(ctx context.Context, categoryID int64, ...) (*InvoiceItemCategory, error)
- type Iterator
- type ListOptions
- type PTOAllocation
- type PTOAllocationListOptions
- type PTOAssignment
- type PTOAssignmentListOptions
- type PTOBalance
- type PTOBalanceOptions
- type PTOBalances
- type PTORequest
- type PTORequestDay
- type PTORequestListOptions
- type PTOService
- func (s *PTOService) GetBalances(ctx context.Context, opts *PTOBalanceOptions) (*PTOBalances, error)
- func (s *PTOService) ListAllocations(ctx context.Context, opts *PTOAllocationListOptions) ([]PTOAllocation, error)
- func (s *PTOService) ListAssignments(ctx context.Context, opts *PTOAssignmentListOptions) ([]PTOAssignment, error)
- func (s *PTOService) ListHolidayCalendarEntries(ctx context.Context, calendarID int64, opts *ListOptions) ([]HolidayCalendarEntry, error)
- func (s *PTOService) ListHolidayCalendars(ctx context.Context, opts *ListOptions) ([]HolidayCalendar, error)
- func (s *PTOService) ListRequests(ctx context.Context, opts *PTORequestListOptions) ([]PTORequest, error)
- func (s *PTOService) ListTypes(ctx context.Context, opts *PTOTypeListOptions) ([]PTOType, error)
- func (s *PTOService) ListWorkSchedules(ctx context.Context, opts *WorkScheduleListOptions) ([]WorkSchedule, error)
- type PTOType
- type PTOTypeListOptions
- type PTOTypeRef
- type Paginated
- type PaginationLinks
- type PaymentGateway
- type Project
- type ProjectBudgetReport
- type ProjectBudgetReportOptions
- type ProjectBudgetReportResults
- type ProjectCreateRequest
- type ProjectList
- type ProjectListOptions
- type ProjectTaskAssignment
- type ProjectUpdateRequest
- type ProjectUserAssignment
- type ProjectsService
- func (s *ProjectsService) Create(ctx context.Context, project *ProjectCreateRequest) (*Project, error)
- func (s *ProjectsService) CreateTaskAssignment(ctx context.Context, projectID int64, assignment *TaskAssignmentCreateRequest) (*ProjectTaskAssignment, error)
- func (s *ProjectsService) CreateUserAssignment(ctx context.Context, projectID int64, assignment *UserAssignmentCreateRequest) (*ProjectUserAssignment, error)
- func (s *ProjectsService) Delete(ctx context.Context, projectID int64) error
- func (s *ProjectsService) DeleteTaskAssignment(ctx context.Context, projectID, taskAssignmentID int64) error
- func (s *ProjectsService) DeleteUserAssignment(ctx context.Context, projectID, userAssignmentID int64) error
- func (s *ProjectsService) Get(ctx context.Context, projectID int64) (*Project, error)
- func (s *ProjectsService) GetTaskAssignment(ctx context.Context, projectID, taskAssignmentID int64) (*ProjectTaskAssignment, error)
- func (s *ProjectsService) GetUserAssignment(ctx context.Context, projectID, userAssignmentID int64) (*ProjectUserAssignment, error)
- func (s *ProjectsService) List(ctx context.Context, opts *ProjectListOptions) ([]Project, error)
- func (s *ProjectsService) ListAllTaskAssignments(ctx context.Context, opts *TaskAssignmentListOptions) ([]ProjectTaskAssignment, error)
- func (s *ProjectsService) ListAllUserAssignments(ctx context.Context, opts *UserAssignmentListOptions) ([]ProjectUserAssignment, error)
- func (s *ProjectsService) ListPage(ctx context.Context, opts *ProjectListOptions) (*ProjectList, error)
- func (s *ProjectsService) ListTaskAssignments(ctx context.Context, projectID int64, opts *TaskAssignmentListOptions) ([]ProjectTaskAssignment, error)
- func (s *ProjectsService) ListTaskAssignmentsPage(ctx context.Context, projectID int64, opts *TaskAssignmentListOptions) (*TaskAssignmentList, error)
- func (s *ProjectsService) ListUserAssignments(ctx context.Context, projectID int64, opts *UserAssignmentListOptions) ([]ProjectUserAssignment, error)
- func (s *ProjectsService) ListUserAssignmentsPage(ctx context.Context, projectID int64, opts *UserAssignmentListOptions) (*UserAssignmentList, error)
- func (s *ProjectsService) Update(ctx context.Context, projectID int64, project *ProjectUpdateRequest) (*Project, error)
- func (s *ProjectsService) UpdateTaskAssignment(ctx context.Context, projectID, taskAssignmentID int64, ...) (*ProjectTaskAssignment, error)
- func (s *ProjectsService) UpdateUserAssignment(ctx context.Context, projectID, userAssignmentID int64, ...) (*ProjectUserAssignment, error)
- type Rate
- type RateLimitError
- type RawItem
- type Receipt
- type ReportsService
- func (s *ReportsService) ExpenseReports(ctx context.Context, opts *ExpenseReportsOptions) (*ExpenseReportResults, error)
- func (s *ReportsService) ProjectBudgetReports(ctx context.Context, opts *ProjectBudgetReportOptions) (*ProjectBudgetReportResults, error)
- func (s *ReportsService) TimeReports(ctx context.Context, opts *TimeReportsOptions) (*TimeReportResults, error)
- func (s *ReportsService) UninvoicedReports(ctx context.Context, opts *UninvoicedReportOptions) (*UninvoicedReportResults, error)
- type RestartRequest
- type Role
- type RoleCreateRequest
- type RoleList
- type RoleListOptions
- type RoleUpdateRequest
- type RolesService
- func (s *RolesService) Create(ctx context.Context, role *RoleCreateRequest) (*Role, error)
- func (s *RolesService) Delete(ctx context.Context, roleID int64) error
- func (s *RolesService) Get(ctx context.Context, roleID int64) (*Role, error)
- func (s *RolesService) List(ctx context.Context, opts *RoleListOptions) ([]Role, error)
- func (s *RolesService) ListPage(ctx context.Context, opts *RoleListOptions) (*RoleList, error)
- func (s *RolesService) Update(ctx context.Context, roleID int64, role *RoleUpdateRequest) (*Role, error)
- type Task
- type TaskAssignmentCreateRequest
- type TaskAssignmentList
- type TaskAssignmentListOptions
- type TaskAssignmentUpdateRequest
- type TaskCreateRequest
- type TaskList
- type TaskListOptions
- type TaskUpdateRequest
- type TasksService
- func (s *TasksService) Create(ctx context.Context, task *TaskCreateRequest) (*Task, error)
- func (s *TasksService) Delete(ctx context.Context, taskID int64) error
- func (s *TasksService) Get(ctx context.Context, taskID int64) (*Task, error)
- func (s *TasksService) List(ctx context.Context, opts *TaskListOptions) ([]Task, error)
- func (s *TasksService) ListPage(ctx context.Context, opts *TaskListOptions) (*TaskList, error)
- func (s *TasksService) Update(ctx context.Context, taskID int64, task *TaskUpdateRequest) (*Task, error)
- type Teammate
- type TimeEntriesService
- func (s *TimeEntriesService) CreateViaDuration(ctx context.Context, entry *TimeEntryCreateViaDurationRequest) (*TimeEntry, error)
- func (s *TimeEntriesService) CreateViaStartEnd(ctx context.Context, entry *TimeEntryCreateViaStartEndRequest) (*TimeEntry, error)
- func (s *TimeEntriesService) Delete(ctx context.Context, timeEntryID int64) error
- func (s *TimeEntriesService) DeleteExternalReference(ctx context.Context, timeEntryID int64) error
- func (s *TimeEntriesService) Get(ctx context.Context, timeEntryID int64) (*TimeEntry, error)
- func (s *TimeEntriesService) List(ctx context.Context, opts *TimeEntryListOptions) ([]TimeEntry, error)
- func (s *TimeEntriesService) ListPage(ctx context.Context, opts *TimeEntryListOptions) (*TimeEntryList, error)
- func (s *TimeEntriesService) Restart(ctx context.Context, timeEntryID int64) (*TimeEntry, error)
- func (s *TimeEntriesService) Stop(ctx context.Context, timeEntryID int64) (*TimeEntry, error)
- func (s *TimeEntriesService) Update(ctx context.Context, timeEntryID int64, entry *TimeEntryUpdateRequest) (*TimeEntry, error)
- type TimeEntry
- type TimeEntryCreateViaDurationRequest
- type TimeEntryCreateViaStartEndRequest
- type TimeEntryList
- type TimeEntryListOptions
- type TimeEntryUpdateRequest
- type TimeReport
- type TimeReportResults
- type TimeReportsOptions
- type Timestamp
- type UninvoicedReport
- type UninvoicedReportOptions
- type UninvoicedReportResults
- type User
- type UserAssignmentCreateRequest
- type UserAssignmentList
- type UserAssignmentListOptions
- type UserAssignmentUpdateRequest
- type UserBillableRate
- type UserCostRate
- type UserCreateRequest
- type UserList
- type UserListOptions
- type UserProjectAssignmentList
- type UserProjectAssignmentListOptions
- type UserUpdateRequest
- type UsersService
- func (s *UsersService) Create(ctx context.Context, user *UserCreateRequest) (*User, error)
- func (s *UsersService) Delete(ctx context.Context, userID int64) error
- func (s *UsersService) Get(ctx context.Context, userID int64) (*User, error)
- func (s *UsersService) List(ctx context.Context, opts *UserListOptions) ([]User, error)
- func (s *UsersService) ListBillableRates(ctx context.Context, userID int64, opts *ListOptions) ([]UserBillableRate, error)
- func (s *UsersService) ListCostRates(ctx context.Context, userID int64, opts *ListOptions) ([]UserCostRate, error)
- func (s *UsersService) ListMyProjectAssignments(ctx context.Context, opts *UserProjectAssignmentListOptions) ([]ProjectUserAssignment, error)
- func (s *UsersService) ListMyProjectAssignmentsPage(ctx context.Context, opts *UserProjectAssignmentListOptions) (*UserProjectAssignmentList, error)
- func (s *UsersService) ListPage(ctx context.Context, opts *UserListOptions) (*UserList, error)
- func (s *UsersService) ListProjectAssignments(ctx context.Context, userID int64, opts *UserProjectAssignmentListOptions) ([]ProjectUserAssignment, error)
- func (s *UsersService) ListProjectAssignmentsPage(ctx context.Context, userID int64, opts *UserProjectAssignmentListOptions) (*UserProjectAssignmentList, error)
- func (s *UsersService) ListTeammates(ctx context.Context, userID int64, opts *ListOptions) ([]Teammate, error)
- func (s *UsersService) Me(ctx context.Context) (*User, error)
- func (s *UsersService) Update(ctx context.Context, userID int64, user *UserUpdateRequest) (*User, error)
- type WorkSchedule
- type WorkScheduleListOptions
Constants ¶
const (
// DefaultPerPage is the default number of items to request per page for list operations.
DefaultPerPage = 2000
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors.
Types ¶
type API ¶
type API struct {
// Service endpoints
Company *CompanyService
Clients *ClientsService
Contacts *ContactsService
Projects *ProjectsService
TimeEntries *TimeEntriesService
Users *UsersService
Tasks *TasksService
Invoices *InvoicesService
Estimates *EstimatesService
Expenses *ExpensesService
Reports *ReportsService
Roles *RolesService
PTO *PTOService
// contains filtered or unexported fields
}
func New ¶
New creates a new Harvest API client with the given User-Agent. It reads HARVEST_ACCESS_TOKEN and HARVEST_ACCOUNT_ID from environment variables.
func NewWithConfig ¶
NewWithConfig creates a new Harvest API client with custom configuration.
type Client ¶
type Client struct {
ID int64 `json:"id"`
Name string `json:"name"`
IsActive bool `json:"is_active"`
Address string `json:"address,omitempty"`
Currency string `json:"currency,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Client represents a client in Harvest.
type ClientCreateRequest ¶
type ClientCreateRequest struct {
Name string `json:"name"`
IsActive *bool `json:"is_active,omitempty"`
Address string `json:"address,omitempty"`
Currency string `json:"currency,omitempty"`
}
ClientCreateRequest represents a request to create a client.
type ClientList ¶
ClientList represents a list of clients.
type ClientListOptions ¶
type ClientListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
ClientListOptions specifies optional parameters to the List method.
type ClientUpdateRequest ¶
type ClientUpdateRequest struct {
Name string `json:"name,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
Address string `json:"address,omitempty"`
Currency string `json:"currency,omitempty"`
}
ClientUpdateRequest represents a request to update a client.
type ClientsService ¶
type ClientsService struct {
// contains filtered or unexported fields
}
ClientsService handles communication with the client related methods of the Harvest API.
func (*ClientsService) Create ¶
func (s *ClientsService) Create(ctx context.Context, client *ClientCreateRequest) (*Client, error)
Create creates a new client.
func (*ClientsService) Delete ¶
func (s *ClientsService) Delete(ctx context.Context, clientID int64) error
Delete deletes a client.
func (*ClientsService) List ¶
func (s *ClientsService) List(ctx context.Context, opts *ClientListOptions) ([]Client, error)
List returns all clients across all pages.
func (*ClientsService) ListPage ¶ added in v0.1.1
func (s *ClientsService) ListPage(ctx context.Context, opts *ClientListOptions) (*ClientList, error)
ListPage returns a single page of clients.
func (*ClientsService) Update ¶
func (s *ClientsService) Update(ctx context.Context, clientID int64, client *ClientUpdateRequest) (*Client, error)
Update updates a client.
type Company ¶
type Company struct {
BaseURI string `json:"base_uri"`
FullDomain string `json:"full_domain"`
Name string `json:"name"`
IsActive bool `json:"is_active"`
WeekStartDay string `json:"week_start_day"`
WantsTimestampTimers bool `json:"wants_timestamp_timers"`
TimeFormat string `json:"time_format"`
DateFormat string `json:"date_format"`
PlanType string `json:"plan_type"`
Clock string `json:"clock"`
DecimalSymbol string `json:"decimal_symbol"`
ThousandsSeparator string `json:"thousands_separator"`
ColorScheme string `json:"color_scheme"`
WeeklyCapacity int `json:"weekly_capacity"`
ExpenseFeature bool `json:"expense_feature"`
InvoiceFeature bool `json:"invoice_feature"`
EstimateFeature bool `json:"estimate_feature"`
ApprovalFeature bool `json:"approval_feature"`
}
Company represents a company in Harvest.
type CompanyService ¶
type CompanyService struct {
// contains filtered or unexported fields
}
CompanyService handles communication with the company related methods of the Harvest API.
type Contact ¶
type Contact struct {
ID int64 `json:"id"`
ClientID int64 `json:"client_id"`
Client *Client `json:"client,omitempty"`
Title string `json:"title,omitempty"`
FirstName string `json:"first_name"`
LastName string `json:"last_name,omitempty"`
Email string `json:"email,omitempty"`
PhoneOffice string `json:"phone_office,omitempty"`
PhoneMobile string `json:"phone_mobile,omitempty"`
Fax string `json:"fax,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Contact represents a client contact in Harvest.
type ContactCreateRequest ¶
type ContactCreateRequest struct {
ClientID int64 `json:"client_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name,omitempty"`
Title string `json:"title,omitempty"`
Email string `json:"email,omitempty"`
PhoneOffice string `json:"phone_office,omitempty"`
PhoneMobile string `json:"phone_mobile,omitempty"`
Fax string `json:"fax,omitempty"`
}
ContactCreateRequest represents a request to create a contact.
type ContactList ¶
ContactList represents a list of contacts.
type ContactListOptions ¶
type ContactListOptions struct {
ListOptions
ClientID int64 `url:"client_id,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
ContactListOptions specifies optional parameters to the List method.
type ContactUpdateRequest ¶
type ContactUpdateRequest struct {
ClientID int64 `json:"client_id,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Title string `json:"title,omitempty"`
Email string `json:"email,omitempty"`
PhoneOffice string `json:"phone_office,omitempty"`
PhoneMobile string `json:"phone_mobile,omitempty"`
Fax string `json:"fax,omitempty"`
}
ContactUpdateRequest represents a request to update a contact.
type ContactsService ¶
type ContactsService struct {
// contains filtered or unexported fields
}
ContactsService handles communication with the contact related methods of the Harvest API.
func (*ContactsService) Create ¶
func (s *ContactsService) Create(ctx context.Context, contact *ContactCreateRequest) (*Contact, error)
CreateContact creates a new contact.
func (*ContactsService) Delete ¶
func (s *ContactsService) Delete(ctx context.Context, contactID int64) error
DeleteContact deletes a contact.
func (*ContactsService) List ¶
func (s *ContactsService) List(ctx context.Context, opts *ContactListOptions) ([]Contact, error)
List returns all contacts across all pages.
func (*ContactsService) ListPage ¶ added in v0.1.1
func (s *ContactsService) ListPage(ctx context.Context, opts *ContactListOptions) (*ContactList, error)
ListPage returns a single page of contacts.
func (*ContactsService) Update ¶
func (s *ContactsService) Update(ctx context.Context, contactID int64, contact *ContactUpdateRequest) (*Contact, error)
UpdateContact updates a contact.
type Date ¶
Date represents a date in YYYY-MM-DD format.
func (Date) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Date.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Date.
type EffectiveWorkSchedule ¶ added in v0.1.2
type EffectiveWorkSchedule struct {
Name string `json:"name"`
WeeklyHours decimal.Decimal `json:"weekly_hours"`
}
EffectiveWorkSchedule is the schedule actually applied to a user.
type ErrorResponse ¶
type ErrorResponse struct {
Response *http.Response
Message string `json:"error"`
Errors []struct {
Field string `json:"field"`
Message string `json:"message"`
} `json:"error_description,omitempty"`
}
ErrorResponse represents an error response from the Harvest API.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Estimate ¶
type Estimate struct {
ID int64 `json:"id"`
Client *Client `json:"client"`
ClientKey string `json:"client_key,omitempty"`
Creator *IDName `json:"creator,omitempty"`
LineItems []EstimateItem `json:"line_items"`
Number string `json:"number"`
PurchaseOrder string `json:"purchase_order,omitempty"`
Amount decimal.Decimal `json:"amount"`
Tax *decimal.Decimal `json:"tax,omitempty"`
TaxAmount *decimal.Decimal `json:"tax_amount,omitempty"`
Tax2 *decimal.Decimal `json:"tax2,omitempty"`
Tax2Amount *decimal.Decimal `json:"tax2_amount,omitempty"`
Discount *decimal.Decimal `json:"discount,omitempty"`
DiscountAmount *decimal.Decimal `json:"discount_amount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency"`
State string `json:"state"`
IssueDate Date `json:"issue_date"`
SentAt *time.Time `json:"sent_at,omitempty"`
AcceptedAt *time.Time `json:"accepted_at,omitempty"`
DeclinedAt *time.Time `json:"declined_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Estimate represents an estimate in Harvest.
type EstimateCreateRequest ¶
type EstimateCreateRequest struct {
ClientID int64 `json:"client_id"`
Number string `json:"number,omitempty"`
PurchaseOrder string `json:"purchase_order,omitempty"`
Tax float64 `json:"tax,omitempty"`
Tax2 float64 `json:"tax2,omitempty"`
Discount float64 `json:"discount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency,omitempty"`
IssueDate string `json:"issue_date,omitempty"`
LineItems []EstimateLineItemRequest `json:"line_items,omitempty"`
}
EstimateCreateRequest represents a request to create an estimate.
type EstimateItem ¶
type EstimateItem struct {
ID int64 `json:"id"`
Project *Project `json:"project,omitempty"`
Kind string `json:"kind"`
Description string `json:"description"`
Quantity decimal.Decimal `json:"quantity"`
UnitPrice decimal.Decimal `json:"unit_price"`
Amount decimal.Decimal `json:"amount"`
Taxed bool `json:"taxed"`
Taxed2 bool `json:"taxed2"`
}
EstimateItem represents a line item on an estimate.
type EstimateItemCategory ¶ added in v0.1.1
type EstimateItemCategory struct {
ID int64 `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
EstimateItemCategory represents a category for estimate line items.
type EstimateItemCategoryCreateRequest ¶ added in v0.1.1
type EstimateItemCategoryCreateRequest struct {
Name string `json:"name"`
}
EstimateItemCategoryCreateRequest represents a request to create an estimate item category.
type EstimateItemCategoryList ¶ added in v0.1.1
type EstimateItemCategoryList struct {
EstimateItemCategories []EstimateItemCategory `json:"estimate_item_categories"`
Paginated[EstimateItemCategory]
}
EstimateItemCategoryList represents a list of estimate item categories.
type EstimateItemCategoryListOptions ¶ added in v0.1.1
type EstimateItemCategoryListOptions struct {
ListOptions
UpdatedSince string `url:"updated_since,omitempty"`
}
EstimateItemCategoryListOptions specifies optional parameters for listing estimate item categories.
type EstimateItemCategoryUpdateRequest ¶ added in v0.1.1
type EstimateItemCategoryUpdateRequest struct {
Name string `json:"name,omitempty"`
}
EstimateItemCategoryUpdateRequest represents a request to update an estimate item category.
type EstimateLineItemRequest ¶
type EstimateLineItemRequest struct {
Kind string `json:"kind"`
Description string `json:"description"`
Quantity float64 `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Taxed *bool `json:"taxed,omitempty"`
Taxed2 *bool `json:"taxed2,omitempty"`
}
EstimateLineItemRequest represents a line item in an estimate request.
type EstimateList ¶
EstimateList represents a list of estimates.
type EstimateListOptions ¶
type EstimateListOptions struct {
ListOptions
ClientID int64 `url:"client_id,omitempty"`
State string `url:"state,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
From string `url:"from,omitempty"`
To string `url:"to,omitempty"`
}
EstimateListOptions specifies optional parameters to the List method.
type EstimateUpdateRequest ¶
type EstimateUpdateRequest struct {
ClientID int64 `json:"client_id,omitempty"`
Number string `json:"number,omitempty"`
PurchaseOrder string `json:"purchase_order,omitempty"`
Tax float64 `json:"tax,omitempty"`
Tax2 float64 `json:"tax2,omitempty"`
Discount float64 `json:"discount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency,omitempty"`
IssueDate string `json:"issue_date,omitempty"`
LineItems []EstimateLineItemRequest `json:"line_items,omitempty"`
}
EstimateUpdateRequest represents a request to update an estimate.
type EstimatesService ¶
type EstimatesService struct {
// contains filtered or unexported fields
}
EstimatesService handles communication with the estimate related methods of the Harvest API.
func (*EstimatesService) Create ¶
func (s *EstimatesService) Create(ctx context.Context, estimate *EstimateCreateRequest) (*Estimate, error)
Create creates a new estimate.
func (*EstimatesService) CreateItemCategory ¶ added in v0.1.1
func (s *EstimatesService) CreateItemCategory(ctx context.Context, category *EstimateItemCategoryCreateRequest) (*EstimateItemCategory, error)
CreateItemCategory creates a new estimate item category.
func (*EstimatesService) Delete ¶
func (s *EstimatesService) Delete(ctx context.Context, estimateID int64) error
Delete deletes an estimate.
func (*EstimatesService) DeleteItemCategory ¶ added in v0.1.1
func (s *EstimatesService) DeleteItemCategory(ctx context.Context, categoryID int64) error
DeleteItemCategory deletes an estimate item category.
func (*EstimatesService) GetItemCategory ¶ added in v0.1.1
func (s *EstimatesService) GetItemCategory(ctx context.Context, categoryID int64) (*EstimateItemCategory, error)
GetItemCategory retrieves a specific estimate item category.
func (*EstimatesService) List ¶
func (s *EstimatesService) List(ctx context.Context, opts *EstimateListOptions) ([]Estimate, error)
List returns all estimates across all pages.
func (*EstimatesService) ListItemCategories ¶ added in v0.1.1
func (s *EstimatesService) ListItemCategories(ctx context.Context, opts *EstimateItemCategoryListOptions) ([]EstimateItemCategory, error)
ListItemCategories returns all estimate item categories across all pages. This endpoint uses cursor-based pagination.
func (*EstimatesService) ListItemCategoriesPage ¶ added in v0.1.1
func (s *EstimatesService) ListItemCategoriesPage(ctx context.Context, opts *EstimateItemCategoryListOptions) (*EstimateItemCategoryList, error)
ListItemCategoriesPage returns a single page of estimate item categories.
func (*EstimatesService) ListPage ¶ added in v0.1.1
func (s *EstimatesService) ListPage(ctx context.Context, opts *EstimateListOptions) (*EstimateList, error)
ListPage returns a single page of estimates.
func (*EstimatesService) MarkAsAccepted ¶
MarkAsAccepted marks an estimate as accepted.
func (*EstimatesService) MarkAsDeclined ¶
MarkAsDeclined marks an estimate as declined.
func (*EstimatesService) MarkAsSent ¶
MarkAsSent marks an estimate as sent.
func (*EstimatesService) Update ¶
func (s *EstimatesService) Update(ctx context.Context, estimateID int64, estimate *EstimateUpdateRequest) (*Estimate, error)
Update updates an estimate.
func (*EstimatesService) UpdateItemCategory ¶ added in v0.1.1
func (s *EstimatesService) UpdateItemCategory(ctx context.Context, categoryID int64, category *EstimateItemCategoryUpdateRequest) (*EstimateItemCategory, error)
UpdateItemCategory updates an estimate item category.
type Expense ¶
type Expense struct {
ID int64 `json:"id"`
Client *Client `json:"client"`
Project *Project `json:"project"`
ExpenseCategory *ExpenseCategory `json:"expense_category"`
User *User `json:"user"`
UserAssignment *ProjectUserAssignment `json:"user_assignment"`
Invoice *Invoice `json:"invoice,omitempty"`
Receipt *Receipt `json:"receipt,omitempty"`
Notes string `json:"notes,omitempty"`
IsLocked bool `json:"is_locked"`
LockedReason string `json:"locked_reason,omitempty"`
IsClosed bool `json:"is_closed"`
IsBilled bool `json:"is_billed"`
Billable bool `json:"billable"`
SpentDate Date `json:"spent_date"`
TotalCost decimal.Decimal `json:"total_cost"`
Units *decimal.Decimal `json:"units,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Expense represents an expense in Harvest.
type ExpenseCategory ¶
type ExpenseCategory struct {
ID int64 `json:"id"`
Name string `json:"name"`
UnitName string `json:"unit_name,omitempty"`
UnitPrice *decimal.Decimal `json:"unit_price,omitempty"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ExpenseCategory represents an expense category.
type ExpenseCategoryCreateRequest ¶
type ExpenseCategoryCreateRequest struct {
Name string `json:"name"`
UnitName string `json:"unit_name,omitempty"`
UnitPrice float64 `json:"unit_price,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
ExpenseCategoryCreateRequest represents a request to create an expense category.
type ExpenseCategoryList ¶
type ExpenseCategoryList struct {
ExpenseCategories []ExpenseCategory `json:"expense_categories"`
Paginated[ExpenseCategory]
}
ExpenseCategoryList represents a list of expense categories.
type ExpenseCategoryListOptions ¶
type ExpenseCategoryListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
ExpenseCategoryListOptions specifies optional parameters for listing expense categories.
type ExpenseCategoryUpdateRequest ¶
type ExpenseCategoryUpdateRequest struct {
Name string `json:"name,omitempty"`
UnitName string `json:"unit_name,omitempty"`
UnitPrice float64 `json:"unit_price,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
ExpenseCategoryUpdateRequest represents a request to update an expense category.
type ExpenseCreateRequest ¶
type ExpenseCreateRequest struct {
ProjectID int64 `json:"project_id"`
ExpenseCategoryID int64 `json:"expense_category_id"`
SpentDate string `json:"spent_date"`
UserID int64 `json:"user_id,omitempty"`
Notes string `json:"notes,omitempty"`
Units float64 `json:"units,omitempty"`
TotalCost float64 `json:"total_cost,omitempty"`
Billable *bool `json:"billable,omitempty"`
}
ExpenseCreateRequest represents a request to create an expense.
type ExpenseList ¶
ExpenseList represents a list of expenses.
type ExpenseListOptions ¶
type ExpenseListOptions struct {
ListOptions
UserID int64 `url:"user_id,omitempty"`
ClientID int64 `url:"client_id,omitempty"`
ProjectID int64 `url:"project_id,omitempty"`
IsBilled *bool `url:"is_billed,omitempty"`
ApprovalStatus string `url:"approval_status,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
From string `url:"from,omitempty"`
To string `url:"to,omitempty"`
}
ExpenseListOptions specifies optional parameters to the List method.
type ExpenseReport ¶
type ExpenseReport struct {
ClientID int64 `json:"client_id"`
ClientName string `json:"client_name"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
ExpenseCategoryID int64 `json:"expense_category_id"`
ExpenseCategoryName string `json:"expense_category_name"`
UserID int64 `json:"user_id"`
UserName string `json:"user_name"`
IsContractor bool `json:"is_contractor"`
TotalAmount decimal.Decimal `json:"total_amount"`
BillableAmount decimal.Decimal `json:"billable_amount"`
Currency string `json:"currency"`
}
ExpenseReport represents an expense report entry.
type ExpenseReportResults ¶
type ExpenseReportResults struct {
Results []ExpenseReport `json:"results"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
TotalEntries int `json:"total_entries"`
NextPage *int `json:"next_page"`
PreviousPage *int `json:"previous_page"`
Page int `json:"page"`
Links *PaginationLinks `json:"links"`
}
ExpenseReportResults represents expense report results.
type ExpenseReportsOptions ¶
type ExpenseReportsOptions struct {
From string `url:"from"`
To string `url:"to"`
ClientID int64 `url:"client_id,omitempty"`
ProjectID int64 `url:"project_id,omitempty"`
UserID int64 `url:"user_id,omitempty"`
IsBilled *bool `url:"is_billed,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
}
ExpenseReportsOptions specifies optional parameters for expense reports.
type ExpenseUpdateRequest ¶
type ExpenseUpdateRequest struct {
ProjectID int64 `json:"project_id,omitempty"`
ExpenseCategoryID int64 `json:"expense_category_id,omitempty"`
SpentDate string `json:"spent_date,omitempty"`
Notes string `json:"notes,omitempty"`
Units float64 `json:"units,omitempty"`
TotalCost float64 `json:"total_cost,omitempty"`
Billable *bool `json:"billable,omitempty"`
}
ExpenseUpdateRequest represents a request to update an expense.
type ExpensesService ¶
type ExpensesService struct {
// contains filtered or unexported fields
}
ExpensesService handles communication with the expense related methods of the Harvest API.
func (*ExpensesService) Create ¶
func (s *ExpensesService) Create(ctx context.Context, expense *ExpenseCreateRequest) (*Expense, error)
Create creates a new expense.
func (*ExpensesService) CreateCategory ¶
func (s *ExpensesService) CreateCategory(ctx context.Context, category *ExpenseCategoryCreateRequest) (*ExpenseCategory, error)
CreateCategory creates a new expense category.
func (*ExpensesService) Delete ¶
func (s *ExpensesService) Delete(ctx context.Context, expenseID int64) error
Delete deletes an expense.
func (*ExpensesService) DeleteCategory ¶
func (s *ExpensesService) DeleteCategory(ctx context.Context, categoryID int64) error
DeleteCategory deletes an expense category.
func (*ExpensesService) GetCategory ¶
func (s *ExpensesService) GetCategory(ctx context.Context, categoryID int64) (*ExpenseCategory, error)
GetCategory retrieves a specific expense category.
func (*ExpensesService) List ¶
func (s *ExpensesService) List(ctx context.Context, opts *ExpenseListOptions) ([]Expense, error)
List returns all expenses across all pages.
func (*ExpensesService) ListCategories ¶
func (s *ExpensesService) ListCategories(ctx context.Context, opts *ExpenseCategoryListOptions) ([]ExpenseCategory, error)
ListCategories returns all expense categories across all pages.
func (*ExpensesService) ListCategoriesPage ¶ added in v0.1.1
func (s *ExpensesService) ListCategoriesPage(ctx context.Context, opts *ExpenseCategoryListOptions) (*ExpenseCategoryList, error)
ListCategoriesPage returns a single page of expense categories.
func (*ExpensesService) ListPage ¶ added in v0.1.1
func (s *ExpensesService) ListPage(ctx context.Context, opts *ExpenseListOptions) (*ExpenseList, error)
ListPage returns a single page of expenses.
func (*ExpensesService) Update ¶
func (s *ExpensesService) Update(ctx context.Context, expenseID int64, expense *ExpenseUpdateRequest) (*Expense, error)
Update updates an expense.
func (*ExpensesService) UpdateCategory ¶
func (s *ExpensesService) UpdateCategory(ctx context.Context, categoryID int64, category *ExpenseCategoryUpdateRequest) (*ExpenseCategory, error)
UpdateCategory updates an expense category.
type ExternalReference ¶
type ExternalReference struct {
ID string `json:"id"`
GroupID string `json:"group_id"`
AccountID string `json:"account_id"`
Permalink string `json:"permalink"`
Service string `json:"service"`
ServiceIconURL string `json:"service_icon_url"`
}
ExternalReference represents an external reference for a time entry.
type ExternalReferenceRequest ¶
type ExternalReferenceRequest struct {
ID string `json:"id"`
GroupID string `json:"group_id"`
AccountID string `json:"account_id"`
Permalink string `json:"permalink"`
}
ExternalReferenceRequest represents an external reference in a request.
type HolidayCalendar ¶ added in v0.1.2
type HolidayCalendar struct {
ID int64 `json:"id"`
Name string `json:"name"`
EntriesCount int `json:"entries_count"`
Entries []HolidayCalendarEntry `json:"entries"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
HolidayCalendar represents a PTO holiday calendar.
type HolidayCalendarEntry ¶ added in v0.1.2
type HolidayCalendarEntry struct {
ID int64 `json:"id"`
PTOHolidayCalendarID int64 `json:"pto_holiday_calendar_id,omitempty"`
Name string `json:"name"`
Date *Date `json:"date,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
HolidayCalendarEntry represents one holiday on a calendar.
type IDName ¶ added in v0.1.2
IDName is the compact {id, name} reference Harvest nests inside other objects.
type Invoice ¶
type Invoice struct {
ID int64 `json:"id"`
Client *Client `json:"client"`
ClientKey string `json:"client_key,omitempty"`
LineItems []InvoiceItem `json:"line_items"`
Estimate *Estimate `json:"estimate,omitempty"`
Retainer *IDName `json:"retainer,omitempty"`
Creator *IDName `json:"creator,omitempty"`
Number string `json:"number"`
PurchaseOrder string `json:"purchase_order,omitempty"`
Amount decimal.Decimal `json:"amount"`
DueAmount decimal.Decimal `json:"due_amount"`
Tax *decimal.Decimal `json:"tax,omitempty"`
TaxAmount *decimal.Decimal `json:"tax_amount,omitempty"`
Tax2 *decimal.Decimal `json:"tax2,omitempty"`
Tax2Amount *decimal.Decimal `json:"tax2_amount,omitempty"`
Discount *decimal.Decimal `json:"discount,omitempty"`
DiscountAmount *decimal.Decimal `json:"discount_amount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency"`
State string `json:"state"`
PeriodStart *Date `json:"period_start,omitempty"`
PeriodEnd *Date `json:"period_end,omitempty"`
IssueDate Date `json:"issue_date"`
DueDate *Date `json:"due_date,omitempty"`
PaymentTerm string `json:"payment_term,omitempty"`
PaymentOptions []string `json:"payment_options,omitempty"`
SentAt *time.Time `json:"sent_at,omitempty"`
PaidAt *time.Time `json:"paid_at,omitempty"`
PaidDate *Date `json:"paid_date,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
RecurringInvoiceID *int64 `json:"recurring_invoice_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Invoice represents an invoice in Harvest.
type InvoiceCreateRequest ¶
type InvoiceCreateRequest struct {
ClientID int64 `json:"client_id"`
EstimateID int64 `json:"estimate_id,omitempty"`
Number string `json:"number,omitempty"`
PurchaseOrder string `json:"purchase_order,omitempty"`
Tax float64 `json:"tax,omitempty"`
Tax2 float64 `json:"tax2,omitempty"`
Discount float64 `json:"discount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency,omitempty"`
IssueDate string `json:"issue_date,omitempty"`
DueDate string `json:"due_date,omitempty"`
PaymentTerm string `json:"payment_term,omitempty"`
LineItems []InvoiceLineItemRequest `json:"line_items,omitempty"`
}
InvoiceCreateRequest represents a request to create an invoice.
type InvoiceItem ¶
type InvoiceItem struct {
ID int64 `json:"id"`
Project *Project `json:"project,omitempty"`
Kind string `json:"kind"`
Description string `json:"description"`
Quantity decimal.Decimal `json:"quantity"`
UnitPrice decimal.Decimal `json:"unit_price"`
Amount decimal.Decimal `json:"amount"`
Taxed bool `json:"taxed"`
Taxed2 bool `json:"taxed2"`
}
InvoiceItem represents a line item on an invoice.
type InvoiceItemCategory ¶ added in v0.1.1
type InvoiceItemCategory struct {
ID int64 `json:"id"`
Name string `json:"name"`
UseAsService bool `json:"use_as_service"`
UseAsExpense bool `json:"use_as_expense"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
InvoiceItemCategory represents a category for invoice line items.
type InvoiceItemCategoryCreateRequest ¶ added in v0.1.1
type InvoiceItemCategoryCreateRequest struct {
Name string `json:"name"`
}
InvoiceItemCategoryCreateRequest represents a request to create an invoice item category.
type InvoiceItemCategoryList ¶ added in v0.1.1
type InvoiceItemCategoryList struct {
InvoiceItemCategories []InvoiceItemCategory `json:"invoice_item_categories"`
Paginated[InvoiceItemCategory]
}
InvoiceItemCategoryList represents a list of invoice item categories.
type InvoiceItemCategoryListOptions ¶ added in v0.1.1
type InvoiceItemCategoryListOptions struct {
ListOptions
UpdatedSince string `url:"updated_since,omitempty"`
}
InvoiceItemCategoryListOptions specifies optional parameters for listing invoice item categories.
type InvoiceItemCategoryUpdateRequest ¶ added in v0.1.1
type InvoiceItemCategoryUpdateRequest struct {
Name string `json:"name,omitempty"`
}
InvoiceItemCategoryUpdateRequest represents a request to update an invoice item category.
type InvoiceLineItemRequest ¶
type InvoiceLineItemRequest struct {
ProjectID int64 `json:"project_id,omitempty"`
Kind string `json:"kind"`
Description string `json:"description"`
Quantity float64 `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Taxed *bool `json:"taxed,omitempty"`
Taxed2 *bool `json:"taxed2,omitempty"`
}
InvoiceLineItemRequest represents a line item in an invoice request.
type InvoiceList ¶
InvoiceList represents a list of invoices.
type InvoiceListOptions ¶
type InvoiceListOptions struct {
ListOptions
ClientID int64 `url:"client_id,omitempty"`
ProjectID int64 `url:"project_id,omitempty"`
State string `url:"state,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
From string `url:"from,omitempty"`
To string `url:"to,omitempty"`
}
InvoiceListOptions specifies optional parameters to the List method.
type InvoiceMessage ¶ added in v0.1.1
type InvoiceMessage struct {
ID int64 `json:"id"`
SentBy string `json:"sent_by"`
SentByEmail string `json:"sent_by_email"`
SentFrom string `json:"sent_from"`
SentFromEmail string `json:"sent_from_email"`
IncludeLinkToClientInvoice bool `json:"include_link_to_client_invoice"`
SendMeACopy bool `json:"send_me_a_copy"`
ThankYou bool `json:"thank_you"`
Reminder bool `json:"reminder"`
SendReminderOn *Date `json:"send_reminder_on"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
AttachPDF bool `json:"attach_pdf"`
EventType string `json:"event_type"`
Recipients []InvoiceMessageRecipient `json:"recipients"`
Subject *string `json:"subject"`
Body *string `json:"body"`
}
InvoiceMessage represents a message associated with an invoice.
type InvoiceMessageList ¶ added in v0.1.1
type InvoiceMessageList struct {
InvoiceMessages []InvoiceMessage `json:"invoice_messages"`
Paginated[InvoiceMessage]
}
InvoiceMessageList represents a list of invoice messages.
type InvoiceMessageListOptions ¶ added in v0.1.1
type InvoiceMessageListOptions struct {
ListOptions
UpdatedSince string `url:"updated_since,omitempty"`
}
InvoiceMessageListOptions specifies optional parameters for listing invoice messages.
type InvoiceMessageRecipient ¶ added in v0.1.3
type InvoiceMessageRecipient struct {
Name string `json:"name,omitempty"`
Email string `json:"email"`
}
InvoiceMessageRecipient is one recipient of an invoice or estimate message.
type InvoiceMessageRequest ¶ added in v0.1.1
type InvoiceMessageRequest struct {
EventType string `json:"event_type"`
}
InvoiceMessageRequest represents a request to create an invoice message.
type InvoicePayment ¶ added in v0.1.2
type InvoicePayment struct {
ID int64 `json:"id"`
Amount decimal.Decimal `json:"amount"`
PaidAt *time.Time `json:"paid_at,omitempty"`
PaidDate *Date `json:"paid_date,omitempty"`
RecordedBy string `json:"recorded_by,omitempty"`
RecordedByEmail string `json:"recorded_by_email,omitempty"`
Notes string `json:"notes,omitempty"`
TransactionID string `json:"transaction_id,omitempty"`
PaymentGateway *PaymentGateway `json:"payment_gateway,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
InvoicePayment represents a payment recorded against an invoice.
type InvoicePaymentListOptions ¶ added in v0.1.2
type InvoicePaymentListOptions struct {
ListOptions
UpdatedSince string `url:"updated_since,omitempty"`
}
InvoicePaymentListOptions specifies optional parameters for listing invoice payments.
type InvoiceUpdateRequest ¶
type InvoiceUpdateRequest struct {
ClientID int64 `json:"client_id,omitempty"`
EstimateID int64 `json:"estimate_id,omitempty"`
Number string `json:"number,omitempty"`
PurchaseOrder string `json:"purchase_order,omitempty"`
Tax float64 `json:"tax,omitempty"`
Tax2 float64 `json:"tax2,omitempty"`
Discount float64 `json:"discount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency,omitempty"`
IssueDate string `json:"issue_date,omitempty"`
DueDate string `json:"due_date,omitempty"`
PaymentTerm string `json:"payment_term,omitempty"`
LineItems []InvoiceLineItemRequest `json:"line_items,omitempty"`
}
InvoiceUpdateRequest represents a request to update an invoice.
type InvoicesService ¶
type InvoicesService struct {
// contains filtered or unexported fields
}
InvoicesService handles communication with the invoice related methods of the Harvest API.
func (*InvoicesService) Create ¶
func (s *InvoicesService) Create(ctx context.Context, invoice *InvoiceCreateRequest) (*Invoice, error)
Create creates a new invoice.
func (*InvoicesService) CreateItemCategory ¶ added in v0.1.1
func (s *InvoicesService) CreateItemCategory(ctx context.Context, category *InvoiceItemCategoryCreateRequest) (*InvoiceItemCategory, error)
CreateItemCategory creates a new invoice item category.
func (*InvoicesService) Delete ¶
func (s *InvoicesService) Delete(ctx context.Context, invoiceID int64) error
Delete deletes an invoice.
func (*InvoicesService) DeleteItemCategory ¶ added in v0.1.1
func (s *InvoicesService) DeleteItemCategory(ctx context.Context, categoryID int64) error
DeleteItemCategory deletes an invoice item category.
func (*InvoicesService) GetItemCategory ¶ added in v0.1.1
func (s *InvoicesService) GetItemCategory(ctx context.Context, categoryID int64) (*InvoiceItemCategory, error)
GetItemCategory retrieves a specific invoice item category.
func (*InvoicesService) List ¶
func (s *InvoicesService) List(ctx context.Context, opts *InvoiceListOptions) ([]Invoice, error)
List returns all invoices across all pages.
func (*InvoicesService) ListItemCategories ¶ added in v0.1.1
func (s *InvoicesService) ListItemCategories(ctx context.Context, opts *InvoiceItemCategoryListOptions) ([]InvoiceItemCategory, error)
ListItemCategories returns all invoice item categories across all pages. This endpoint uses cursor-based pagination.
func (*InvoicesService) ListItemCategoriesPage ¶ added in v0.1.1
func (s *InvoicesService) ListItemCategoriesPage(ctx context.Context, opts *InvoiceItemCategoryListOptions) (*InvoiceItemCategoryList, error)
ListItemCategoriesPage returns a single page of invoice item categories.
func (*InvoicesService) ListMessages ¶ added in v0.1.1
func (s *InvoicesService) ListMessages(ctx context.Context, invoiceID int64, opts *InvoiceMessageListOptions) ([]InvoiceMessage, error)
ListMessages returns all messages for an invoice across all pages.
func (*InvoicesService) ListMessagesPage ¶ added in v0.1.1
func (s *InvoicesService) ListMessagesPage(ctx context.Context, invoiceID int64, opts *InvoiceMessageListOptions) (*InvoiceMessageList, error)
ListMessagesPage returns a single page of messages for an invoice.
func (*InvoicesService) ListPage ¶ added in v0.1.1
func (s *InvoicesService) ListPage(ctx context.Context, opts *InvoiceListOptions) (*InvoiceList, error)
ListPage returns a single page of invoices.
func (*InvoicesService) ListPayments ¶ added in v0.1.2
func (s *InvoicesService) ListPayments(ctx context.Context, invoiceID int64, opts *InvoicePaymentListOptions) ([]InvoicePayment, error)
ListPayments returns all payments recorded against an invoice (GET /v2/invoices/{INVOICE_ID}/payments).
func (*InvoicesService) MarkAsClosed ¶
MarkAsClosed marks an invoice as closed.
func (*InvoicesService) MarkAsDraft ¶
func (s *InvoicesService) MarkAsDraft(ctx context.Context, invoiceID int64) (*InvoiceMessage, error)
MarkAsDraft marks an open invoice as a draft.
func (*InvoicesService) MarkAsSent ¶
func (s *InvoicesService) MarkAsSent(ctx context.Context, invoiceID int64) (*InvoiceMessage, error)
MarkAsSent marks a draft invoice as sent.
func (*InvoicesService) Update ¶
func (s *InvoicesService) Update(ctx context.Context, invoiceID int64, invoice *InvoiceUpdateRequest) (*Invoice, error)
Update updates an invoice.
func (*InvoicesService) UpdateItemCategory ¶ added in v0.1.1
func (s *InvoicesService) UpdateItemCategory(ctx context.Context, categoryID int64, category *InvoiceItemCategoryUpdateRequest) (*InvoiceItemCategory, error)
UpdateItemCategory updates an invoice item category.
type Iterator ¶
type Iterator[T any] struct { // contains filtered or unexported fields }
Iterator provides iteration over paginated results.
func NewIterator ¶
func NewIterator[T any](ctx context.Context, client *API, path string, opts *ListOptions, fetcher func(context.Context, *API, string, *ListOptions) (*Paginated[T], error)) *Iterator[T]
NewIterator creates a new iterator for paginated results.
type ListOptions ¶
type ListOptions struct {
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
UpdatedSince *time.Time `url:"updated_since,omitempty"`
}
ListOptions specifies optional parameters to List methods.
type PTOAllocation ¶ added in v0.1.2
type PTOAllocation struct {
ID int64 `json:"id"`
Year int `json:"year"`
User *IDName `json:"user,omitempty"`
PTOType *PTOTypeRef `json:"pto_type,omitempty"`
AccrualType string `json:"accrual_type,omitempty"`
AccrualSchedule string `json:"accrual_schedule,omitempty"`
AccrualFirstPayday *Date `json:"accrual_first_payday,omitempty"`
AccrualLeaveHours *decimal.Decimal `json:"accrual_leave_hours,omitempty"`
AccrualWorkedHours *decimal.Decimal `json:"accrual_worked_hours,omitempty"`
AccrualMaxHoursPerYear *decimal.Decimal `json:"accrual_max_hours_per_year,omitempty"`
DaysPerYear *decimal.Decimal `json:"days_per_year,omitempty"`
CarryoverDays *decimal.Decimal `json:"carryover_days,omitempty"`
RequiresApproval *bool `json:"requires_approval,omitempty"`
EffectiveDaysPerYear *decimal.Decimal `json:"effective_days_per_year,omitempty"`
EffectiveAccrualType string `json:"effective_accrual_type,omitempty"`
EffectiveAccrualSchedule string `json:"effective_accrual_schedule,omitempty"`
EffectiveRequiresApproval bool `json:"effective_requires_approval"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
PTOAllocation is a user's per-year allocation for a time off policy.
type PTOAllocationListOptions ¶ added in v0.1.2
type PTOAllocationListOptions struct {
ListOptions
Year int `url:"year,omitempty"`
UserIDs []int64 `url:"user_ids,omitempty,comma"`
PTOTypeIDs []int64 `url:"pto_type_ids,omitempty,comma"`
}
PTOAllocationListOptions specifies optional parameters for listing PTO allocations.
type PTOAssignment ¶ added in v0.1.2
type PTOAssignment struct {
User *IDName `json:"user,omitempty"`
HolidayCalendar *IDName `json:"holiday_calendar,omitempty"`
WorkSchedule *IDName `json:"work_schedule,omitempty"`
EffectiveWorkSchedule *EffectiveWorkSchedule `json:"effective_work_schedule,omitempty"`
}
PTOAssignment is a user's holiday calendar and work schedule assignment.
type PTOAssignmentListOptions ¶ added in v0.1.2
type PTOAssignmentListOptions struct {
UserID int64 `url:"user_id,omitempty"`
UserIDs []int64 `url:"user_ids,omitempty,comma"`
}
PTOAssignmentListOptions specifies optional parameters for listing PTO user assignments.
type PTOBalance ¶ added in v0.1.2
type PTOBalance struct {
PTOType *PTOTypeRef `json:"pto_type,omitempty"`
IsRequestable bool `json:"is_requestable"`
Year int `json:"year"`
AsOf *Date `json:"as_of,omitempty"`
IsUnlimited bool `json:"is_unlimited"`
RequiresApproval bool `json:"requires_approval"`
EffectiveAccrualType string `json:"effective_accrual_type,omitempty"`
AccrualSchedule string `json:"accrual_schedule,omitempty"`
AccruedDays decimal.Decimal `json:"accrued_days"`
CarryoverDays decimal.Decimal `json:"carryover_days"`
AvailableDays decimal.Decimal `json:"available_days"`
UsedDays decimal.Decimal `json:"used_days"`
PendingDays decimal.Decimal `json:"pending_days"`
RemainingDays decimal.Decimal `json:"remaining_days"`
UsedHours decimal.Decimal `json:"used_hours"`
PendingHours decimal.Decimal `json:"pending_hours"`
UsedFraction decimal.Decimal `json:"used_fraction"`
PendingFraction decimal.Decimal `json:"pending_fraction"`
}
PTOBalance is a user's balance for one time off policy.
type PTOBalanceOptions ¶ added in v0.1.2
type PTOBalanceOptions struct {
UserID int64 `url:"user_id,omitempty"`
Year int `url:"year,omitempty"`
AsOf string `url:"as_of,omitempty"`
}
PTOBalanceOptions specifies parameters for retrieving a user's time off balances.
type PTOBalances ¶ added in v0.1.2
type PTOBalances struct {
User *IDName `json:"user,omitempty"`
Year int `json:"year"`
AsOf *Date `json:"as_of,omitempty"`
Balances []PTOBalance `json:"balances"`
}
PTOBalances is the balances response for one user and year.
type PTORequest ¶ added in v0.1.2
type PTORequest struct {
ID int64 `json:"id"`
Status string `json:"status"`
StartDate *Date `json:"start_date,omitempty"`
EndDate *Date `json:"end_date,omitempty"`
Days decimal.Decimal `json:"days"`
BusinessDaysAtSubmission *decimal.Decimal `json:"business_days_at_submission,omitempty"`
StartTimeMinutes *int `json:"start_time_minutes,omitempty"`
EndTimeMinutes *int `json:"end_time_minutes,omitempty"`
Notes string `json:"notes,omitempty"`
ReviewReason string `json:"review_reason,omitempty"`
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
User *IDName `json:"user,omitempty"`
PTOType *PTOTypeRef `json:"pto_type,omitempty"`
Reviewer *IDName `json:"reviewer,omitempty"`
RequestDays []PTORequestDay `json:"request_days"`
}
PTORequest represents a time off request.
type PTORequestDay ¶ added in v0.1.2
type PTORequestDay struct {
ID int64 `json:"id"`
Date *Date `json:"date,omitempty"`
Hours decimal.Decimal `json:"hours"`
DayFraction decimal.Decimal `json:"day_fraction"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
PTORequestDay is one day of a time off request.
type PTORequestListOptions ¶ added in v0.1.2
type PTORequestListOptions struct {
ListOptions
UserID int64 `url:"user_id,omitempty"`
Status string `url:"status,omitempty"`
PTOTypeID int64 `url:"pto_type_id,omitempty"`
From string `url:"from,omitempty"`
To string `url:"to,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
PTORequestListOptions specifies optional parameters for listing time off requests.
type PTOService ¶ added in v0.1.2
type PTOService struct {
// contains filtered or unexported fields
}
PTOService handles communication with the Paid Time Off (PTO) related methods of the Harvest API: https://help.getharvest.com/api-v2/pto-api/pto/
func (*PTOService) GetBalances ¶ added in v0.1.2
func (s *PTOService) GetBalances(ctx context.Context, opts *PTOBalanceOptions) (*PTOBalances, error)
GetBalances returns a user's time off balances (GET /v2/pto/balances).
func (*PTOService) ListAllocations ¶ added in v0.1.2
func (s *PTOService) ListAllocations(ctx context.Context, opts *PTOAllocationListOptions) ([]PTOAllocation, error)
ListAllocations returns PTO allocations for a year (GET /v2/pto/allocations).
func (*PTOService) ListAssignments ¶ added in v0.1.2
func (s *PTOService) ListAssignments(ctx context.Context, opts *PTOAssignmentListOptions) ([]PTOAssignment, error)
ListAssignments returns PTO user assignments (GET /v2/pto/assignments).
func (*PTOService) ListHolidayCalendarEntries ¶ added in v0.1.2
func (s *PTOService) ListHolidayCalendarEntries(ctx context.Context, calendarID int64, opts *ListOptions) ([]HolidayCalendarEntry, error)
ListHolidayCalendarEntries returns the entries of one holiday calendar.
func (*PTOService) ListHolidayCalendars ¶ added in v0.1.2
func (s *PTOService) ListHolidayCalendars(ctx context.Context, opts *ListOptions) ([]HolidayCalendar, error)
ListHolidayCalendars returns all holiday calendars (GET /v2/pto/holiday_calendars).
func (*PTOService) ListRequests ¶ added in v0.1.2
func (s *PTOService) ListRequests(ctx context.Context, opts *PTORequestListOptions) ([]PTORequest, error)
ListRequests returns time off requests (GET /v2/pto/requests).
func (*PTOService) ListTypes ¶ added in v0.1.2
func (s *PTOService) ListTypes(ctx context.Context, opts *PTOTypeListOptions) ([]PTOType, error)
ListTypes returns all time off policies (GET /v2/pto/types).
func (*PTOService) ListWorkSchedules ¶ added in v0.1.2
func (s *PTOService) ListWorkSchedules(ctx context.Context, opts *WorkScheduleListOptions) ([]WorkSchedule, error)
ListWorkSchedules returns work schedules (GET /v2/pto/work_schedules).
type PTOType ¶ added in v0.1.2
type PTOType struct {
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color,omitempty"`
Icon string `json:"icon,omitempty"`
AccrualType string `json:"accrual_type,omitempty"`
AccrualSchedule string `json:"accrual_schedule,omitempty"`
AccrualFirstPayday *Date `json:"accrual_first_payday,omitempty"`
AccrualLeaveHours *decimal.Decimal `json:"accrual_leave_hours,omitempty"`
AccrualWorkedHours *decimal.Decimal `json:"accrual_worked_hours,omitempty"`
AccrualMaxHoursPerYear *decimal.Decimal `json:"accrual_max_hours_per_year,omitempty"`
DefaultDaysPerYear *decimal.Decimal `json:"default_days_per_year,omitempty"`
MaxCarryoverDays *decimal.Decimal `json:"max_carryover_days,omitempty"`
RequiresApproval bool `json:"requires_approval"`
VisibleToAll bool `json:"visible_to_all"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
PTOType represents a time off policy.
type PTOTypeListOptions ¶ added in v0.1.2
type PTOTypeListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
PTOTypeListOptions specifies optional parameters for listing time off policies.
type PTOTypeRef ¶ added in v0.1.2
type PTOTypeRef struct {
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color,omitempty"`
Icon string `json:"icon,omitempty"`
}
PTOTypeRef is the compact time off policy reference nested in PTO objects.
type Paginated ¶
type Paginated[T any] struct { Items []T `json:"-"` Links *PaginationLinks `json:"links"` PerPage int `json:"per_page"` TotalPages int `json:"total_pages"` TotalEntries int `json:"total_entries"` NextPage *int `json:"next_page"` PreviousPage *int `json:"previous_page"` Page int `json:"page"` }
Paginated represents a paginated response from the Harvest API.
func ListPage ¶ added in v0.1.1
func ListPage[T any](ctx context.Context, c *API, path string, opts *ListOptions) (*Paginated[T], error)
ListPage performs a GET request to list resources with pagination, returning a single page.
func ListPageFromURL ¶ added in v0.1.1
ListPageFromURL performs a GET request using a full pagination URL. This is used for cursor-based pagination where the API provides full URLs in the links section.
func (*Paginated[T]) GetNextPageURL ¶ added in v0.1.1
GetNextPageURL returns the URL for the next page. Returns empty string if there is no next page.
func (*Paginated[T]) HasNextPage ¶
HasNextPage returns true if there is a next page of results. This works for both page-based and cursor-based pagination.
func (*Paginated[T]) HasPreviousPage ¶
HasPreviousPage returns true if there is a previous page of results.
type PaginationLinks ¶
type PaginationLinks struct {
First string `json:"first"`
Next string `json:"next,omitempty"`
Previous string `json:"previous,omitempty"`
Last string `json:"last"`
}
PaginationLinks represents pagination links in API responses.
type PaymentGateway ¶ added in v0.1.2
PaymentGateway identifies the gateway that processed a payment.
type Project ¶
type Project struct {
ID int64 `json:"id"`
Client *Client `json:"client"`
Name string `json:"name"`
Code string `json:"code,omitempty"`
IsActive bool `json:"is_active"`
IsBillable bool `json:"is_billable"`
IsFixedFee bool `json:"is_fixed_fee"`
BillBy string `json:"bill_by"`
Budget *decimal.Decimal `json:"budget,omitempty"`
BudgetBy string `json:"budget_by,omitempty"`
BudgetIsMonthly bool `json:"budget_is_monthly"`
NotifyWhenOverBudget bool `json:"notify_when_over_budget"`
OverBudgetNotificationPercentage decimal.Decimal `json:"over_budget_notification_percentage,omitempty"`
ShowBudgetToAll bool `json:"show_budget_to_all"`
CostBudget *decimal.Decimal `json:"cost_budget,omitempty"`
CostBudgetIncludeExpenses bool `json:"cost_budget_include_expenses"`
HourlyRate *decimal.Decimal `json:"hourly_rate,omitempty"`
Fee *decimal.Decimal `json:"fee,omitempty"`
Notes string `json:"notes,omitempty"`
StartsOn *Date `json:"starts_on,omitempty"`
EndsOn *Date `json:"ends_on,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Project represents a project in Harvest.
type ProjectBudgetReport ¶
type ProjectBudgetReport struct {
ClientID int64 `json:"client_id"`
ClientName string `json:"client_name"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
ProjectCode string `json:"project_code"`
ProjectStartDate *Date `json:"project_start_date"`
ProjectEndDate *Date `json:"project_end_date"`
IsBillable bool `json:"is_billable"`
IsActive bool `json:"is_active"`
BudgetBy string `json:"budget_by"`
Budget *decimal.Decimal `json:"budget"`
BudgetSpent decimal.Decimal `json:"budget_spent"`
BudgetRemaining *decimal.Decimal `json:"budget_remaining"`
}
ProjectBudgetReport represents a project budget report entry.
type ProjectBudgetReportOptions ¶
type ProjectBudgetReportOptions struct {
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
IsActive *bool `url:"is_active,omitempty"`
ClientID int64 `url:"client_id,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
ProjectBudgetReportOptions specifies optional parameters for project budget reports.
type ProjectBudgetReportResults ¶
type ProjectBudgetReportResults struct {
Results []ProjectBudgetReport `json:"results"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
TotalEntries int `json:"total_entries"`
NextPage *int `json:"next_page"`
PreviousPage *int `json:"previous_page"`
Page int `json:"page"`
Links *PaginationLinks `json:"links"`
}
ProjectBudgetReportResults represents project budget report results.
type ProjectCreateRequest ¶
type ProjectCreateRequest struct {
ClientID int64 `json:"client_id"`
Name string `json:"name"`
Code string `json:"code,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
IsBillable *bool `json:"is_billable,omitempty"`
IsFixedFee *bool `json:"is_fixed_fee,omitempty"`
BillBy string `json:"bill_by,omitempty"`
Budget float64 `json:"budget,omitempty"`
BudgetBy string `json:"budget_by,omitempty"`
BudgetIsMonthly *bool `json:"budget_is_monthly,omitempty"`
NotifyWhenOverBudget *bool `json:"notify_when_over_budget,omitempty"`
OverBudgetNotificationPercentage float64 `json:"over_budget_notification_percentage,omitempty"`
ShowBudgetToAll *bool `json:"show_budget_to_all,omitempty"`
CostBudget float64 `json:"cost_budget,omitempty"`
CostBudgetIncludeExpenses *bool `json:"cost_budget_include_expenses,omitempty"`
HourlyRate float64 `json:"hourly_rate,omitempty"`
Fee float64 `json:"fee,omitempty"`
Notes string `json:"notes,omitempty"`
StartsOn string `json:"starts_on,omitempty"`
EndsOn string `json:"ends_on,omitempty"`
}
ProjectCreateRequest represents a request to create a project.
type ProjectList ¶
ProjectList represents a list of projects.
type ProjectListOptions ¶
type ProjectListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
ClientID int64 `url:"client_id,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
ProjectListOptions specifies optional parameters to the List method.
type ProjectTaskAssignment ¶
type ProjectTaskAssignment struct {
ID int64 `json:"id"`
Project *Project `json:"project"`
Task *Task `json:"task"`
IsActive bool `json:"is_active"`
Billable bool `json:"billable"`
HourlyRate *decimal.Decimal `json:"hourly_rate,omitempty"`
Budget *decimal.Decimal `json:"budget,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ProjectTaskAssignment represents a task assignment to a project.
type ProjectUpdateRequest ¶
type ProjectUpdateRequest struct {
ClientID int64 `json:"client_id,omitempty"`
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
IsBillable *bool `json:"is_billable,omitempty"`
IsFixedFee *bool `json:"is_fixed_fee,omitempty"`
BillBy string `json:"bill_by,omitempty"`
Budget float64 `json:"budget,omitempty"`
BudgetBy string `json:"budget_by,omitempty"`
BudgetIsMonthly *bool `json:"budget_is_monthly,omitempty"`
NotifyWhenOverBudget *bool `json:"notify_when_over_budget,omitempty"`
OverBudgetNotificationPercentage float64 `json:"over_budget_notification_percentage,omitempty"`
ShowBudgetToAll *bool `json:"show_budget_to_all,omitempty"`
CostBudget float64 `json:"cost_budget,omitempty"`
CostBudgetIncludeExpenses *bool `json:"cost_budget_include_expenses,omitempty"`
HourlyRate float64 `json:"hourly_rate,omitempty"`
Fee float64 `json:"fee,omitempty"`
Notes string `json:"notes,omitempty"`
StartsOn string `json:"starts_on,omitempty"`
EndsOn string `json:"ends_on,omitempty"`
}
ProjectUpdateRequest represents a request to update a project.
type ProjectUserAssignment ¶
type ProjectUserAssignment struct {
ID int64 `json:"id"`
Project *Project `json:"project"`
User *User `json:"user"`
IsActive bool `json:"is_active"`
IsProjectManager bool `json:"is_project_manager"`
UseDefaultRates bool `json:"use_default_rates"`
HourlyRate *decimal.Decimal `json:"hourly_rate,omitempty"`
Budget *decimal.Decimal `json:"budget,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ProjectUserAssignment represents a user assignment to a project.
type ProjectsService ¶
type ProjectsService struct {
// contains filtered or unexported fields
}
ProjectsService handles communication with the project related methods of the Harvest API.
func (*ProjectsService) Create ¶
func (s *ProjectsService) Create(ctx context.Context, project *ProjectCreateRequest) (*Project, error)
Create creates a new project.
func (*ProjectsService) CreateTaskAssignment ¶
func (s *ProjectsService) CreateTaskAssignment(ctx context.Context, projectID int64, assignment *TaskAssignmentCreateRequest) (*ProjectTaskAssignment, error)
CreateTaskAssignment creates a new task assignment for a project.
func (*ProjectsService) CreateUserAssignment ¶
func (s *ProjectsService) CreateUserAssignment(ctx context.Context, projectID int64, assignment *UserAssignmentCreateRequest) (*ProjectUserAssignment, error)
CreateUserAssignment creates a new user assignment for a project.
func (*ProjectsService) Delete ¶
func (s *ProjectsService) Delete(ctx context.Context, projectID int64) error
Delete deletes a project.
func (*ProjectsService) DeleteTaskAssignment ¶
func (s *ProjectsService) DeleteTaskAssignment(ctx context.Context, projectID, taskAssignmentID int64) error
DeleteTaskAssignment deletes a task assignment.
func (*ProjectsService) DeleteUserAssignment ¶
func (s *ProjectsService) DeleteUserAssignment(ctx context.Context, projectID, userAssignmentID int64) error
DeleteUserAssignment deletes a user assignment.
func (*ProjectsService) GetTaskAssignment ¶
func (s *ProjectsService) GetTaskAssignment(ctx context.Context, projectID, taskAssignmentID int64) (*ProjectTaskAssignment, error)
GetTaskAssignment retrieves a specific task assignment.
func (*ProjectsService) GetUserAssignment ¶
func (s *ProjectsService) GetUserAssignment(ctx context.Context, projectID, userAssignmentID int64) (*ProjectUserAssignment, error)
GetUserAssignment retrieves a specific user assignment.
func (*ProjectsService) List ¶
func (s *ProjectsService) List(ctx context.Context, opts *ProjectListOptions) ([]Project, error)
List returns all projects across all pages.
func (*ProjectsService) ListAllTaskAssignments ¶ added in v0.1.2
func (s *ProjectsService) ListAllTaskAssignments(ctx context.Context, opts *TaskAssignmentListOptions) ([]ProjectTaskAssignment, error)
ListAllTaskAssignments returns task assignments across every project (GET /v2/task_assignments), so callers need not loop over projects.
func (*ProjectsService) ListAllUserAssignments ¶ added in v0.1.2
func (s *ProjectsService) ListAllUserAssignments(ctx context.Context, opts *UserAssignmentListOptions) ([]ProjectUserAssignment, error)
ListAllUserAssignments returns user assignments across every project (GET /v2/user_assignments), so callers need not loop over projects.
func (*ProjectsService) ListPage ¶ added in v0.1.1
func (s *ProjectsService) ListPage(ctx context.Context, opts *ProjectListOptions) (*ProjectList, error)
ListPage returns a single page of projects.
func (*ProjectsService) ListTaskAssignments ¶
func (s *ProjectsService) ListTaskAssignments(ctx context.Context, projectID int64, opts *TaskAssignmentListOptions) ([]ProjectTaskAssignment, error)
ListTaskAssignments returns all task assignments for a project across all pages. This endpoint uses cursor-based pagination.
func (*ProjectsService) ListTaskAssignmentsPage ¶ added in v0.1.1
func (s *ProjectsService) ListTaskAssignmentsPage(ctx context.Context, projectID int64, opts *TaskAssignmentListOptions) (*TaskAssignmentList, error)
ListTaskAssignmentsPage returns a single page of task assignments for a project.
func (*ProjectsService) ListUserAssignments ¶
func (s *ProjectsService) ListUserAssignments(ctx context.Context, projectID int64, opts *UserAssignmentListOptions) ([]ProjectUserAssignment, error)
ListUserAssignments returns all user assignments for a project across all pages. This endpoint uses cursor-based pagination.
func (*ProjectsService) ListUserAssignmentsPage ¶ added in v0.1.1
func (s *ProjectsService) ListUserAssignmentsPage(ctx context.Context, projectID int64, opts *UserAssignmentListOptions) (*UserAssignmentList, error)
ListUserAssignmentsPage returns a single page of user assignments for a project.
func (*ProjectsService) Update ¶
func (s *ProjectsService) Update(ctx context.Context, projectID int64, project *ProjectUpdateRequest) (*Project, error)
Update updates a project.
func (*ProjectsService) UpdateTaskAssignment ¶
func (s *ProjectsService) UpdateTaskAssignment(ctx context.Context, projectID, taskAssignmentID int64, assignment *TaskAssignmentUpdateRequest) (*ProjectTaskAssignment, error)
UpdateTaskAssignment updates a task assignment.
func (*ProjectsService) UpdateUserAssignment ¶
func (s *ProjectsService) UpdateUserAssignment(ctx context.Context, projectID, userAssignmentID int64, assignment *UserAssignmentUpdateRequest) (*ProjectUserAssignment, error)
UpdateUserAssignment updates a user assignment.
type Rate ¶
type Rate struct {
Limit int `json:"limit"`
Remaining int `json:"remaining"`
Reset Timestamp `json:"reset"`
}
Rate represents the rate limit for the Harvest API.
type RateLimitError ¶
RateLimitError occurs when the API rate limit is exceeded.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type RawItem ¶ added in v0.1.2
type RawItem[T any] struct { Value T Raw json.RawMessage }
RawItem pairs a decoded API object with the exact JSON the API returned for it. Callers that cache Harvest data can persist Raw so no attribute is lost even when Value's struct has no field for it.
func GetRaw ¶ added in v0.1.2
GetRaw fetches a single object and returns it decoded into T with its raw JSON.
func ListRaw ¶ added in v0.1.2
ListRaw fetches every page of a list endpoint and returns each element decoded into T together with its raw JSON. path is relative to the API base (for example "time_entries" or "users/42/billable_rates"); key names the resource array in the response ("time_entries") and may be empty to auto-detect it; opts is any go-querystring-tagged options struct or nil for no query parameters.
Both page-number and cursor (links.next) pagination are followed. Endpoints that return a bare object array without pagination metadata yield a single page.
type Receipt ¶
type Receipt struct {
URL string `json:"url"`
FileName string `json:"file_name"`
FileSize int `json:"file_size"`
ContentType string `json:"content_type"`
}
Receipt represents a receipt attachment.
type ReportsService ¶
type ReportsService struct {
// contains filtered or unexported fields
}
ReportsService handles communication with the report related methods of the Harvest API.
func (*ReportsService) ExpenseReports ¶
func (s *ReportsService) ExpenseReports(ctx context.Context, opts *ExpenseReportsOptions) (*ExpenseReportResults, error)
ExpenseReports retrieves expense reports.
func (*ReportsService) ProjectBudgetReports ¶
func (s *ReportsService) ProjectBudgetReports(ctx context.Context, opts *ProjectBudgetReportOptions) (*ProjectBudgetReportResults, error)
ProjectBudgetReports retrieves project budget reports.
func (*ReportsService) TimeReports ¶
func (s *ReportsService) TimeReports(ctx context.Context, opts *TimeReportsOptions) (*TimeReportResults, error)
TimeReports retrieves time reports.
func (*ReportsService) UninvoicedReports ¶
func (s *ReportsService) UninvoicedReports(ctx context.Context, opts *UninvoicedReportOptions) (*UninvoicedReportResults, error)
UninvoicedReports retrieves uninvoiced reports.
type RestartRequest ¶
type RestartRequest struct {
ID int64 `json:"id"`
}
RestartRequest represents a request to restart a time entry.
type Role ¶
type Role struct {
ID int64 `json:"id"`
Name string `json:"name"`
UserIDs []int64 `json:"user_ids"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Role represents a role in Harvest.
type RoleCreateRequest ¶
type RoleCreateRequest struct {
Name string `json:"name"`
UserIDs []int64 `json:"user_ids,omitempty"`
}
RoleCreateRequest represents a request to create a role.
type RoleListOptions ¶
type RoleListOptions struct {
ListOptions
}
RoleListOptions specifies optional parameters to the List method.
type RoleUpdateRequest ¶
type RoleUpdateRequest struct {
Name string `json:"name,omitempty"`
UserIDs []int64 `json:"user_ids,omitempty"`
}
RoleUpdateRequest represents a request to update a role.
type RolesService ¶
type RolesService struct {
// contains filtered or unexported fields
}
RolesService handles communication with the role related methods of the Harvest API.
func (*RolesService) Create ¶
func (s *RolesService) Create(ctx context.Context, role *RoleCreateRequest) (*Role, error)
Create creates a new role.
func (*RolesService) Delete ¶
func (s *RolesService) Delete(ctx context.Context, roleID int64) error
Delete deletes a role.
func (*RolesService) List ¶
func (s *RolesService) List(ctx context.Context, opts *RoleListOptions) ([]Role, error)
List returns all roles across all pages.
func (*RolesService) ListPage ¶ added in v0.1.1
func (s *RolesService) ListPage(ctx context.Context, opts *RoleListOptions) (*RoleList, error)
ListPage returns a single page of roles.
func (*RolesService) Update ¶
func (s *RolesService) Update(ctx context.Context, roleID int64, role *RoleUpdateRequest) (*Role, error)
Update updates a role.
type Task ¶
type Task struct {
ID int64 `json:"id"`
Name string `json:"name"`
BillableByDefault bool `json:"billable_by_default"`
DefaultHourlyRate *decimal.Decimal `json:"default_hourly_rate,omitempty"`
IsDefault bool `json:"is_default"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Task represents a task in Harvest.
type TaskAssignmentCreateRequest ¶
type TaskAssignmentCreateRequest struct {
TaskID int64 `json:"task_id"`
IsActive *bool `json:"is_active,omitempty"`
Billable *bool `json:"billable,omitempty"`
HourlyRate float64 `json:"hourly_rate,omitempty"`
Budget float64 `json:"budget,omitempty"`
}
TaskAssignmentCreateRequest represents a request to create a task assignment.
type TaskAssignmentList ¶
type TaskAssignmentList struct {
TaskAssignments []ProjectTaskAssignment `json:"task_assignments"`
Paginated[ProjectTaskAssignment]
}
TaskAssignmentList represents a list of task assignments.
type TaskAssignmentListOptions ¶
type TaskAssignmentListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
TaskAssignmentListOptions specifies optional parameters for listing task assignments.
type TaskAssignmentUpdateRequest ¶
type TaskAssignmentUpdateRequest struct {
IsActive *bool `json:"is_active,omitempty"`
Billable *bool `json:"billable,omitempty"`
HourlyRate float64 `json:"hourly_rate,omitempty"`
Budget float64 `json:"budget,omitempty"`
}
TaskAssignmentUpdateRequest represents a request to update a task assignment.
type TaskCreateRequest ¶
type TaskCreateRequest struct {
Name string `json:"name"`
BillableByDefault *bool `json:"billable_by_default,omitempty"`
DefaultHourlyRate float64 `json:"default_hourly_rate,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
TaskCreateRequest represents a request to create a task.
type TaskListOptions ¶
type TaskListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
TaskListOptions specifies optional parameters to the List method.
type TaskUpdateRequest ¶
type TaskUpdateRequest struct {
Name string `json:"name,omitempty"`
BillableByDefault *bool `json:"billable_by_default,omitempty"`
DefaultHourlyRate float64 `json:"default_hourly_rate,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
TaskUpdateRequest represents a request to update a task.
type TasksService ¶
type TasksService struct {
// contains filtered or unexported fields
}
TasksService handles communication with the task related methods of the Harvest API.
func (*TasksService) Create ¶
func (s *TasksService) Create(ctx context.Context, task *TaskCreateRequest) (*Task, error)
Create creates a new task.
func (*TasksService) Delete ¶
func (s *TasksService) Delete(ctx context.Context, taskID int64) error
Delete deletes a task.
func (*TasksService) List ¶
func (s *TasksService) List(ctx context.Context, opts *TaskListOptions) ([]Task, error)
List returns all tasks across all pages.
func (*TasksService) ListPage ¶ added in v0.1.1
func (s *TasksService) ListPage(ctx context.Context, opts *TaskListOptions) (*TaskList, error)
ListPage returns a single page of tasks.
func (*TasksService) Update ¶
func (s *TasksService) Update(ctx context.Context, taskID int64, task *TaskUpdateRequest) (*Task, error)
Update updates a task.
type Teammate ¶ added in v0.1.2
type Teammate struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
}
Teammate is a user managed by a Manager-role user.
type TimeEntriesService ¶
type TimeEntriesService struct {
// contains filtered or unexported fields
}
TimeEntriesService handles communication with the time entry related methods of the Harvest API.
func (*TimeEntriesService) CreateViaDuration ¶
func (s *TimeEntriesService) CreateViaDuration(ctx context.Context, entry *TimeEntryCreateViaDurationRequest) (*TimeEntry, error)
CreateViaDuration creates a new time entry via duration.
func (*TimeEntriesService) CreateViaStartEnd ¶
func (s *TimeEntriesService) CreateViaStartEnd(ctx context.Context, entry *TimeEntryCreateViaStartEndRequest) (*TimeEntry, error)
CreateViaStartEnd creates a new time entry via start and end time.
func (*TimeEntriesService) Delete ¶
func (s *TimeEntriesService) Delete(ctx context.Context, timeEntryID int64) error
Delete deletes a time entry.
func (*TimeEntriesService) DeleteExternalReference ¶
func (s *TimeEntriesService) DeleteExternalReference(ctx context.Context, timeEntryID int64) error
DeleteExternalReference deletes an external reference from a time entry.
func (*TimeEntriesService) List ¶
func (s *TimeEntriesService) List(ctx context.Context, opts *TimeEntryListOptions) ([]TimeEntry, error)
List returns all time entries across all pages.
func (*TimeEntriesService) ListPage ¶ added in v0.1.1
func (s *TimeEntriesService) ListPage(ctx context.Context, opts *TimeEntryListOptions) (*TimeEntryList, error)
ListPage returns a single page of time entries.
func (*TimeEntriesService) Update ¶
func (s *TimeEntriesService) Update(ctx context.Context, timeEntryID int64, entry *TimeEntryUpdateRequest) (*TimeEntry, error)
Update updates a time entry.
type TimeEntry ¶
type TimeEntry struct {
ID int64 `json:"id"`
SpentDate Date `json:"spent_date"`
User *User `json:"user"`
Client *Client `json:"client"`
Project *Project `json:"project"`
Task *Task `json:"task"`
UserAssignment *ProjectUserAssignment `json:"user_assignment"`
TaskAssignment *ProjectTaskAssignment `json:"task_assignment"`
Invoice *Invoice `json:"invoice,omitempty"`
Hours decimal.Decimal `json:"hours"`
HoursWithoutTimer decimal.Decimal `json:"hours_without_timer"`
RoundedHours decimal.Decimal `json:"rounded_hours"`
Notes string `json:"notes,omitempty"`
IsLocked bool `json:"is_locked"`
LockedReason string `json:"locked_reason,omitempty"`
IsClosed bool `json:"is_closed"`
ApprovalStatus string `json:"approval_status,omitempty"`
IsBilled bool `json:"is_billed"`
TimerStartedAt *time.Time `json:"timer_started_at,omitempty"`
StartedTime string `json:"started_time,omitempty"`
EndedTime string `json:"ended_time,omitempty"`
IsRunning bool `json:"is_running"`
Billable bool `json:"billable"`
Budgeted bool `json:"budgeted"`
BillableRate *decimal.Decimal `json:"billable_rate,omitempty"`
CostRate *decimal.Decimal `json:"cost_rate,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ExternalReference *ExternalReference `json:"external_reference,omitempty"`
}
TimeEntry represents a time entry in Harvest.
type TimeEntryCreateViaDurationRequest ¶
type TimeEntryCreateViaDurationRequest struct {
ProjectID int64 `json:"project_id"`
TaskID int64 `json:"task_id"`
SpentDate string `json:"spent_date"`
Hours float64 `json:"hours"`
UserID int64 `json:"user_id,omitempty"`
Notes string `json:"notes,omitempty"`
ExternalReference *ExternalReferenceRequest `json:"external_reference,omitempty"`
}
TimeEntryCreateViaDurationRequest represents a request to create a time entry via duration.
type TimeEntryCreateViaStartEndRequest ¶
type TimeEntryCreateViaStartEndRequest struct {
ProjectID int64 `json:"project_id"`
TaskID int64 `json:"task_id"`
SpentDate string `json:"spent_date"`
StartedTime string `json:"started_time"`
EndedTime string `json:"ended_time"`
UserID int64 `json:"user_id,omitempty"`
Notes string `json:"notes,omitempty"`
ExternalReference *ExternalReferenceRequest `json:"external_reference,omitempty"`
}
TimeEntryCreateViaStartEndRequest represents a request to create a time entry via start and end time.
type TimeEntryList ¶
TimeEntryList represents a list of time entries.
type TimeEntryListOptions ¶
type TimeEntryListOptions struct {
ListOptions
UserID int64 `url:"user_id,omitempty"`
ClientID int64 `url:"client_id,omitempty"`
ProjectID int64 `url:"project_id,omitempty"`
TaskID int64 `url:"task_id,omitempty"`
ExternalReferenceID string `url:"external_reference_id,omitempty"`
IsBilled *bool `url:"is_billed,omitempty"`
IsRunning *bool `url:"is_running,omitempty"`
ApprovalStatus string `url:"approval_status,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
From string `url:"from,omitempty"`
To string `url:"to,omitempty"`
}
TimeEntryListOptions specifies optional parameters to the List method.
type TimeEntryUpdateRequest ¶
type TimeEntryUpdateRequest struct {
ProjectID int64 `json:"project_id,omitempty"`
TaskID int64 `json:"task_id,omitempty"`
SpentDate string `json:"spent_date,omitempty"`
StartedTime string `json:"started_time,omitempty"`
EndedTime string `json:"ended_time,omitempty"`
Hours float64 `json:"hours,omitempty"`
Notes string `json:"notes,omitempty"`
ExternalReference *ExternalReferenceRequest `json:"external_reference,omitempty"`
}
TimeEntryUpdateRequest represents a request to update a time entry.
type TimeReport ¶
type TimeReport struct {
ClientID int64 `json:"client_id"`
ClientName string `json:"client_name"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
TaskID int64 `json:"task_id"`
TaskName string `json:"task_name"`
UserID int64 `json:"user_id"`
UserName string `json:"user_name"`
WeeklyCapacity int `json:"weekly_capacity"`
AvatarURL string `json:"avatar_url"`
IsContractor bool `json:"is_contractor"`
TotalHours decimal.Decimal `json:"total_hours"`
BillableHours decimal.Decimal `json:"billable_hours"`
Currency string `json:"currency"`
BillableAmount decimal.Decimal `json:"billable_amount"`
}
TimeReport represents a time report entry.
type TimeReportResults ¶
type TimeReportResults struct {
Results []TimeReport `json:"results"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
TotalEntries int `json:"total_entries"`
NextPage *int `json:"next_page"`
PreviousPage *int `json:"previous_page"`
Page int `json:"page"`
Links *PaginationLinks `json:"links"`
}
TimeReportResults represents time report results.
type TimeReportsOptions ¶
type TimeReportsOptions struct {
From string `url:"from"`
To string `url:"to"`
ClientID int64 `url:"client_id,omitempty"`
ProjectID int64 `url:"project_id,omitempty"`
TaskID int64 `url:"task_id,omitempty"`
UserID int64 `url:"user_id,omitempty"`
IsBilled *bool `url:"is_billed,omitempty"`
IsRunning *bool `url:"is_running,omitempty"`
OnlyBillable *bool `url:"only_billable,omitempty"`
OnlyUnbillable *bool `url:"only_unbillable,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
}
TimeReportsOptions specifies optional parameters for time reports.
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON number.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type UninvoicedReport ¶
type UninvoicedReport struct {
ClientID int64 `json:"client_id"`
ClientName string `json:"client_name"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
Currency string `json:"currency"`
TotalHours decimal.Decimal `json:"total_hours"`
UninvoicedHours decimal.Decimal `json:"uninvoiced_hours"`
UninvoicedExpenses decimal.Decimal `json:"uninvoiced_expenses"`
UninvoicedAmount decimal.Decimal `json:"uninvoiced_amount"`
}
UninvoicedReport represents an uninvoiced report entry.
type UninvoicedReportOptions ¶
type UninvoicedReportOptions struct {
From string `url:"from"`
To string `url:"to"`
ClientID int64 `url:"client_id,omitempty"`
ProjectID int64 `url:"project_id,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
}
UninvoicedReportOptions specifies optional parameters for uninvoiced reports.
type UninvoicedReportResults ¶
type UninvoicedReportResults struct {
Results []UninvoicedReport `json:"results"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
TotalEntries int `json:"total_entries"`
NextPage *int `json:"next_page"`
PreviousPage *int `json:"previous_page"`
Page int `json:"page"`
Links *PaginationLinks `json:"links"`
}
UninvoicedReportResults represents uninvoiced report results.
type User ¶
type User struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
Telephone string `json:"telephone,omitempty"`
Timezone string `json:"timezone"`
HasAccessToAllFutureProjects bool `json:"has_access_to_all_future_projects"`
IsContractor bool `json:"is_contractor"`
IsActive bool `json:"is_active"`
SamlExempt bool `json:"saml_exempt"`
WeeklyCapacity int `json:"weekly_capacity"`
DefaultHourlyRate *decimal.Decimal `json:"default_hourly_rate,omitempty"`
CostRate *decimal.Decimal `json:"cost_rate,omitempty"`
Roles []string `json:"roles"`
AccessRoles []string `json:"access_roles"`
PermissionsProfile string `json:"permissions_profile,omitempty"`
AvatarURL string `json:"avatar_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User represents a user in Harvest.
type UserAssignmentCreateRequest ¶
type UserAssignmentCreateRequest struct {
UserID int64 `json:"user_id"`
IsActive *bool `json:"is_active,omitempty"`
IsProjectManager *bool `json:"is_project_manager,omitempty"`
UseDefaultRates *bool `json:"use_default_rates,omitempty"`
HourlyRate float64 `json:"hourly_rate,omitempty"`
Budget float64 `json:"budget,omitempty"`
}
UserAssignmentCreateRequest represents a request to create a user assignment.
type UserAssignmentList ¶
type UserAssignmentList struct {
UserAssignments []ProjectUserAssignment `json:"user_assignments"`
Paginated[ProjectUserAssignment]
}
UserAssignmentList represents a list of user assignments.
type UserAssignmentListOptions ¶
type UserAssignmentListOptions struct {
ListOptions
UserID int64 `url:"user_id,omitempty"`
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
UserAssignmentListOptions specifies optional parameters for listing user assignments.
type UserAssignmentUpdateRequest ¶
type UserAssignmentUpdateRequest struct {
IsActive *bool `json:"is_active,omitempty"`
IsProjectManager *bool `json:"is_project_manager,omitempty"`
UseDefaultRates *bool `json:"use_default_rates,omitempty"`
HourlyRate float64 `json:"hourly_rate,omitempty"`
Budget float64 `json:"budget,omitempty"`
}
UserAssignmentUpdateRequest represents a request to update a user assignment.
type UserBillableRate ¶ added in v0.1.2
type UserBillableRate struct {
ID int64 `json:"id"`
Amount decimal.Decimal `json:"amount"`
StartDate *Date `json:"start_date,omitempty"`
EndDate *Date `json:"end_date,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
UserBillableRate is an effective-dated billable rate for a user.
type UserCostRate ¶ added in v0.1.2
type UserCostRate struct {
ID int64 `json:"id"`
Amount decimal.Decimal `json:"amount"`
StartDate *Date `json:"start_date,omitempty"`
EndDate *Date `json:"end_date,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
UserCostRate is an effective-dated cost rate for a user.
type UserCreateRequest ¶
type UserCreateRequest struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
Telephone string `json:"telephone,omitempty"`
Timezone string `json:"timezone,omitempty"`
HasAccessToAllFutureProjects *bool `json:"has_access_to_all_future_projects,omitempty"`
IsContractor *bool `json:"is_contractor,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
WeeklyCapacity int `json:"weekly_capacity,omitempty"`
DefaultHourlyRate float64 `json:"default_hourly_rate,omitempty"`
CostRate float64 `json:"cost_rate,omitempty"`
Roles []string `json:"roles,omitempty"`
}
UserCreateRequest represents a request to create a user.
type UserListOptions ¶
type UserListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
UpdatedSince string `url:"updated_since,omitempty"`
}
UserListOptions specifies optional parameters to the List method.
type UserProjectAssignmentList ¶
type UserProjectAssignmentList struct {
ProjectAssignments []ProjectUserAssignment `json:"project_assignments"`
Paginated[ProjectUserAssignment]
}
UserProjectAssignmentList represents a list of user project assignments.
type UserProjectAssignmentListOptions ¶
type UserProjectAssignmentListOptions struct {
ListOptions
UpdatedSince string `url:"updated_since,omitempty"`
}
UserProjectAssignmentListOptions specifies optional parameters for listing user project assignments.
type UserUpdateRequest ¶
type UserUpdateRequest struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Email string `json:"email,omitempty"`
Telephone string `json:"telephone,omitempty"`
Timezone string `json:"timezone,omitempty"`
HasAccessToAllFutureProjects *bool `json:"has_access_to_all_future_projects,omitempty"`
IsContractor *bool `json:"is_contractor,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
WeeklyCapacity int `json:"weekly_capacity,omitempty"`
DefaultHourlyRate float64 `json:"default_hourly_rate,omitempty"`
CostRate float64 `json:"cost_rate,omitempty"`
Roles []string `json:"roles,omitempty"`
}
UserUpdateRequest represents a request to update a user.
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService handles communication with the user related methods of the Harvest API.
func (*UsersService) Create ¶
func (s *UsersService) Create(ctx context.Context, user *UserCreateRequest) (*User, error)
Create creates a new user.
func (*UsersService) Delete ¶
func (s *UsersService) Delete(ctx context.Context, userID int64) error
Delete archives a user.
func (*UsersService) List ¶
func (s *UsersService) List(ctx context.Context, opts *UserListOptions) ([]User, error)
List returns all users across all pages. This endpoint uses cursor-based pagination.
func (*UsersService) ListBillableRates ¶ added in v0.1.2
func (s *UsersService) ListBillableRates(ctx context.Context, userID int64, opts *ListOptions) ([]UserBillableRate, error)
ListBillableRates returns a user's effective-dated billable rates (GET /v2/users/{USER_ID}/billable_rates). Requires administrator permissions.
func (*UsersService) ListCostRates ¶ added in v0.1.2
func (s *UsersService) ListCostRates(ctx context.Context, userID int64, opts *ListOptions) ([]UserCostRate, error)
ListCostRates returns a user's effective-dated cost rates (GET /v2/users/{USER_ID}/cost_rates). Requires administrator permissions.
func (*UsersService) ListMyProjectAssignments ¶
func (s *UsersService) ListMyProjectAssignments(ctx context.Context, opts *UserProjectAssignmentListOptions) ([]ProjectUserAssignment, error)
ListMyProjectAssignments returns all project assignments for the currently authenticated user across all pages.
func (*UsersService) ListMyProjectAssignmentsPage ¶ added in v0.1.1
func (s *UsersService) ListMyProjectAssignmentsPage(ctx context.Context, opts *UserProjectAssignmentListOptions) (*UserProjectAssignmentList, error)
ListMyProjectAssignmentsPage returns a single page of project assignments for the currently authenticated user.
func (*UsersService) ListPage ¶ added in v0.1.1
func (s *UsersService) ListPage(ctx context.Context, opts *UserListOptions) (*UserList, error)
ListPage returns a single page of users.
func (*UsersService) ListProjectAssignments ¶
func (s *UsersService) ListProjectAssignments(ctx context.Context, userID int64, opts *UserProjectAssignmentListOptions) ([]ProjectUserAssignment, error)
ListProjectAssignments returns all project assignments for a user across all pages. This endpoint uses cursor-based pagination.
func (*UsersService) ListProjectAssignmentsPage ¶ added in v0.1.1
func (s *UsersService) ListProjectAssignmentsPage(ctx context.Context, userID int64, opts *UserProjectAssignmentListOptions) (*UserProjectAssignmentList, error)
ListProjectAssignmentsPage returns a single page of project assignments for a user.
func (*UsersService) ListTeammates ¶ added in v0.1.2
func (s *UsersService) ListTeammates(ctx context.Context, userID int64, opts *ListOptions) ([]Teammate, error)
ListTeammates returns the teammates assigned to a Manager-role user (GET /v2/users/{USER_ID}/teammates). Requires administrator permissions.
func (*UsersService) Me ¶
func (s *UsersService) Me(ctx context.Context) (*User, error)
Me retrieves the currently authenticated user.
func (*UsersService) Update ¶
func (s *UsersService) Update(ctx context.Context, userID int64, user *UserUpdateRequest) (*User, error)
Update updates a user.
type WorkSchedule ¶ added in v0.1.2
type WorkSchedule struct {
ID int64 `json:"id"`
Name string `json:"name"`
IsDefault bool `json:"is_default"`
IsActive bool `json:"is_active"`
WeeklyHours decimal.Decimal `json:"weekly_hours"`
MondayHours decimal.Decimal `json:"monday_hours"`
TuesdayHours decimal.Decimal `json:"tuesday_hours"`
WednesdayHours decimal.Decimal `json:"wednesday_hours"`
ThursdayHours decimal.Decimal `json:"thursday_hours"`
FridayHours decimal.Decimal `json:"friday_hours"`
SaturdayHours decimal.Decimal `json:"saturday_hours"`
SundayHours decimal.Decimal `json:"sunday_hours"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WorkSchedule represents a PTO work schedule.
type WorkScheduleListOptions ¶ added in v0.1.2
type WorkScheduleListOptions struct {
ListOptions
IsActive *bool `url:"is_active,omitempty"`
}
WorkScheduleListOptions specifies optional parameters for listing work schedules.