Documentation
¶
Index ¶
- Constants
- Variables
- func ExitCode(err error) int
- type APIError
- type AuthError
- type CircuitBreaker
- type CircuitBreakerError
- type Client
- func (c *Client) ApproveTimeEntries(ctx context.Context, ids []int64) error
- func (c *Client) CreateClient(ctx context.Context, input *ClientInput) (*HarvestClient, error)
- func (c *Client) CreateEstimate(ctx context.Context, input *EstimateInput) (*Estimate, error)
- func (c *Client) CreateEstimateMessage(ctx context.Context, estimateID int64, input *EstimateMessageInput) (*EstimateMessage, error)
- func (c *Client) CreateExpense(ctx context.Context, input *ExpenseInput) (*Expense, error)
- func (c *Client) CreateInvoice(ctx context.Context, input *InvoiceInput) (*Invoice, error)
- func (c *Client) CreateInvoiceMessage(ctx context.Context, invoiceID int64, input *InvoiceMessageInput) (*InvoiceMessage, error)
- func (c *Client) CreateInvoicePayment(ctx context.Context, invoiceID int64, input *InvoicePaymentInput) (*InvoicePayment, error)
- func (c *Client) CreateProject(ctx context.Context, input *ProjectInput) (*Project, error)
- func (c *Client) CreateTask(ctx context.Context, input *TaskInput) (*Task, error)
- func (c *Client) CreateTimeEntry(ctx context.Context, input *TimeEntryInput) (*TimeEntry, error)
- func (c *Client) CreateUser(ctx context.Context, input *UserInput) (*User, error)
- func (c *Client) Delete(ctx context.Context, path string) error
- func (c *Client) DeleteClient(ctx context.Context, id int64) error
- func (c *Client) DeleteEstimate(ctx context.Context, id int64) error
- func (c *Client) DeleteEstimateMessage(ctx context.Context, estimateID, messageID int64) error
- func (c *Client) DeleteExpense(ctx context.Context, id int64) error
- func (c *Client) DeleteInvoice(ctx context.Context, id int64) error
- func (c *Client) DeleteInvoiceMessage(ctx context.Context, invoiceID, messageID int64) error
- func (c *Client) DeleteInvoicePayment(ctx context.Context, invoiceID, paymentID int64) error
- func (c *Client) DeleteProject(ctx context.Context, id int64) error
- func (c *Client) DeleteTask(ctx context.Context, id int64) error
- func (c *Client) DeleteTimeEntry(ctx context.Context, id int64) error
- func (c *Client) DeleteTimeEntryExternalReference(ctx context.Context, id int64) error
- func (c *Client) DeleteUser(ctx context.Context, id int64) error
- func (c *Client) Get(ctx context.Context, path string, result any) error
- func (c *Client) GetClient(ctx context.Context, id int64) (*HarvestClient, error)
- func (c *Client) GetCompany(ctx context.Context) (*Company, error)
- func (c *Client) GetEstimate(ctx context.Context, id int64) (*Estimate, error)
- func (c *Client) GetExpense(ctx context.Context, id int64) (*Expense, error)
- func (c *Client) GetExpenseCategory(ctx context.Context, id int64) (*ExpenseCategory, error)
- func (c *Client) GetInvoice(ctx context.Context, id int64) (*Invoice, error)
- func (c *Client) GetMe(ctx context.Context) (*User, error)
- func (c *Client) GetProject(ctx context.Context, id int64) (*Project, error)
- func (c *Client) GetReports(ctx context.Context, path string, result any) error
- func (c *Client) GetReportsLimiterStatus() (int, bool)
- func (c *Client) GetRunningTimeEntry(ctx context.Context) (*TimeEntry, error)
- func (c *Client) GetTask(ctx context.Context, id int64) (*Task, error)
- func (c *Client) GetTimeEntry(ctx context.Context, id int64) (*TimeEntry, error)
- func (c *Client) GetUser(ctx context.Context, id int64) (*User, error)
- func (c *Client) ListAllClients(ctx context.Context, opts ClientListOptions) ([]HarvestClient, error)
- func (c *Client) ListAllEstimateMessages(ctx context.Context, estimateID int64, opts EstimateMessageListOptions) ([]EstimateMessage, error)
- func (c *Client) ListAllEstimates(ctx context.Context, opts EstimateListOptions) ([]Estimate, error)
- func (c *Client) ListAllExpenseCategories(ctx context.Context, opts ExpenseCategoryListOptions) ([]ExpenseCategory, error)
- func (c *Client) ListAllExpenseReportsByCategories(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
- func (c *Client) ListAllExpenseReportsByClients(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
- func (c *Client) ListAllExpenseReportsByProjects(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
- func (c *Client) ListAllExpenseReportsByTeam(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
- func (c *Client) ListAllExpenses(ctx context.Context, opts ExpenseListOptions) ([]Expense, error)
- func (c *Client) ListAllInvoiceMessages(ctx context.Context, invoiceID int64, opts InvoiceMessageListOptions) ([]InvoiceMessage, error)
- func (c *Client) ListAllInvoicePayments(ctx context.Context, invoiceID int64, opts InvoicePaymentListOptions) ([]InvoicePayment, error)
- func (c *Client) ListAllInvoices(ctx context.Context, opts InvoiceListOptions) ([]Invoice, error)
- func (c *Client) ListAllMyProjectAssignments(ctx context.Context) ([]ProjectAssignment, error)
- func (c *Client) ListAllProjectBudgetReport(ctx context.Context, opts ProjectBudgetReportOptions) ([]ProjectBudgetReportResult, error)
- func (c *Client) ListAllProjects(ctx context.Context, opts ProjectListOptions) ([]Project, error)
- func (c *Client) ListAllTasks(ctx context.Context, opts TaskListOptions) ([]Task, error)
- func (c *Client) ListAllTimeEntries(ctx context.Context, opts TimeEntryListOptions) ([]TimeEntry, error)
- func (c *Client) ListAllTimeReportsByClients(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
- func (c *Client) ListAllTimeReportsByProjects(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
- func (c *Client) ListAllTimeReportsByTasks(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
- func (c *Client) ListAllTimeReportsByTeam(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
- func (c *Client) ListAllUninvoicedReport(ctx context.Context, opts ReportListOptions) ([]UninvoicedReportResult, error)
- func (c *Client) ListAllUsers(ctx context.Context, opts UserListOptions) ([]User, error)
- func (c *Client) ListClients(ctx context.Context, opts ClientListOptions) (*ClientsResponse, error)
- func (c *Client) ListEstimateMessages(ctx context.Context, estimateID int64, opts EstimateMessageListOptions) (*EstimateMessagesResponse, error)
- func (c *Client) ListEstimates(ctx context.Context, opts EstimateListOptions) (*EstimatesResponse, error)
- func (c *Client) ListExpenseCategories(ctx context.Context, opts ExpenseCategoryListOptions) (*ExpenseCategoriesResponse, error)
- func (c *Client) ListExpenseReportsByCategories(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
- func (c *Client) ListExpenseReportsByClients(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
- func (c *Client) ListExpenseReportsByProjects(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
- func (c *Client) ListExpenseReportsByTeam(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
- func (c *Client) ListExpenses(ctx context.Context, opts ExpenseListOptions) (*ExpensesResponse, error)
- func (c *Client) ListInvoiceMessages(ctx context.Context, invoiceID int64, opts InvoiceMessageListOptions) (*InvoiceMessagesResponse, error)
- func (c *Client) ListInvoicePayments(ctx context.Context, invoiceID int64, opts InvoicePaymentListOptions) (*InvoicePaymentsResponse, error)
- func (c *Client) ListInvoices(ctx context.Context, opts InvoiceListOptions) (*InvoicesResponse, error)
- func (c *Client) ListMyProjectAssignments(ctx context.Context, opts MyProjectAssignmentsOptions) (*MyProjectAssignmentsResponse, error)
- func (c *Client) ListProjectBudgetReport(ctx context.Context, opts ProjectBudgetReportOptions) (*ProjectBudgetReportResponse, error)
- func (c *Client) ListProjects(ctx context.Context, opts ProjectListOptions) (*ProjectsResponse, error)
- func (c *Client) ListTasks(ctx context.Context, opts TaskListOptions) (*TasksResponse, error)
- func (c *Client) ListTimeEntries(ctx context.Context, opts TimeEntryListOptions) (*TimeEntriesResponse, error)
- func (c *Client) ListTimeReportsByClients(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
- func (c *Client) ListTimeReportsByProjects(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
- func (c *Client) ListTimeReportsByTasks(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
- func (c *Client) ListTimeReportsByTeam(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
- func (c *Client) ListUninvoicedReport(ctx context.Context, opts ReportListOptions) (*UninvoicedReportResponse, error)
- func (c *Client) ListUsers(ctx context.Context, opts UserListOptions) (*UsersResponse, error)
- func (c *Client) MarkEstimateAccepted(ctx context.Context, estimateID int64) (*EstimateMessage, error)
- func (c *Client) MarkEstimateDeclined(ctx context.Context, estimateID int64) (*EstimateMessage, error)
- func (c *Client) MarkEstimateDraft(ctx context.Context, estimateID int64) (*EstimateMessage, error)
- func (c *Client) MarkEstimateSent(ctx context.Context, estimateID int64) (*EstimateMessage, error)
- func (c *Client) MarkInvoiceClosed(ctx context.Context, id int64) (*Invoice, error)
- func (c *Client) MarkInvoiceDraft(ctx context.Context, id int64) (*Invoice, error)
- func (c *Client) MarkInvoiceOpen(ctx context.Context, id int64) (*Invoice, error)
- func (c *Client) MarkInvoiceSent(ctx context.Context, id int64, eventType string) (*Invoice, error)
- func (c *Client) Patch(ctx context.Context, path string, body, result any) error
- func (c *Client) Post(ctx context.Context, path string, body, result any) error
- func (c *Client) RejectTimeEntries(ctx context.Context, ids []int64) error
- func (c *Client) RestartTimeEntry(ctx context.Context, id int64) (*TimeEntry, error)
- func (c *Client) SetVersion(version string)
- func (c *Client) StopTimeEntry(ctx context.Context, id int64) (*TimeEntry, error)
- func (c *Client) SubmitTimeEntriesForApproval(ctx context.Context, ids []int64) error
- func (c *Client) UnsubmitTimeEntries(ctx context.Context, ids []int64) error
- func (c *Client) UpdateClient(ctx context.Context, id int64, input *ClientInput) (*HarvestClient, error)
- func (c *Client) UpdateCompany(ctx context.Context, input *CompanyUpdateInput) (*Company, error)
- func (c *Client) UpdateEstimate(ctx context.Context, id int64, input *EstimateInput) (*Estimate, error)
- func (c *Client) UpdateExpense(ctx context.Context, id int64, input *ExpenseInput) (*Expense, error)
- func (c *Client) UpdateInvoice(ctx context.Context, id int64, input *InvoiceInput) (*Invoice, error)
- func (c *Client) UpdateProject(ctx context.Context, id int64, input *ProjectInput) (*Project, error)
- func (c *Client) UpdateTask(ctx context.Context, id int64, input *TaskInput) (*Task, error)
- func (c *Client) UpdateTimeEntry(ctx context.Context, id int64, input *TimeEntryInput) (*TimeEntry, error)
- func (c *Client) UpdateUser(ctx context.Context, id int64, input *UserInput) (*User, error)
- func (c *Client) UploadExpenseReceipt(ctx context.Context, expenseID int64, receiptPath string) (*Expense, error)
- func (c *Client) WarnIfNearReportsLimit() string
- type ClientInput
- type ClientListOptions
- type ClientRef
- type ClientsResponse
- type Company
- type CompanyUpdateInput
- type Estimate
- type EstimateInput
- type EstimateLineItem
- type EstimateListOptions
- type EstimateMessage
- type EstimateMessageInput
- type EstimateMessageListOptions
- type EstimateMessageRecipient
- type EstimateMessagesResponse
- type EstimateRef
- type EstimatesResponse
- type Expense
- type ExpenseCategoriesResponse
- type ExpenseCategory
- type ExpenseCategoryListOptions
- type ExpenseCategoryRef
- type ExpenseInput
- type ExpenseListOptions
- type ExpenseReportResult
- type ExpenseReportsResponse
- type ExpensesResponse
- type ExternalReference
- type HarvestClient
- type Invoice
- type InvoiceExpensesImport
- type InvoiceInput
- type InvoiceLineItem
- type InvoiceLineItemInput
- type InvoiceLineItemsImport
- type InvoiceListOptions
- type InvoiceMessage
- type InvoiceMessageInput
- type InvoiceMessageListOptions
- type InvoiceMessageRecipient
- type InvoiceMessagesResponse
- type InvoicePayment
- type InvoicePaymentInput
- type InvoicePaymentListOptions
- type InvoicePaymentsResponse
- type InvoiceRef
- type InvoiceTimeImport
- type InvoicesResponse
- type MyProjectAssignmentsOptions
- type MyProjectAssignmentsResponse
- type NotFoundError
- type Pagination
- type PaginationLinks
- type PaymentGatewayRef
- type Project
- type ProjectAssignment
- type ProjectBudgetReportOptions
- type ProjectBudgetReportResponse
- type ProjectBudgetReportResult
- type ProjectClientRef
- type ProjectInput
- type ProjectListOptions
- type ProjectRef
- type ProjectTaskAssignment
- type ProjectsResponse
- type RateLimitError
- type RateLimiter
- type Receipt
- type ReportListOptions
- type RetainerRef
- type RetryTransport
- type Task
- type TaskAssignment
- type TaskInput
- type TaskListOptions
- type TaskRef
- type TasksResponse
- type TimeEntriesResponse
- type TimeEntry
- type TimeEntryApprovalRequest
- type TimeEntryInput
- type TimeEntryListOptions
- type TimeReportResult
- type TimeReportsResponse
- type UninvoicedReportResponse
- type UninvoicedReportResult
- type User
- type UserAssignment
- type UserInput
- type UserListOptions
- type UserRef
- type UsersResponse
- type ValidationError
Constants ¶
const ( // CircuitBreakerThreshold is the number of failures to open the circuit. CircuitBreakerThreshold = 5 // CircuitBreakerResetTime is how long to wait before attempting again. CircuitBreakerResetTime = 30 * time.Second )
const ( // BaseURL is the Harvest API base URL. BaseURL = "https://api.harvestapp.com/v2" // ContentType for JSON requests. ContentType = "application/json" )
const ( ExitSuccess = 0 ExitError = 1 ExitUsage = 2 ExitAuth = 3 ExitNotFound = 4 ExitRateLimit = 5 )
Exit codes for CLI.
const ( // DefaultMaxRetries429 is max retries for rate limit errors. DefaultMaxRetries429 = 10 // DefaultMaxRetries5xx is max retries for server errors. DefaultMaxRetries5xx = 3 // DefaultBaseDelay is initial backoff delay. DefaultBaseDelay = 1 * time.Second // ServerErrorRetryDelay is delay between 5xx retries. ServerErrorRetryDelay = 2 * time.Second )
Variables ¶
var ( ErrNotAuthenticated = errors.New("not authenticated") ErrRateLimited = errors.New("rate limit exceeded") ErrNotFound = errors.New("not found") )
Sentinel errors.
Functions ¶
Types ¶
type CircuitBreaker ¶
type CircuitBreaker struct {
// contains filtered or unexported fields
}
CircuitBreaker prevents cascading failures by tracking consecutive errors.
func NewCircuitBreaker ¶
func NewCircuitBreaker() *CircuitBreaker
NewCircuitBreaker creates a new circuit breaker.
func (*CircuitBreaker) Failures ¶
func (cb *CircuitBreaker) Failures() int
Failures returns current failure count.
func (*CircuitBreaker) IsOpen ¶
func (cb *CircuitBreaker) IsOpen() bool
IsOpen returns true if the circuit is open (too many failures). Automatically resets after CircuitBreakerResetTime.
func (*CircuitBreaker) RecordFailure ¶
func (cb *CircuitBreaker) RecordFailure() bool
RecordFailure increments failure count. Returns true if the circuit is now open.
func (*CircuitBreaker) RecordSuccess ¶
func (cb *CircuitBreaker) RecordSuccess()
RecordSuccess resets the failure count and closes the circuit.
type CircuitBreakerError ¶
type CircuitBreakerError struct{}
CircuitBreakerError indicates the circuit breaker is open.
func (*CircuitBreakerError) Error ¶
func (e *CircuitBreakerError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Harvest API client.
func NewClient ¶
func NewClient(ts oauth2.TokenSource, accountID int64, contactEmail string) *Client
NewClient creates a new Harvest API client.
func NewClientWithBaseURL ¶
func NewClientWithBaseURL(ts oauth2.TokenSource, accountID int64, contactEmail, baseURL string) *Client
NewClientWithBaseURL creates a client with a custom base URL (for testing).
func (*Client) ApproveTimeEntries ¶
ApproveTimeEntries approves submitted time entries (manager action).
func (*Client) CreateClient ¶
func (c *Client) CreateClient(ctx context.Context, input *ClientInput) (*HarvestClient, error)
CreateClient creates a new client.
func (*Client) CreateEstimate ¶
CreateEstimate creates a new estimate.
func (*Client) CreateEstimateMessage ¶
func (c *Client) CreateEstimateMessage(ctx context.Context, estimateID int64, input *EstimateMessageInput) (*EstimateMessage, error)
CreateEstimateMessage creates a new estimate message (sends estimate via email).
func (*Client) CreateExpense ¶
CreateExpense creates a new expense.
func (*Client) CreateInvoice ¶
CreateInvoice creates a new invoice.
func (*Client) CreateInvoiceMessage ¶
func (c *Client) CreateInvoiceMessage(ctx context.Context, invoiceID int64, input *InvoiceMessageInput) (*InvoiceMessage, error)
CreateInvoiceMessage sends an invoice via email.
func (*Client) CreateInvoicePayment ¶
func (c *Client) CreateInvoicePayment(ctx context.Context, invoiceID int64, input *InvoicePaymentInput) (*InvoicePayment, error)
CreateInvoicePayment creates a new payment for an invoice.
func (*Client) CreateProject ¶
CreateProject creates a new project.
func (*Client) CreateTask ¶
CreateTask creates a new task.
func (*Client) CreateTimeEntry ¶
CreateTimeEntry creates a new time entry.
func (*Client) CreateUser ¶
CreateUser creates a new user.
func (*Client) DeleteClient ¶
DeleteClient deletes a client.
func (*Client) DeleteEstimate ¶
DeleteEstimate deletes an estimate.
func (*Client) DeleteEstimateMessage ¶
DeleteEstimateMessage deletes an estimate message.
func (*Client) DeleteExpense ¶
DeleteExpense deletes an expense.
func (*Client) DeleteInvoice ¶
DeleteInvoice deletes an invoice.
func (*Client) DeleteInvoiceMessage ¶
DeleteInvoiceMessage deletes a message from an invoice.
func (*Client) DeleteInvoicePayment ¶
DeleteInvoicePayment deletes a payment from an invoice.
func (*Client) DeleteProject ¶
DeleteProject deletes a project.
func (*Client) DeleteTask ¶
DeleteTask deletes a task.
func (*Client) DeleteTimeEntry ¶
DeleteTimeEntry deletes a time entry.
func (*Client) DeleteTimeEntryExternalReference ¶
DeleteTimeEntryExternalReference deletes the external reference from a time entry.
func (*Client) DeleteUser ¶
DeleteUser deletes a user.
func (*Client) GetCompany ¶
GetCompany retrieves the company for the currently authenticated user.
func (*Client) GetEstimate ¶
GetEstimate retrieves a single estimate by ID.
func (*Client) GetExpense ¶
GetExpense retrieves a single expense by ID.
func (*Client) GetExpenseCategory ¶
GetExpenseCategory retrieves a single expense category by ID.
func (*Client) GetInvoice ¶
GetInvoice retrieves a single invoice by ID.
func (*Client) GetProject ¶
GetProject retrieves a single project by ID.
func (*Client) GetReports ¶
GetReports performs a GET request with reports rate limiting.
func (*Client) GetReportsLimiterStatus ¶
GetReportsLimiterStatus returns current reports rate limit status. Returns (remaining requests, is near limit).
func (*Client) GetRunningTimeEntry ¶
GetRunningTimeEntry returns the currently running time entry for the user, if any.
func (*Client) GetTimeEntry ¶
GetTimeEntry retrieves a single time entry by ID.
func (*Client) ListAllClients ¶
func (c *Client) ListAllClients(ctx context.Context, opts ClientListOptions) ([]HarvestClient, error)
ListAllClients fetches all clients across all pages.
func (*Client) ListAllEstimateMessages ¶
func (c *Client) ListAllEstimateMessages(ctx context.Context, estimateID int64, opts EstimateMessageListOptions) ([]EstimateMessage, error)
ListAllEstimateMessages fetches all messages for an estimate across all pages.
func (*Client) ListAllEstimates ¶
func (c *Client) ListAllEstimates(ctx context.Context, opts EstimateListOptions) ([]Estimate, error)
ListAllEstimates fetches all estimates across all pages.
func (*Client) ListAllExpenseCategories ¶
func (c *Client) ListAllExpenseCategories(ctx context.Context, opts ExpenseCategoryListOptions) ([]ExpenseCategory, error)
ListAllExpenseCategories fetches all expense categories across all pages.
func (*Client) ListAllExpenseReportsByCategories ¶
func (c *Client) ListAllExpenseReportsByCategories(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
ListAllExpenseReportsByCategories fetches all expense report results by categories.
func (*Client) ListAllExpenseReportsByClients ¶
func (c *Client) ListAllExpenseReportsByClients(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
ListAllExpenseReportsByClients fetches all expense report results by clients.
func (*Client) ListAllExpenseReportsByProjects ¶
func (c *Client) ListAllExpenseReportsByProjects(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
ListAllExpenseReportsByProjects fetches all expense report results by projects.
func (*Client) ListAllExpenseReportsByTeam ¶
func (c *Client) ListAllExpenseReportsByTeam(ctx context.Context, opts ReportListOptions) ([]ExpenseReportResult, error)
ListAllExpenseReportsByTeam fetches all expense report results by team.
func (*Client) ListAllExpenses ¶
ListAllExpenses fetches all expenses across all pages.
func (*Client) ListAllInvoiceMessages ¶
func (c *Client) ListAllInvoiceMessages(ctx context.Context, invoiceID int64, opts InvoiceMessageListOptions) ([]InvoiceMessage, error)
ListAllInvoiceMessages fetches all messages for an invoice across all pages.
func (*Client) ListAllInvoicePayments ¶
func (c *Client) ListAllInvoicePayments(ctx context.Context, invoiceID int64, opts InvoicePaymentListOptions) ([]InvoicePayment, error)
ListAllInvoicePayments fetches all payments for an invoice across all pages.
func (*Client) ListAllInvoices ¶
ListAllInvoices fetches all invoices across all pages.
func (*Client) ListAllMyProjectAssignments ¶
func (c *Client) ListAllMyProjectAssignments(ctx context.Context) ([]ProjectAssignment, error)
ListAllMyProjectAssignments fetches all project assignments for the current user.
func (*Client) ListAllProjectBudgetReport ¶
func (c *Client) ListAllProjectBudgetReport(ctx context.Context, opts ProjectBudgetReportOptions) ([]ProjectBudgetReportResult, error)
ListAllProjectBudgetReport fetches all project budget report results.
func (*Client) ListAllProjects ¶
ListAllProjects fetches all projects across all pages.
func (*Client) ListAllTasks ¶
ListAllTasks fetches all tasks across all pages.
func (*Client) ListAllTimeEntries ¶
func (c *Client) ListAllTimeEntries(ctx context.Context, opts TimeEntryListOptions) ([]TimeEntry, error)
ListAllTimeEntries fetches all time entries across all pages.
func (*Client) ListAllTimeReportsByClients ¶
func (c *Client) ListAllTimeReportsByClients(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
ListAllTimeReportsByClients fetches all time report results by clients.
func (*Client) ListAllTimeReportsByProjects ¶
func (c *Client) ListAllTimeReportsByProjects(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
ListAllTimeReportsByProjects fetches all time report results by projects.
func (*Client) ListAllTimeReportsByTasks ¶
func (c *Client) ListAllTimeReportsByTasks(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
ListAllTimeReportsByTasks fetches all time report results by tasks.
func (*Client) ListAllTimeReportsByTeam ¶
func (c *Client) ListAllTimeReportsByTeam(ctx context.Context, opts ReportListOptions) ([]TimeReportResult, error)
ListAllTimeReportsByTeam fetches all time report results by team.
func (*Client) ListAllUninvoicedReport ¶
func (c *Client) ListAllUninvoicedReport(ctx context.Context, opts ReportListOptions) ([]UninvoicedReportResult, error)
ListAllUninvoicedReport fetches all uninvoiced report results.
func (*Client) ListAllUsers ¶
ListAllUsers fetches all users across all pages.
func (*Client) ListClients ¶
func (c *Client) ListClients(ctx context.Context, opts ClientListOptions) (*ClientsResponse, error)
ListClients returns a paginated list of clients.
func (*Client) ListEstimateMessages ¶
func (c *Client) ListEstimateMessages(ctx context.Context, estimateID int64, opts EstimateMessageListOptions) (*EstimateMessagesResponse, error)
ListEstimateMessages returns a paginated list of messages for an estimate.
func (*Client) ListEstimates ¶
func (c *Client) ListEstimates(ctx context.Context, opts EstimateListOptions) (*EstimatesResponse, error)
ListEstimates returns a paginated list of estimates.
func (*Client) ListExpenseCategories ¶
func (c *Client) ListExpenseCategories(ctx context.Context, opts ExpenseCategoryListOptions) (*ExpenseCategoriesResponse, error)
ListExpenseCategories returns a paginated list of expense categories.
func (*Client) ListExpenseReportsByCategories ¶
func (c *Client) ListExpenseReportsByCategories(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
ListExpenseReportsByCategories returns expense report grouped by categories.
func (*Client) ListExpenseReportsByClients ¶
func (c *Client) ListExpenseReportsByClients(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
ListExpenseReportsByClients returns expense report grouped by clients.
func (*Client) ListExpenseReportsByProjects ¶
func (c *Client) ListExpenseReportsByProjects(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
ListExpenseReportsByProjects returns expense report grouped by projects.
func (*Client) ListExpenseReportsByTeam ¶
func (c *Client) ListExpenseReportsByTeam(ctx context.Context, opts ReportListOptions) (*ExpenseReportsResponse, error)
ListExpenseReportsByTeam returns expense report grouped by team members.
func (*Client) ListExpenses ¶
func (c *Client) ListExpenses(ctx context.Context, opts ExpenseListOptions) (*ExpensesResponse, error)
ListExpenses returns a paginated list of expenses.
func (*Client) ListInvoiceMessages ¶
func (c *Client) ListInvoiceMessages(ctx context.Context, invoiceID int64, opts InvoiceMessageListOptions) (*InvoiceMessagesResponse, error)
ListInvoiceMessages returns a paginated list of messages for an invoice.
func (*Client) ListInvoicePayments ¶
func (c *Client) ListInvoicePayments(ctx context.Context, invoiceID int64, opts InvoicePaymentListOptions) (*InvoicePaymentsResponse, error)
ListInvoicePayments returns a paginated list of payments for an invoice.
func (*Client) ListInvoices ¶
func (c *Client) ListInvoices(ctx context.Context, opts InvoiceListOptions) (*InvoicesResponse, error)
ListInvoices returns a paginated list of invoices.
func (*Client) ListMyProjectAssignments ¶
func (c *Client) ListMyProjectAssignments(ctx context.Context, opts MyProjectAssignmentsOptions) (*MyProjectAssignmentsResponse, error)
ListMyProjectAssignments returns project assignments for the current user.
func (*Client) ListProjectBudgetReport ¶
func (c *Client) ListProjectBudgetReport(ctx context.Context, opts ProjectBudgetReportOptions) (*ProjectBudgetReportResponse, error)
ListProjectBudgetReport returns project budget status.
func (*Client) ListProjects ¶
func (c *Client) ListProjects(ctx context.Context, opts ProjectListOptions) (*ProjectsResponse, error)
ListProjects returns a paginated list of projects.
func (*Client) ListTasks ¶
func (c *Client) ListTasks(ctx context.Context, opts TaskListOptions) (*TasksResponse, error)
ListTasks returns a paginated list of tasks.
func (*Client) ListTimeEntries ¶
func (c *Client) ListTimeEntries(ctx context.Context, opts TimeEntryListOptions) (*TimeEntriesResponse, error)
ListTimeEntries returns a paginated list of time entries.
func (*Client) ListTimeReportsByClients ¶
func (c *Client) ListTimeReportsByClients(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
ListTimeReportsByClients returns time report grouped by clients.
func (*Client) ListTimeReportsByProjects ¶
func (c *Client) ListTimeReportsByProjects(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
ListTimeReportsByProjects returns time report grouped by projects.
func (*Client) ListTimeReportsByTasks ¶
func (c *Client) ListTimeReportsByTasks(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
ListTimeReportsByTasks returns time report grouped by tasks.
func (*Client) ListTimeReportsByTeam ¶
func (c *Client) ListTimeReportsByTeam(ctx context.Context, opts ReportListOptions) (*TimeReportsResponse, error)
ListTimeReportsByTeam returns time report grouped by team members.
func (*Client) ListUninvoicedReport ¶
func (c *Client) ListUninvoicedReport(ctx context.Context, opts ReportListOptions) (*UninvoicedReportResponse, error)
ListUninvoicedReport returns uninvoiced amounts by project.
func (*Client) ListUsers ¶
func (c *Client) ListUsers(ctx context.Context, opts UserListOptions) (*UsersResponse, error)
ListUsers returns a paginated list of users.
func (*Client) MarkEstimateAccepted ¶
func (c *Client) MarkEstimateAccepted(ctx context.Context, estimateID int64) (*EstimateMessage, error)
MarkEstimateAccepted marks an open estimate as accepted.
func (*Client) MarkEstimateDeclined ¶
func (c *Client) MarkEstimateDeclined(ctx context.Context, estimateID int64) (*EstimateMessage, error)
MarkEstimateDeclined marks an open estimate as declined.
func (*Client) MarkEstimateDraft ¶
MarkEstimateDraft re-opens a closed estimate (converts back to draft).
func (*Client) MarkEstimateSent ¶
MarkEstimateSent marks a draft estimate as sent.
func (*Client) MarkInvoiceClosed ¶
MarkInvoiceClosed marks an open invoice as closed.
func (*Client) MarkInvoiceDraft ¶
MarkInvoiceDraft marks an invoice as draft (re-open).
func (*Client) MarkInvoiceOpen ¶
MarkInvoiceOpen reopens a closed invoice.
func (*Client) MarkInvoiceSent ¶
MarkInvoiceSent marks an open invoice as sent.
func (*Client) RejectTimeEntries ¶
RejectTimeEntries rejects submitted time entries (manager action).
func (*Client) RestartTimeEntry ¶
RestartTimeEntry restarts a stopped time entry.
func (*Client) SetVersion ¶
SetVersion sets the version string for User-Agent.
func (*Client) StopTimeEntry ¶
StopTimeEntry stops a running time entry.
func (*Client) SubmitTimeEntriesForApproval ¶
SubmitTimeEntriesForApproval submits time entries for manager approval.
func (*Client) UnsubmitTimeEntries ¶
UnsubmitTimeEntries returns submitted time entries to draft status.
func (*Client) UpdateClient ¶
func (c *Client) UpdateClient(ctx context.Context, id int64, input *ClientInput) (*HarvestClient, error)
UpdateClient updates an existing client.
func (*Client) UpdateCompany ¶
UpdateCompany updates the company settings.
func (*Client) UpdateEstimate ¶
func (c *Client) UpdateEstimate(ctx context.Context, id int64, input *EstimateInput) (*Estimate, error)
UpdateEstimate updates an existing estimate.
func (*Client) UpdateExpense ¶
func (c *Client) UpdateExpense(ctx context.Context, id int64, input *ExpenseInput) (*Expense, error)
UpdateExpense updates an existing expense.
func (*Client) UpdateInvoice ¶
func (c *Client) UpdateInvoice(ctx context.Context, id int64, input *InvoiceInput) (*Invoice, error)
UpdateInvoice updates an existing invoice.
func (*Client) UpdateProject ¶
func (c *Client) UpdateProject(ctx context.Context, id int64, input *ProjectInput) (*Project, error)
UpdateProject updates an existing project.
func (*Client) UpdateTask ¶
UpdateTask updates an existing task.
func (*Client) UpdateTimeEntry ¶
func (c *Client) UpdateTimeEntry(ctx context.Context, id int64, input *TimeEntryInput) (*TimeEntry, error)
UpdateTimeEntry updates an existing time entry.
func (*Client) UpdateUser ¶
UpdateUser updates an existing user.
func (*Client) UploadExpenseReceipt ¶
func (c *Client) UploadExpenseReceipt(ctx context.Context, expenseID int64, receiptPath string) (*Expense, error)
UploadExpenseReceipt uploads a receipt file to an expense using multipart/form-data.
func (*Client) WarnIfNearReportsLimit ¶
WarnIfNearReportsLimit prints a warning if approaching reports rate limit.
type ClientInput ¶
type ClientInput struct {
Name string `json:"name,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
Address *string `json:"address,omitempty"`
Currency *string `json:"currency,omitempty"`
}
ClientInput is used to create or update a client.
type ClientListOptions ¶
ClientListOptions filters client list requests.
func (ClientListOptions) QueryParams ¶
func (o ClientListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type ClientsResponse ¶
type ClientsResponse struct {
Clients []HarvestClient `json:"clients"`
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"`
}
ClientsResponse is the paginated response for clients.
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"`
CurrencyCodeDisplay string `json:"currency_code_display"`
CurrencySymbolDisplay string `json:"currency_symbol_display"`
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"`
TeamFeature bool `json:"team_feature"`
}
Company represents a Harvest company/account.
type CompanyUpdateInput ¶
type CompanyUpdateInput struct {
WantsTimestampTimers *bool `json:"wants_timestamp_timers,omitempty"`
WeeklyCapacity *int `json:"weekly_capacity,omitempty"`
}
CompanyUpdateInput is used to update company settings.
type Estimate ¶
type Estimate struct {
ID int64 `json:"id"`
ClientKey string `json:"client_key"`
Number string `json:"number"`
PurchaseOrder string `json:"purchase_order"`
Amount float64 `json:"amount"`
Tax *float64 `json:"tax"`
TaxAmount float64 `json:"tax_amount"`
Tax2 *float64 `json:"tax2"`
Tax2Amount float64 `json:"tax2_amount"`
Discount *float64 `json:"discount"`
DiscountAmount float64 `json:"discount_amount"`
Subject string `json:"subject"`
Notes string `json:"notes"`
Currency string `json:"currency"`
State string `json:"state"`
IssueDate string `json:"issue_date"`
SentAt *time.Time `json:"sent_at"`
AcceptedAt *time.Time `json:"accepted_at"`
DeclinedAt *time.Time `json:"declined_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Client ClientRef `json:"client"`
Creator UserRef `json:"creator"`
LineItems []EstimateLineItem `json:"line_items"`
}
Estimate represents a Harvest estimate.
type EstimateInput ¶
type EstimateInput 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 []EstimateLineItem `json:"line_items,omitempty"`
}
EstimateInput is used to create or update an estimate.
type EstimateLineItem ¶
type EstimateLineItem struct {
ID int64 `json:"id,omitempty"`
Kind string `json:"kind"`
Description string `json:"description,omitempty"`
Quantity float64 `json:"quantity,omitempty"`
UnitPrice float64 `json:"unit_price"`
Amount float64 `json:"amount,omitempty"`
Taxed bool `json:"taxed,omitempty"`
Taxed2 bool `json:"taxed2,omitempty"`
Destroy bool `json:"_destroy,omitempty"`
}
EstimateLineItem represents a line item on an estimate.
type EstimateListOptions ¶
type EstimateListOptions struct {
ClientID int64
State string
UpdatedSince string
From string
To string
Page int
PerPage int
}
EstimateListOptions filters estimate list requests.
func (EstimateListOptions) QueryParams ¶
func (o EstimateListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type EstimateMessage ¶
type EstimateMessage 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"`
Recipients []EstimateMessageRecipient `json:"recipients"`
Subject string `json:"subject"`
Body string `json:"body"`
SendMeACopy bool `json:"send_me_a_copy"`
EventType string `json:"event_type"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
EstimateMessage represents a message sent with an estimate.
type EstimateMessageInput ¶
type EstimateMessageInput struct {
Recipients []EstimateMessageRecipient `json:"recipients,omitempty"`
Subject *string `json:"subject,omitempty"`
Body *string `json:"body,omitempty"`
SendMeACopy *bool `json:"send_me_a_copy,omitempty"`
EventType *string `json:"event_type,omitempty"`
}
EstimateMessageInput is used to create an estimate message.
type EstimateMessageListOptions ¶
EstimateMessageListOptions filters estimate message list requests.
func (EstimateMessageListOptions) QueryParams ¶
func (o EstimateMessageListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type EstimateMessageRecipient ¶
type EstimateMessageRecipient struct {
Name string `json:"name,omitempty"`
Email string `json:"email"`
}
EstimateMessageRecipient represents a recipient of an estimate message.
type EstimateMessagesResponse ¶
type EstimateMessagesResponse struct {
EstimateMessages []EstimateMessage `json:"estimate_messages"`
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"`
}
EstimateMessagesResponse is the paginated response for estimate messages.
type EstimateRef ¶
type EstimateRef struct {
ID int64 `json:"id"`
}
EstimateRef is a reference to an estimate.
type EstimatesResponse ¶
type EstimatesResponse struct {
Estimates []Estimate `json:"estimates"`
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"`
}
EstimatesResponse is the paginated response for estimates.
type Expense ¶
type Expense struct {
ID int64 `json:"id"`
Notes string `json:"notes"`
TotalCost float64 `json:"total_cost"`
Units float64 `json:"units"`
IsClosed bool `json:"is_closed"`
ApprovalStatus string `json:"approval_status"`
IsLocked bool `json:"is_locked"`
IsBilled bool `json:"is_billed"`
LockedReason string `json:"locked_reason"`
SpentDate string `json:"spent_date"`
Billable bool `json:"billable"`
Receipt *Receipt `json:"receipt"`
User UserRef `json:"user"`
UserAssignment *UserAssignment `json:"user_assignment"`
Project ProjectRef `json:"project"`
ExpenseCategory ExpenseCategoryRef `json:"expense_category"`
Client ClientRef `json:"client"`
Invoice *InvoiceRef `json:"invoice"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Expense represents a Harvest expense.
type ExpenseCategoriesResponse ¶
type ExpenseCategoriesResponse struct {
ExpenseCategories []ExpenseCategory `json:"expense_categories"`
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"`
}
ExpenseCategoriesResponse is the paginated response for expense categories.
type ExpenseCategory ¶
type ExpenseCategory struct {
ID int64 `json:"id"`
Name string `json:"name"`
UnitName *string `json:"unit_name"`
UnitPrice *float64 `json:"unit_price"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ExpenseCategory represents a Harvest expense category.
type ExpenseCategoryListOptions ¶
ExpenseCategoryListOptions filters expense category list requests.
func (ExpenseCategoryListOptions) QueryParams ¶
func (o ExpenseCategoryListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type ExpenseCategoryRef ¶
type ExpenseCategoryRef struct {
ID int64 `json:"id"`
Name string `json:"name"`
UnitPrice *float64 `json:"unit_price"`
UnitName *string `json:"unit_name"`
}
ExpenseCategoryRef is a reference to an expense category in nested objects.
type ExpenseInput ¶
type ExpenseInput struct {
UserID *int64 `json:"user_id,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
ExpenseCategoryID int64 `json:"expense_category_id,omitempty"`
SpentDate string `json:"spent_date,omitempty"`
Units *int `json:"units,omitempty"`
TotalCost *float64 `json:"total_cost,omitempty"`
Notes *string `json:"notes,omitempty"`
Billable *bool `json:"billable,omitempty"`
DeleteReceipt *bool `json:"delete_receipt,omitempty"`
}
ExpenseInput is used to create or update an expense.
type ExpenseListOptions ¶
type ExpenseListOptions struct {
UserID int64
ClientID int64
ProjectID int64
IsBilled *bool
ApprovalStatus string // "unsubmitted", "submitted", "approved"
UpdatedSince string
From string
To string
Page int
PerPage int
}
ExpenseListOptions filters expense list requests.
func (ExpenseListOptions) QueryParams ¶
func (o ExpenseListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type ExpenseReportResult ¶
type ExpenseReportResult struct {
ClientID int64 `json:"client_id,omitempty"`
ClientName string `json:"client_name,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
ProjectName string `json:"project_name,omitempty"`
ExpenseCategoryID int64 `json:"expense_category_id,omitempty"`
ExpenseCategoryName string `json:"expense_category_name,omitempty"`
UserID int64 `json:"user_id,omitempty"`
UserName string `json:"user_name,omitempty"`
TotalAmount float64 `json:"total_amount"`
BillableAmount float64 `json:"billable_amount"`
Currency string `json:"currency,omitempty"`
IsContractor bool `json:"is_contractor,omitempty"`
}
ExpenseReportResult represents a single row in an expense report.
type ExpenseReportsResponse ¶
type ExpenseReportsResponse struct {
Results []ExpenseReportResult `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"`
}
ExpenseReportsResponse is the paginated response for expense reports.
type ExpensesResponse ¶
type ExpensesResponse struct {
Expenses []Expense `json:"expenses"`
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"`
}
ExpensesResponse is the paginated response for expenses.
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 contains external reference info for time entries.
type HarvestClient ¶
type HarvestClient struct {
ID int64 `json:"id"`
Name string `json:"name"`
IsActive bool `json:"is_active"`
Address string `json:"address"`
StatementKey string `json:"statement_key"`
Currency string `json:"currency"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
HarvestClient represents a Harvest client (customer).
type Invoice ¶
type Invoice struct {
ID int64 `json:"id"`
ClientKey string `json:"client_key"`
Number string `json:"number"`
PurchaseOrder string `json:"purchase_order"`
Amount float64 `json:"amount"`
DueAmount float64 `json:"due_amount"`
Tax *float64 `json:"tax"`
TaxAmount float64 `json:"tax_amount"`
Tax2 *float64 `json:"tax2"`
Tax2Amount float64 `json:"tax2_amount"`
Discount *float64 `json:"discount"`
DiscountAmount float64 `json:"discount_amount"`
Subject string `json:"subject"`
Notes string `json:"notes"`
Currency string `json:"currency"`
State string `json:"state"`
PeriodStart *string `json:"period_start"`
PeriodEnd *string `json:"period_end"`
IssueDate string `json:"issue_date"`
DueDate string `json:"due_date"`
PaymentTerm string `json:"payment_term"`
SentAt *time.Time `json:"sent_at"`
PaidAt *time.Time `json:"paid_at"`
PaidDate *string `json:"paid_date"`
ClosedAt *time.Time `json:"closed_at"`
RecurringInvoiceID *int64 `json:"recurring_invoice_id"`
Client ClientRef `json:"client"`
Estimate *EstimateRef `json:"estimate"`
Retainer *RetainerRef `json:"retainer"`
Creator *UserRef `json:"creator"`
LineItems []InvoiceLineItem `json:"line_items"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Invoice represents a Harvest invoice.
type InvoiceExpensesImport ¶
type InvoiceExpensesImport struct {
SummaryType string `json:"summary_type,omitempty"` // category, project, people, detailed
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
AttachReceipts bool `json:"attach_receipts,omitempty"`
}
InvoiceExpensesImport specifies how to import expenses.
type InvoiceInput ¶
type InvoiceInput struct {
ClientID int64 `json:"client_id,omitempty"`
RetainerID *int64 `json:"retainer_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 []InvoiceLineItemInput `json:"line_items,omitempty"`
LineItemsImport *InvoiceLineItemsImport `json:"line_items_import,omitempty"`
}
InvoiceInput is used to create or update an invoice.
type InvoiceLineItem ¶
type InvoiceLineItem struct {
ID int64 `json:"id"`
Kind string `json:"kind"`
Description string `json:"description"`
Quantity float64 `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Amount float64 `json:"amount"`
Taxed bool `json:"taxed"`
Taxed2 bool `json:"taxed2"`
Project *ProjectRef `json:"project"`
}
InvoiceLineItem represents a line item on an invoice.
type InvoiceLineItemInput ¶
type InvoiceLineItemInput struct {
ID *int64 `json:"id,omitempty"`
Kind string `json:"kind,omitempty"`
Description *string `json:"description,omitempty"`
Quantity *float64 `json:"quantity,omitempty"`
UnitPrice *float64 `json:"unit_price,omitempty"`
Taxed *bool `json:"taxed,omitempty"`
Taxed2 *bool `json:"taxed2,omitempty"`
ProjectID *int64 `json:"project_id,omitempty"`
Destroy *bool `json:"_destroy,omitempty"`
}
InvoiceLineItemInput is used to create or update an invoice line item.
type InvoiceLineItemsImport ¶
type InvoiceLineItemsImport struct {
ProjectIDs []int64 `json:"project_ids,omitempty"`
Time *InvoiceTimeImport `json:"time,omitempty"`
Expenses *InvoiceExpensesImport `json:"expenses,omitempty"`
}
InvoiceLineItemsImport is used to import time/expenses to an invoice.
type InvoiceListOptions ¶
type InvoiceListOptions struct {
ClientID int64
ProjectID int64
UpdatedSince string
From string
To string
State string // draft, open, paid, closed
Page int
PerPage int
}
InvoiceListOptions filters invoice list requests.
func (InvoiceListOptions) QueryParams ¶
func (o InvoiceListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type InvoiceMessage ¶
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"`
Recipients []InvoiceMessageRecipient `json:"recipients"`
Subject string `json:"subject"`
Body string `json:"body"`
IncludeLinkToClientInvoice bool `json:"include_link_to_client_invoice"`
AttachPDF bool `json:"attach_pdf"`
SendMeACopy bool `json:"send_me_a_copy"`
ThankYou bool `json:"thank_you"`
EventType string `json:"event_type"`
Reminder bool `json:"reminder"`
SendReminderOn *string `json:"send_reminder_on"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
InvoiceMessage represents a message/email sent for an invoice.
type InvoiceMessageInput ¶
type InvoiceMessageInput struct {
EventType string `json:"event_type,omitempty"`
Recipients []InvoiceMessageRecipient `json:"recipients,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body,omitempty"`
IncludeLinkToClientInvoice *bool `json:"include_link_to_client_invoice,omitempty"`
AttachPDF *bool `json:"attach_pdf,omitempty"`
SendMeACopy *bool `json:"send_me_a_copy,omitempty"`
ThankYou *bool `json:"thank_you,omitempty"`
}
InvoiceMessageInput is used to create an invoice message (send email).
type InvoiceMessageListOptions ¶
InvoiceMessageListOptions filters invoice message list requests.
func (InvoiceMessageListOptions) QueryParams ¶
func (o InvoiceMessageListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type InvoiceMessageRecipient ¶
InvoiceMessageRecipient represents a recipient of an invoice message.
type InvoiceMessagesResponse ¶
type InvoiceMessagesResponse struct {
InvoiceMessages []InvoiceMessage `json:"invoice_messages"`
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"`
}
InvoiceMessagesResponse is the paginated response for invoice messages.
type InvoicePayment ¶
type InvoicePayment struct {
ID int64 `json:"id"`
Amount float64 `json:"amount"`
PaidAt time.Time `json:"paid_at"`
PaidDate string `json:"paid_date"`
RecordedBy string `json:"recorded_by"`
RecordedByEmail string `json:"recorded_by_email"`
Notes string `json:"notes"`
TransactionID string `json:"transaction_id"`
PaymentGateway *PaymentGatewayRef `json:"payment_gateway"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
InvoicePayment represents a payment on an invoice.
type InvoicePaymentInput ¶
type InvoicePaymentInput struct {
Amount float64 `json:"amount"`
PaidAt string `json:"paid_at,omitempty"`
PaidDate string `json:"paid_date,omitempty"`
Notes string `json:"notes,omitempty"`
}
InvoicePaymentInput is used to create an invoice payment.
type InvoicePaymentListOptions ¶
InvoicePaymentListOptions filters invoice payment list requests.
func (InvoicePaymentListOptions) QueryParams ¶
func (o InvoicePaymentListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type InvoicePaymentsResponse ¶
type InvoicePaymentsResponse struct {
InvoicePayments []InvoicePayment `json:"invoice_payments"`
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"`
}
InvoicePaymentsResponse is the paginated response for invoice payments.
type InvoiceRef ¶
InvoiceRef is a reference to an invoice in nested objects.
type InvoiceTimeImport ¶
type InvoiceTimeImport struct {
SummaryType string `json:"summary_type,omitempty"` // task, project, people, detailed
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}
InvoiceTimeImport specifies how to import time entries.
type InvoicesResponse ¶
type InvoicesResponse struct {
Invoices []Invoice `json:"invoices"`
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"`
}
InvoicesResponse is the paginated response for invoices.
type MyProjectAssignmentsOptions ¶
MyProjectAssignmentsOptions filters my project assignments requests.
func (MyProjectAssignmentsOptions) QueryParams ¶
func (o MyProjectAssignmentsOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type MyProjectAssignmentsResponse ¶
type MyProjectAssignmentsResponse struct {
ProjectAssignments []ProjectAssignment `json:"project_assignments"`
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"`
}
MyProjectAssignmentsResponse is the paginated response for user's project assignments.
type NotFoundError ¶
NotFoundError indicates a resource was not found.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type Pagination ¶
type Pagination struct {
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"`
}
Pagination contains common pagination fields.
type PaginationLinks ¶
type PaginationLinks struct {
First string `json:"first"`
Previous string `json:"previous"`
Next string `json:"next"`
Last string `json:"last"`
}
PaginationLinks contains links for paginated responses.
type PaymentGatewayRef ¶
PaymentGatewayRef is a reference to a payment gateway.
type Project ¶
type Project struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
IsActive bool `json:"is_active"`
IsBillable bool `json:"is_billable"`
IsFixedFee bool `json:"is_fixed_fee"`
BillBy string `json:"bill_by"`
HourlyRate *float64 `json:"hourly_rate"`
BudgetBy string `json:"budget_by"`
BudgetIsMonthly bool `json:"budget_is_monthly"`
Budget *float64 `json:"budget"`
CostBudget *float64 `json:"cost_budget"`
CostBudgetIncludeExpenses bool `json:"cost_budget_include_expenses"`
NotifyWhenOverBudget bool `json:"notify_when_over_budget"`
OverBudgetNotificationPercentage float64 `json:"over_budget_notification_percentage"`
OverBudgetNotificationDate *string `json:"over_budget_notification_date"`
ShowBudgetToAll bool `json:"show_budget_to_all"`
Fee *float64 `json:"fee"`
Notes string `json:"notes"`
StartsOn *string `json:"starts_on"`
EndsOn *string `json:"ends_on"`
Client ProjectClientRef `json:"client"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Project represents a Harvest project.
type ProjectAssignment ¶
type ProjectAssignment struct {
ID int64 `json:"id"`
IsProjectManager bool `json:"is_project_manager"`
IsActive bool `json:"is_active"`
Budget *float64 `json:"budget"`
HourlyRate *float64 `json:"hourly_rate"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Project ProjectRef `json:"project"`
Client ClientRef `json:"client"`
TaskAssignments []ProjectTaskAssignment `json:"task_assignments"`
}
ProjectAssignment represents a user's assignment to a project (from my/project_assignments).
type ProjectBudgetReportOptions ¶
ProjectBudgetReportOptions contains options for project budget reports.
func (ProjectBudgetReportOptions) QueryParams ¶
func (o ProjectBudgetReportOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type ProjectBudgetReportResponse ¶
type ProjectBudgetReportResponse struct {
Results []ProjectBudgetReportResult `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"`
}
ProjectBudgetReportResponse is the paginated response for project budget reports.
type ProjectBudgetReportResult ¶
type ProjectBudgetReportResult struct {
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
ClientID int64 `json:"client_id"`
ClientName string `json:"client_name"`
BudgetIsMonthly bool `json:"budget_is_monthly"`
BudgetBy string `json:"budget_by"`
IsActive bool `json:"is_active"`
Budget *float64 `json:"budget"`
BudgetSpent float64 `json:"budget_spent"`
BudgetRemaining float64 `json:"budget_remaining"`
}
ProjectBudgetReportResult represents a single row in a project budget report.
type ProjectClientRef ¶
type ProjectClientRef struct {
ID int64 `json:"id"`
Name string `json:"name"`
Currency string `json:"currency"`
}
ProjectClientRef is the client reference within a project (includes currency).
type ProjectInput ¶
type ProjectInput 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"`
HourlyRate *float64 `json:"hourly_rate,omitempty"`
BudgetBy string `json:"budget_by,omitempty"`
BudgetIsMonthly *bool `json:"budget_is_monthly,omitempty"`
Budget *float64 `json:"budget,omitempty"`
CostBudget *float64 `json:"cost_budget,omitempty"`
CostBudgetIncludeExpenses *bool `json:"cost_budget_include_expenses,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"`
Fee *float64 `json:"fee,omitempty"`
Notes *string `json:"notes,omitempty"`
StartsOn *string `json:"starts_on,omitempty"`
EndsOn *string `json:"ends_on,omitempty"`
}
ProjectInput is used to create or update a project.
type ProjectListOptions ¶
type ProjectListOptions struct {
IsActive *bool
ClientID int64
UpdatedSince string
Page int
PerPage int
}
ProjectListOptions filters project list requests.
func (ProjectListOptions) QueryParams ¶
func (o ProjectListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type ProjectRef ¶
type ProjectRef struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code,omitempty"`
}
ProjectRef is a reference to a project in nested objects.
type ProjectTaskAssignment ¶
type ProjectTaskAssignment struct {
ID int64 `json:"id"`
Billable bool `json:"billable"`
IsActive bool `json:"is_active"`
HourlyRate *float64 `json:"hourly_rate"`
Budget *float64 `json:"budget"`
Task TaskRef `json:"task"`
}
ProjectTaskAssignment represents a task assignment within a project assignment.
type ProjectsResponse ¶
type ProjectsResponse struct {
Projects []Project `json:"projects"`
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"`
}
ProjectsResponse is the paginated response for projects.
type RateLimitError ¶
RateLimitError indicates the API rate limit was exceeded.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter tracks API rate limits from response headers. Supports both reactive (general API) and proactive (reports) modes.
func NewGeneralRateLimiter ¶
func NewGeneralRateLimiter() *RateLimiter
NewGeneralRateLimiter creates a rate limiter for general API calls. Harvest: 100 requests / 15 seconds (reactive).
func NewRateLimiter ¶
func NewRateLimiter(limit int, window time.Duration, proactive bool) *RateLimiter
NewRateLimiter creates a rate limiter. proactive=true for reports API (must track and wait).
func NewReportsRateLimiter ¶
func NewReportsRateLimiter() *RateLimiter
NewReportsRateLimiter creates a rate limiter for reports API. Harvest: 100 requests / 15 minutes (proactive).
func (*RateLimiter) Remaining ¶
func (rl *RateLimiter) Remaining() int
Remaining returns current remaining requests.
func (*RateLimiter) UpdateFromHeaders ¶
func (rl *RateLimiter) UpdateFromHeaders(h http.Header)
UpdateFromHeaders updates rate limit state from Harvest API headers. Headers: X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After.
type Receipt ¶
type Receipt struct {
URL string `json:"url"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
ContentType string `json:"content_type"`
}
Receipt represents an expense receipt attachment.
type ReportListOptions ¶
type ReportListOptions struct {
From string // Required for most reports (YYYY-MM-DD)
To string // Required for most reports (YYYY-MM-DD)
Page int
PerPage int
}
ReportListOptions contains common options for report requests.
func (ReportListOptions) QueryParams ¶
func (o ReportListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type RetainerRef ¶
type RetainerRef struct {
ID int64 `json:"id"`
}
RetainerRef is a reference to a retainer.
type RetryTransport ¶
type RetryTransport struct {
Base http.RoundTripper
MaxRetries429 int
MaxRetries5xx int
BaseDelay time.Duration
CircuitBreaker *CircuitBreaker
RateLimiter *RateLimiter
}
RetryTransport wraps an http.RoundTripper with retry logic.
func NewRetryTransport ¶
func NewRetryTransport(base http.RoundTripper) *RetryTransport
NewRetryTransport creates a transport with sensible defaults.
type Task ¶
type Task struct {
ID int64 `json:"id"`
Name string `json:"name"`
BillableByDefault bool `json:"billable_by_default"`
DefaultHourlyRate float64 `json:"default_hourly_rate"`
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 Harvest task.
type TaskAssignment ¶
type TaskAssignment struct {
ID int64 `json:"id"`
Billable bool `json:"billable"`
IsActive bool `json:"is_active"`
HourlyRate *float64 `json:"hourly_rate"`
Budget *float64 `json:"budget"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
TaskAssignment represents a task's assignment to a project.
type TaskInput ¶
type TaskInput 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"`
}
TaskInput is used to create or update a task.
type TaskListOptions ¶
TaskListOptions filters task list requests.
func (TaskListOptions) QueryParams ¶
func (o TaskListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type TasksResponse ¶
type TasksResponse struct {
Tasks []Task `json:"tasks"`
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"`
}
TasksResponse is the paginated response for tasks.
type TimeEntriesResponse ¶
type TimeEntriesResponse struct {
TimeEntries []TimeEntry `json:"time_entries"`
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"`
}
TimeEntriesResponse is the paginated response for time entries.
type TimeEntry ¶
type TimeEntry struct {
ID int64 `json:"id"`
SpentDate string `json:"spent_date"`
Hours float64 `json:"hours"`
HoursWithoutTimer float64 `json:"hours_without_timer"`
RoundedHours float64 `json:"rounded_hours"`
Notes string `json:"notes"`
IsLocked bool `json:"is_locked"`
LockedReason string `json:"locked_reason"`
IsClosed bool `json:"is_closed"`
ApprovalStatus string `json:"approval_status"`
IsBilled bool `json:"is_billed"`
TimerStartedAt *time.Time `json:"timer_started_at"`
StartedTime string `json:"started_time"`
EndedTime string `json:"ended_time"`
IsRunning bool `json:"is_running"`
Billable bool `json:"billable"`
Budgeted bool `json:"budgeted"`
BillableRate *float64 `json:"billable_rate"`
CostRate *float64 `json:"cost_rate"`
User UserRef `json:"user"`
Client ClientRef `json:"client"`
Project ProjectRef `json:"project"`
Task TaskRef `json:"task"`
UserAssignment *UserAssignment `json:"user_assignment"`
TaskAssignment *TaskAssignment `json:"task_assignment"`
Invoice *InvoiceRef `json:"invoice"`
ExternalReference *ExternalReference `json:"external_reference"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
TimeEntry represents a Harvest time entry.
type TimeEntryApprovalRequest ¶
type TimeEntryApprovalRequest struct {
TimeEntryIDs []int64 `json:"time_entry_ids"`
}
TimeEntryApprovalRequest is the request body for approval actions.
type TimeEntryInput ¶
type TimeEntryInput struct {
UserID *int64 `json:"user_id,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
TaskID int64 `json:"task_id,omitempty"`
SpentDate string `json:"spent_date,omitempty"`
Hours *float64 `json:"hours,omitempty"`
Notes *string `json:"notes,omitempty"`
StartedTime *string `json:"started_time,omitempty"`
EndedTime *string `json:"ended_time,omitempty"`
ExternalReference *ExternalReference `json:"external_reference,omitempty"`
}
TimeEntryInput is used to create or update a time entry.
type TimeEntryListOptions ¶
type TimeEntryListOptions struct {
From string
To string
UserID int64
ProjectID int64
ClientID int64
TaskID int64
ExternalReferenceID string
IsBilled *bool
IsRunning *bool
ApprovalStatus string // "unsubmitted", "submitted", "approved"
UpdatedSince string
Page int
PerPage int
}
TimeEntryListOptions filters time entry list requests.
func (TimeEntryListOptions) QueryParams ¶
func (o TimeEntryListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type TimeReportResult ¶
type TimeReportResult struct {
ClientID int64 `json:"client_id,omitempty"`
ClientName string `json:"client_name,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
ProjectName string `json:"project_name,omitempty"`
TaskID int64 `json:"task_id,omitempty"`
TaskName string `json:"task_name,omitempty"`
UserID int64 `json:"user_id,omitempty"`
UserName string `json:"user_name,omitempty"`
TotalHours float64 `json:"total_hours"`
BillableHours float64 `json:"billable_hours"`
Currency string `json:"currency,omitempty"`
BillableAmount float64 `json:"billable_amount"`
WeeklyCapacity int `json:"weekly_capacity,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
IsContractor bool `json:"is_contractor,omitempty"`
}
TimeReportResult represents a single row in a time report.
type TimeReportsResponse ¶
type TimeReportsResponse struct {
Results []TimeReportResult `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"`
}
TimeReportsResponse is the paginated response for time reports.
type UninvoicedReportResponse ¶
type UninvoicedReportResponse struct {
Results []UninvoicedReportResult `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"`
}
UninvoicedReportResponse is the paginated response for uninvoiced reports.
type UninvoicedReportResult ¶
type UninvoicedReportResult 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 float64 `json:"total_hours"`
UninvoicedHours float64 `json:"uninvoiced_hours"`
UninvoicedExpenses float64 `json:"uninvoiced_expenses"`
UninvoicedAmount float64 `json:"uninvoiced_amount"`
}
UninvoicedReportResult represents a single row in an uninvoiced report.
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"`
Timezone string `json:"timezone"`
HasAccessToAllFutureProjects bool `json:"has_access_to_all_future_projects"`
IsContractor bool `json:"is_contractor"`
IsActive bool `json:"is_active"`
WeeklyCapacity int `json:"weekly_capacity"`
DefaultHourlyRate *float64 `json:"default_hourly_rate"`
CostRate *float64 `json:"cost_rate"`
Roles []string `json:"roles"`
AccessRoles []string `json:"access_roles"`
AvatarURL string `json:"avatar_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User represents a Harvest user.
type UserAssignment ¶
type UserAssignment struct {
ID int64 `json:"id"`
IsProjectManager bool `json:"is_project_manager"`
IsActive bool `json:"is_active"`
Budget *float64 `json:"budget"`
HourlyRate *float64 `json:"hourly_rate"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
UserAssignment represents a user's assignment to a project.
type UserInput ¶
type UserInput struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Email string `json:"email,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"`
AccessRoles []string `json:"access_roles,omitempty"`
}
UserInput is used to create or update a user.
type UserListOptions ¶
UserListOptions filters user list requests.
func (UserListOptions) QueryParams ¶
func (o UserListOptions) QueryParams() string
QueryParams converts options to URL query parameters.
type UsersResponse ¶
type UsersResponse struct {
Users []User `json:"users"`
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"`
}
UsersResponse is the paginated response for users.
type ValidationError ¶
ValidationError contains field-level validation errors.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string