Documentation
¶
Index ¶
- func WithClientID(id int64) requestOption
- type Attachment
- type Client
- func (hv *Client) CreateExpense(e *CreateExpense) error
- func (hv *Client) CreateInvoice(invoice *Invoice) error
- func (hv *Client) Customers(opts ...requestOption) iter.Seq2[*Customer, error]
- func (hv *Client) Expenses(opts ...requestOption) iter.Seq2[*Expense, error]
- func (hv *Client) FetchCustomers(opts ...requestOption) ([]*Customer, error)
- func (hv *Client) FetchExpenses(opts ...requestOption) ([]*Expense, error)
- func (hv *Client) FetchInvoices(opts ...requestOption) ([]*Invoice, error)
- func (hv *Client) GetCompanyInfo() (*Company, error)
- func (hv *Client) GetInvoice(id int64) (*Invoice, error)
- func (hv *Client) GetRecipients(customer int64) ([]*Recipient, error)
- func (hv *Client) Invoices(opts ...requestOption) iter.Seq2[*Invoice, error]
- type Company
- type CreateExpense
- type Customer
- type Expense
- type Invoice
- func (i *Invoice) AddPayment(amount float64, date time.Time, notes string) error
- func (i *Invoice) Download() (io.ReadCloser, error)
- func (i *Invoice) GetAttachments() ([]*Attachment, error)
- func (i *Invoice) GetPayments() ([]*Payment, error)
- func (i *Invoice) MarkSent() error
- func (i *Invoice) Send(subject, body string, to []*Recipient) error
- type LineItem
- type Payment
- type PaymentGateway
- type Project
- type Recipient
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithClientID ¶
func WithClientID(id int64) requestOption
Types ¶
type Attachment ¶
func (*Attachment) Download ¶
func (a *Attachment) Download() (io.ReadCloser, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateExpense ¶
func (hv *Client) CreateExpense(e *CreateExpense) error
func (*Client) CreateInvoice ¶
func (*Client) FetchCustomers ¶
func (*Client) FetchExpenses ¶
func (*Client) FetchInvoices ¶
func (*Client) GetCompanyInfo ¶
func (*Client) GetRecipients ¶
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"`
PlanType string `json:"plan_type"`
ExpenseFeature bool `json:"expense_feature"`
InvoiceFeature bool `json:"invoice_feature"`
EstimateFeature bool `json:"estimate_feature"`
ApprovalFeature bool `json:"approval_feature"`
Clock string `json:"clock"`
DecimalSymbol string `json:"decimal_symbol"`
ThousandsSeparator string `json:"thousands_separator"`
ColorScheme string `json:"color_scheme"`
}
type CreateExpense ¶
type Invoice ¶
type Invoice struct {
ID int64 `json:"id,omitempty"`
ClientID int64 `json:"client_id,omitempty"`
ClientKey string `json:"client_key,omitempty"`
Number string `json:"number,omitempty"`
PurchaseOrder string `json:"purchase_order,omitempty"`
State string `json:"state,omitempty"`
SentAt time.Time `json:"sent_at,omitempty"`
PaidAt time.Time `json:"paid_at,omitempty"`
ClosedAt time.Time `json:"closed_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Customer *Customer `json:"client,omitempty"`
Amount float64 `json:"amount,omitempty"`
DueAmount float64 `json:"due_amount,omitempty"`
Tax float64 `json:"tax,omitempty"`
TaxAmount float64 `json:"tax_amount,omitempty"`
Tax2 float64 `json:"tax2,omitempty"`
Tax2Amount float64 `json:"tax2_amount,omitempty"`
Discount float64 `json:"discount,omitempty"`
DiscountAmount float64 `json:"discount_amount,omitempty"`
Subject string `json:"subject,omitempty"`
Notes string `json:"notes,omitempty"`
Currency string `json:"currency,omitempty"`
PeriodStart string `json:"period_start,omitempty"`
PeriodEnd string `json:"period_end,omitempty"`
IssueDate string `json:"issue_date,omitempty"`
DueDate string `json:"due_date,omitempty"`
PaymentTerm string `json:"payment_term,omitempty"`
PaymentOptions []string `json:"payment_options"`
PaidDate string `json:"paid_date,omitempty"`
LineItems []*LineItem `json:"line_items,omitempty"`
Hv *Client `json:"-"`
}
func (*Invoice) AddPayment ¶
func (*Invoice) GetAttachments ¶
func (i *Invoice) GetAttachments() ([]*Attachment, error)
func (*Invoice) GetPayments ¶
type LineItem ¶
type LineItem struct {
// Unique ID for the line item.
ID int64 `json:"id,omitempty"`
// An object containing the associated project’s id, name, and code.
Project *Project `json:"project,omitempty"`
// The name of an invoice item category.
Kind string `json:"kind,omitempty"`
// Text description of the line item.
Description string `json:"description,omitempty"`
// The unit quantity of the item.
Quantity float64 `json:"quantity,omitempty"`
// The individual price per unit.
UnitPrice float64 `json:"unit_price,omitempty"`
// The line item subtotal (quantity * unit_price).
Amount float64 `json:"amount,omitempty"`
// Whether the invoice’s tax percentage applies to this line item.
Taxed bool `json:"taxed,omitempty"`
// Whether the invoice’s tax2 percentage applies to this line item.
Taxed2 bool `json:"taxed_2,omitempty"`
}
type Payment ¶
type Payment struct {
// Unique ID for the payment.
ID int64 `json:"id"`
// The amount of the payment.
Amount float64 `json:"amount"`
// Date and time the payment was made.
PaidAt time.Time `json:"paid_at"`
// Date the payment was made.
PaidDate string `json:"paid_date"`
// The name of the person who recorded the payment.
RecordedBy string `json:"recorded_by"`
// The email of the person who recorded the payment.
RecordedByEmail string `json:"recorded_by_email"`
// Any notes associated with the payment.
Notes string `json:"notes"`
// Either the card authorization or PayPal transaction ID.
TransactionID string `json:"transaction_id"`
// The payment gateway id and name used to process the payment.
PaymentGateway PaymentGateway `json:"payment_gateway"`
// Date and time the payment was recorded.
CreatedAt time.Time `json:"created_at"`
// Date and time the payment was last updated.
UpdatedAt time.Time `json:"updated_at"`
Hv *Client `json:"-"`
}
type PaymentGateway ¶
Click to show internal directories.
Click to hide internal directories.