api

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	// BaseURL is the Harvest API base URL.
	BaseURL = "https://api.harvestapp.com/v2"
	// ContentType for JSON requests.
	ContentType = "application/json"
)
View Source
const (
	ExitSuccess   = 0
	ExitError     = 1
	ExitUsage     = 2
	ExitAuth      = 3
	ExitNotFound  = 4
	ExitRateLimit = 5
)

Exit codes for CLI.

View Source
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

View Source
var (
	ErrNotAuthenticated = errors.New("not authenticated")
	ErrRateLimited      = errors.New("rate limit exceeded")
	ErrNotFound         = errors.New("not found")
)

Sentinel errors.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode maps an error to an appropriate CLI exit code.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Details    string
}

APIError represents an error response from the Harvest API.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) ExitCode

func (e *APIError) ExitCode() int

ExitCode returns the appropriate CLI exit code for this error.

type AuthError

type AuthError struct {
	Err error
}

AuthError wraps authentication-related errors.

func (*AuthError) Error

func (e *AuthError) Error() string

func (*AuthError) Unwrap

func (e *AuthError) Unwrap() error

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

func (c *Client) ApproveTimeEntries(ctx context.Context, ids []int64) error

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

func (c *Client) CreateEstimate(ctx context.Context, input *EstimateInput) (*Estimate, error)

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

func (c *Client) CreateExpense(ctx context.Context, input *ExpenseInput) (*Expense, error)

CreateExpense creates a new expense.

func (*Client) CreateInvoice

func (c *Client) CreateInvoice(ctx context.Context, input *InvoiceInput) (*Invoice, error)

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

func (c *Client) CreateProject(ctx context.Context, input *ProjectInput) (*Project, error)

CreateProject creates a new project.

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, input *TaskInput) (*Task, error)

CreateTask creates a new task.

func (*Client) CreateTimeEntry

func (c *Client) CreateTimeEntry(ctx context.Context, input *TimeEntryInput) (*TimeEntry, error)

CreateTimeEntry creates a new time entry.

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, input *UserInput) (*User, error)

CreateUser creates a new user.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) error

Delete performs a DELETE request.

func (*Client) DeleteClient

func (c *Client) DeleteClient(ctx context.Context, id int64) error

DeleteClient deletes a client.

func (*Client) DeleteEstimate

func (c *Client) DeleteEstimate(ctx context.Context, id int64) error

DeleteEstimate deletes an estimate.

func (*Client) DeleteEstimateMessage

func (c *Client) DeleteEstimateMessage(ctx context.Context, estimateID, messageID int64) error

DeleteEstimateMessage deletes an estimate message.

func (*Client) DeleteExpense

func (c *Client) DeleteExpense(ctx context.Context, id int64) error

DeleteExpense deletes an expense.

func (*Client) DeleteInvoice

func (c *Client) DeleteInvoice(ctx context.Context, id int64) error

DeleteInvoice deletes an invoice.

func (*Client) DeleteInvoiceMessage

func (c *Client) DeleteInvoiceMessage(ctx context.Context, invoiceID, messageID int64) error

DeleteInvoiceMessage deletes a message from an invoice.

func (*Client) DeleteInvoicePayment

func (c *Client) DeleteInvoicePayment(ctx context.Context, invoiceID, paymentID int64) error

DeleteInvoicePayment deletes a payment from an invoice.

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, id int64) error

DeleteProject deletes a project.

func (*Client) DeleteTask

func (c *Client) DeleteTask(ctx context.Context, id int64) error

DeleteTask deletes a task.

func (*Client) DeleteTimeEntry

func (c *Client) DeleteTimeEntry(ctx context.Context, id int64) error

DeleteTimeEntry deletes a time entry.

func (*Client) DeleteTimeEntryExternalReference

func (c *Client) DeleteTimeEntryExternalReference(ctx context.Context, id int64) error

DeleteTimeEntryExternalReference deletes the external reference from a time entry.

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id int64) error

DeleteUser deletes a user.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result any) error

Get performs a GET request.

func (*Client) GetClient

func (c *Client) GetClient(ctx context.Context, id int64) (*HarvestClient, error)

GetClient retrieves a single client by ID.

func (*Client) GetCompany

func (c *Client) GetCompany(ctx context.Context) (*Company, error)

GetCompany retrieves the company for the currently authenticated user.

func (*Client) GetEstimate

func (c *Client) GetEstimate(ctx context.Context, id int64) (*Estimate, error)

GetEstimate retrieves a single estimate by ID.

func (*Client) GetExpense

func (c *Client) GetExpense(ctx context.Context, id int64) (*Expense, error)

GetExpense retrieves a single expense by ID.

func (*Client) GetExpenseCategory

func (c *Client) GetExpenseCategory(ctx context.Context, id int64) (*ExpenseCategory, error)

GetExpenseCategory retrieves a single expense category by ID.

func (*Client) GetInvoice

func (c *Client) GetInvoice(ctx context.Context, id int64) (*Invoice, error)

GetInvoice retrieves a single invoice by ID.

func (*Client) GetMe

func (c *Client) GetMe(ctx context.Context) (*User, error)

GetMe retrieves the currently authenticated user.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, id int64) (*Project, error)

GetProject retrieves a single project by ID.

func (*Client) GetReports

func (c *Client) GetReports(ctx context.Context, path string, result any) error

GetReports performs a GET request with reports rate limiting.

func (*Client) GetReportsLimiterStatus

func (c *Client) GetReportsLimiterStatus() (int, bool)

GetReportsLimiterStatus returns current reports rate limit status. Returns (remaining requests, is near limit).

func (*Client) GetRunningTimeEntry

func (c *Client) GetRunningTimeEntry(ctx context.Context) (*TimeEntry, error)

GetRunningTimeEntry returns the currently running time entry for the user, if any.

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, id int64) (*Task, error)

GetTask retrieves a single task by ID.

func (*Client) GetTimeEntry

func (c *Client) GetTimeEntry(ctx context.Context, id int64) (*TimeEntry, error)

GetTimeEntry retrieves a single time entry by ID.

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, id int64) (*User, error)

GetUser retrieves a single user 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

func (c *Client) ListAllExpenses(ctx context.Context, opts ExpenseListOptions) ([]Expense, error)

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

func (c *Client) ListAllInvoices(ctx context.Context, opts InvoiceListOptions) ([]Invoice, error)

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

func (c *Client) ListAllProjects(ctx context.Context, opts ProjectListOptions) ([]Project, error)

ListAllProjects fetches all projects across all pages.

func (*Client) ListAllTasks

func (c *Client) ListAllTasks(ctx context.Context, opts TaskListOptions) ([]Task, error)

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

func (c *Client) ListAllUsers(ctx context.Context, opts UserListOptions) ([]User, error)

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

func (c *Client) MarkEstimateDraft(ctx context.Context, estimateID int64) (*EstimateMessage, error)

MarkEstimateDraft re-opens a closed estimate (converts back to draft).

func (*Client) MarkEstimateSent

func (c *Client) MarkEstimateSent(ctx context.Context, estimateID int64) (*EstimateMessage, error)

MarkEstimateSent marks a draft estimate as sent.

func (*Client) MarkInvoiceClosed

func (c *Client) MarkInvoiceClosed(ctx context.Context, id int64) (*Invoice, error)

MarkInvoiceClosed marks an open invoice as closed.

func (*Client) MarkInvoiceDraft

func (c *Client) MarkInvoiceDraft(ctx context.Context, id int64) (*Invoice, error)

MarkInvoiceDraft marks an invoice as draft (re-open).

func (*Client) MarkInvoiceOpen

func (c *Client) MarkInvoiceOpen(ctx context.Context, id int64) (*Invoice, error)

MarkInvoiceOpen reopens a closed invoice.

func (*Client) MarkInvoiceSent

func (c *Client) MarkInvoiceSent(ctx context.Context, id int64, eventType string) (*Invoice, error)

MarkInvoiceSent marks an open invoice as sent.

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body, result any) error

Patch performs a PATCH request.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body, result any) error

Post performs a POST request.

func (*Client) RejectTimeEntries

func (c *Client) RejectTimeEntries(ctx context.Context, ids []int64) error

RejectTimeEntries rejects submitted time entries (manager action).

func (*Client) RestartTimeEntry

func (c *Client) RestartTimeEntry(ctx context.Context, id int64) (*TimeEntry, error)

RestartTimeEntry restarts a stopped time entry.

func (*Client) SetVersion

func (c *Client) SetVersion(version string)

SetVersion sets the version string for User-Agent.

func (*Client) StopTimeEntry

func (c *Client) StopTimeEntry(ctx context.Context, id int64) (*TimeEntry, error)

StopTimeEntry stops a running time entry.

func (*Client) SubmitTimeEntriesForApproval

func (c *Client) SubmitTimeEntriesForApproval(ctx context.Context, ids []int64) error

SubmitTimeEntriesForApproval submits time entries for manager approval.

func (*Client) UnsubmitTimeEntries

func (c *Client) UnsubmitTimeEntries(ctx context.Context, ids []int64) error

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

func (c *Client) UpdateCompany(ctx context.Context, input *CompanyUpdateInput) (*Company, error)

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

func (c *Client) UpdateTask(ctx context.Context, id int64, input *TaskInput) (*Task, error)

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

func (c *Client) UpdateUser(ctx context.Context, id int64, input *UserInput) (*User, error)

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

func (c *Client) WarnIfNearReportsLimit() string

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

type ClientListOptions struct {
	IsActive     *bool
	UpdatedSince string
	Page         int
	PerPage      int
}

ClientListOptions filters client list requests.

func (ClientListOptions) QueryParams

func (o ClientListOptions) QueryParams() string

QueryParams converts options to URL query parameters.

type ClientRef

type ClientRef struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

ClientRef is a reference to a client in nested objects.

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

type EstimateMessageListOptions struct {
	UpdatedSince string
	Page         int
	PerPage      int
}

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

type ExpenseCategoryListOptions struct {
	IsActive     *bool
	UpdatedSince string
	Page         int
	PerPage      int
}

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

type InvoiceMessageListOptions struct {
	UpdatedSince string
	Page         int
	PerPage      int
}

InvoiceMessageListOptions filters invoice message list requests.

func (InvoiceMessageListOptions) QueryParams

func (o InvoiceMessageListOptions) QueryParams() string

QueryParams converts options to URL query parameters.

type InvoiceMessageRecipient

type InvoiceMessageRecipient struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

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

type InvoicePaymentListOptions struct {
	UpdatedSince string
	Page         int
	PerPage      int
}

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

type InvoiceRef struct {
	ID     int64  `json:"id"`
	Number string `json:"number"`
}

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

type MyProjectAssignmentsOptions struct {
	Page    int
	PerPage int
}

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

type NotFoundError struct {
	Resource string
	ID       string
}

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 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

type PaymentGatewayRef struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

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

type ProjectBudgetReportOptions struct {
	Page     int
	PerPage  int
	IsActive *bool
}

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

type RateLimitError struct {
	RetryAfter time.Duration
}

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.

func (*RateLimiter) Wait

func (rl *RateLimiter) Wait(ctx context.Context) error

Wait blocks if proactive limiting is needed. For proactive limiters, spreads requests across the window.

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.

func (*RetryTransport) RoundTrip

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes the request with retry logic.

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

type TaskListOptions struct {
	IsActive     *bool
	UpdatedSince string
	Page         int
	PerPage      int
}

TaskListOptions filters task list requests.

func (TaskListOptions) QueryParams

func (o TaskListOptions) QueryParams() string

QueryParams converts options to URL query parameters.

type TaskRef

type TaskRef struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

TaskRef is a reference to a task in nested objects.

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.

func (*User) FullName

func (u *User) FullName() string

FullName returns the user's full name.

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

type UserListOptions struct {
	IsActive     *bool
	UpdatedSince string
	Page         int
	PerPage      int
}

UserListOptions filters user list requests.

func (UserListOptions) QueryParams

func (o UserListOptions) QueryParams() string

QueryParams converts options to URL query parameters.

type UserRef

type UserRef struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

UserRef is a reference to a user in nested objects.

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

type ValidationError struct {
	Fields map[string]string
}

ValidationError contains field-level validation errors.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL