Documentation
¶
Index ¶
- type Account
- type Address
- type Connection
- type ConnectionsResponse
- type Contact
- type ContactBase
- type ContactsResponse
- type CreatePaymentResponse
- type HTTPMethod
- type Invoice
- type InvoiceBase
- type InvoiceStatus
- type InvoiceType
- type InvoicesResponse
- type Item
- type LineItem
- type OAuth2ClientCrendentials
- type OnlineInvoice
- type OnlineInvoicesResponse
- type Params
- type Payment
- type Phone
- type PhoneType
- type XeroClient
- func (c *XeroClient) CreateContact(contact *ContactBase) (*Contact, error)
- func (c *XeroClient) CreateInvoice(invoice *InvoiceBase) (*Invoice, error)
- func (c *XeroClient) CreatePayment(payment *Payment) (*Payment, error)
- func (c *XeroClient) GetConnections() (*ConnectionsResponse, error)
- func (c *XeroClient) GetContactById(contactID string) (*Contact, error)
- func (c *XeroClient) GetContacts() (*ContactsResponse, error)
- func (c *XeroClient) GetInvoiceAsPDF(invoiceID string) ([]byte, error)
- func (c *XeroClient) GetInvoiceAsURL(invoiceID string) (*url.URL, error)
- func (c *XeroClient) GetInvoiceByID(invoiceID string) (*Invoice, error)
- func (c *XeroClient) GetInvoices() (*InvoicesResponse, error)
- func (c *XeroClient) PayInvoice(invoiceID string, accountID string, amount float64) error
- func (c *XeroClient) SendInvoiceAsEmail(invoiceID string) error
- func (c *XeroClient) SetDebug(debug bool)
- func (c *XeroClient) SetupBaseRequest(method HTTPMethod, entity string) http.Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { AddressType string `json:"AddressType,omitempty"` AddressLine1 string `json:"AddressLine1,omitempty"` AddressLine2 string `json:"AddressLine2,omitempty"` AddressLine3 string `json:"AddressLine3,omitempty"` AddressLine4 string `json:"AddressLine4,omitempty"` City string `json:"City,omitempty"` Region string `json:"Region,omitempty"` PostalCode string `json:"PostalCode,omitempty"` Country string `json:"Country,omitempty"` }
type Connection ¶
type ConnectionsResponse ¶
type ConnectionsResponse struct {
Connections []Connection `json:"connections"`
}
type Contact ¶
type Contact struct { ContactID string `json:"ContactID,omitempty"` ContactStatus string `json:"ContactStatus,omitempty"` Name string `json:"Name,omitempty"` FirstName string `json:"FirstName,omitempty"` LastName string `json:"LastName,omitempty"` EmailAddress string `json:"EmailAddress,omitempty"` BankAccountDetails string `json:"BankAccountDetails,omitempty"` CompanyNumber string `json:"CompanyNumber,omitempty"` TaxNumber string `json:"TaxNumber,omitempty"` AccountsReceivableTaxType string `json:"AccountsReceivableTaxType,omitempty"` AccountsPayableTaxType string `json:"AccountsPayableTaxType,omitempty"` Addresses []Address `json:"Addresses,omitempty"` Phones []Phone `json:"Phones,omitempty"` ContactGroups []interface{} `json:"ContactGroups,omitempty"` IsSupplier bool `json:"IsSupplier,omitempty"` IsCustomer bool `json:"IsCustomer,omitempty"` DefaultCurrency string `json:"DefaultCurrency,omitempty"` XeroNetworkKey string `json:"XeroNetworkKey,omitempty"` SalesTrackingCategories []interface{} `json:"SalesTrackingCategories,omitempty"` PurchasesTrackingCategories []interface{} `json:"PurchasesTrackingCategories,omitempty"` ContactPersons []interface{} `json:"ContactPersons,omitempty"` HasValidationErrors bool `json:"HasValidationErrors,omitempty"` UpdatedDateUTC string `json:"UpdatedDateUTC,omitempty"` }
type ContactBase ¶
type ContactBase struct { Name string `json:"Name,omitempty"` FirstName string `json:"FirstName,omitempty"` LastName string `json:"LastName,omitempty"` EmailAddress string `json:"EmailAddress,omitempty"` BankAccountDetails string `json:"BankAccountDetails,omitempty"` CompanyNumber string `json:"CompanyNumber,omitempty"` TaxNumber string `json:"TaxNumber,omitempty"` AccountsReceivableTaxType string `json:"AccountsReceivableTaxType,omitempty"` AccountsPayableTaxType string `json:"AccountsPayableTaxType,omitempty"` Addresses []Address `json:"Addresses,omitempty"` Phones []Phone `json:"Phones,omitempty"` DefaultCurrency string `json:"DefaultCurrency,omitempty"` XeroNetworkKey string `json:"XeroNetworkKey,omitempty"` }
type ContactsResponse ¶
type ContactsResponse struct {
Contacts []Contact `json:"Contacts"`
}
type CreatePaymentResponse ¶ added in v0.3.0
type CreatePaymentResponse struct {
Payments []Payment `json:"Payments"`
}
type HTTPMethod ¶
type HTTPMethod string
const ( GET HTTPMethod = "GET" POST HTTPMethod = "POST" PUT HTTPMethod = "PUT" PATCH HTTPMethod = "PATCH" DELETE HTTPMethod = "DELETE" )
func (HTTPMethod) String ¶
func (m HTTPMethod) String() string
type Invoice ¶
type Invoice struct { InvoiceID string `json:"InvoiceID,omitempty"` Type InvoiceType `json:"Type,omitempty"` InvoiceNumber string `json:"InvoiceNumber,omitempty"` Reference string `json:"Reference,omitempty"` AmountDue float64 `json:"AmountDue,omitempty"` AmountPaid float64 `json:"AmountPaid,omitempty"` SentToContact bool `json:"SentToContact,omitempty"` CurrencyRate float64 `json:"CurrencyRate,omitempty"` IsDiscounted bool `json:"IsDiscounted,omitempty"` HasErrors bool `json:"HasErrors,omitempty"` Contact *Contact `json:"Contact,omitempty"` DateString string `json:"DateString,omitempty"` Date string `json:"Date,omitempty"` DueDateString string `json:"DueDateString,omitempty"` DueDate string `json:"DueDate,omitempty"` BrandingThemeID string `json:"BrandingThemeID,omitempty"` Status InvoiceStatus `json:"Status,omitempty"` SubTotal float64 `json:"SubTotal,omitempty"` TotalTax float64 `json:"TotalTax,omitempty"` Total float64 `json:"Total,omitempty"` UpdatedDateUTC string `json:"UpdatedDateUTC,omitempty"` CurrencyCode string `json:"CurrencyCode,omitempty"` Reason string `json:"Reason,omitempty"` OrderRef string `json:"OrderRef,omitempty"` LineItems []LineItem `json:"LineItems"` }
type InvoiceBase ¶
type InvoiceBase struct { Type InvoiceType `json:"Type,omitempty"` InvoiceNumber string `json:"InvoiceNumber,omitempty"` Reference string `json:"Reference,omitempty"` AmountDue float64 `json:"AmountDue,omitempty"` AmountPaid float64 `json:"AmountPaid,omitempty"` SentToContact bool `json:"SentToContact,omitempty"` CurrencyRate float64 `json:"CurrencyRate,omitempty"` IsDiscounted bool `json:"IsDiscounted,omitempty"` HasErrors bool `json:"HasErrors,omitempty"` Contact Contact `json:"Contact"` DateString string `json:"DateString,omitempty"` Date string `json:"Date,omitempty"` DueDateString string `json:"DueDateString,omitempty"` DueDate string `json:"DueDate,omitempty"` BrandingThemeID string `json:"BrandingThemeID,omitempty"` Status InvoiceStatus `json:"Status,omitempty"` SubTotal float64 `json:"SubTotal,omitempty"` TotalTax float64 `json:"TotalTax,omitempty"` Total float64 `json:"Total,omitempty"` UpdatedDateUTC string `json:"UpdatedDateUTC,omitempty"` CurrencyCode string `json:"CurrencyCode"` Reason string `json:"Reason,omitempty"` OrderRef string `json:"OrderRef,omitempty"` LineItems []LineItem `json:"LineItems"` }
type InvoiceStatus ¶
type InvoiceStatus int
const ( Draft InvoiceStatus = iota // The default status if this element is not provided with your API call Submitted // Useful if there is an approval process required Deleted // An invoice with a status of DELETED will not be included in the Aged Receivables Report Authorised // The "approved" state of an invoice ready for sending to a customer Paid // Once an invoice is fully paid, the status will change to PAID Voided // If an invoice is no longer required, it can be voided )
func (*InvoiceStatus) MarshalJSON ¶
func (is *InvoiceStatus) MarshalJSON() ([]byte, error)
func (InvoiceStatus) String ¶
func (is InvoiceStatus) String() string
func (*InvoiceStatus) UnmarshalJSON ¶
func (is *InvoiceStatus) UnmarshalJSON(data []byte) error
type InvoiceType ¶
type InvoiceType int
const ( ACCPAY InvoiceType = iota // A bill – commonly known as an Accounts Payable or supplier invoice ACCREC // A sales invoice – commonly known as an Accounts Receivable or customer invoice )
func (*InvoiceType) MarshalJSON ¶
func (it *InvoiceType) MarshalJSON() ([]byte, error)
func (InvoiceType) String ¶
func (it InvoiceType) String() string
func (*InvoiceType) UnmarshalJSON ¶
func (it *InvoiceType) UnmarshalJSON(data []byte) error
type InvoicesResponse ¶
type InvoicesResponse struct {
Invoices []Invoice `json:"Invoices"`
}
type LineItem ¶
type LineItem struct { LineItemId string `json:"LineItemId,omitempty"` // Description string `json:"Description,omitempty"` // Quantity float32 `json:"Quantity,omitempty"` // UnitAmount float32 `json:"UnitAmount,omitempty"` // Lineitem unit amount. By default, unit amount will be rounded to two decimal places. You can opt in to use four decimal places by adding the querystring parameter unitdp=4 to your query. See the Rounding in Xero guide for more information. ItemCode string `json:"ItemCode,omitempty"` // AccountCode string `json:"AccountCode,omitempty"` // AccountId string `json:"AccountId,omitempty"` // TaxType string `json:"TaxType,omitempty"` // TaxAmount float32 `json:"TaxAmount,omitempty"` // The tax amount is auto calculated as a percentage of the line amount based on the tax rate LineAmount float32 `json:"LineAmount,omitempty"` // The line amount reflects the discounted price if a DiscountRate has been used i.e LineAmount = Quantity * Unit Amount * ((100 – DiscountRate)/100) DiscountRate float32 `json:"DiscountRate,omitempty"` // Percentage discount being applied to a line item. Only supported on ACCREC invoices and quotes. ACCPAY invoices and credit notes in Xero do not support discounts DiscountAmount float32 `json:"DiscountAmount,omitempty"` // Discount amount being applied to a line item. Only supported on ACCREC invoices and quotes. ACCPAY invoices and credit notes in Xero do not support discounts }
type OnlineInvoice ¶
type OnlineInvoice struct {
OnlineInvoiceUrl string `json:"OnlineInvoiceUrl"`
}
type OnlineInvoicesResponse ¶
type OnlineInvoicesResponse struct {
OnlineInvoices []OnlineInvoice `json:"OnlineInvoices"`
}
type PhoneType ¶
type PhoneType int
func (*PhoneType) MarshalJSON ¶
func (*PhoneType) UnmarshalJSON ¶
type XeroClient ¶
type XeroClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(ctx context.Context, baseURL string, credentials OAuth2ClientCrendentials, params Params, scopes []string) (*XeroClient, error)
func (*XeroClient) CreateContact ¶
func (c *XeroClient) CreateContact(contact *ContactBase) (*Contact, error)
func (*XeroClient) CreateInvoice ¶
func (c *XeroClient) CreateInvoice(invoice *InvoiceBase) (*Invoice, error)
func (*XeroClient) CreatePayment ¶ added in v0.3.0
func (c *XeroClient) CreatePayment(payment *Payment) (*Payment, error)
func (*XeroClient) GetConnections ¶
func (c *XeroClient) GetConnections() (*ConnectionsResponse, error)
func (*XeroClient) GetContactById ¶
func (c *XeroClient) GetContactById(contactID string) (*Contact, error)
func (*XeroClient) GetContacts ¶
func (c *XeroClient) GetContacts() (*ContactsResponse, error)
func (*XeroClient) GetInvoiceAsPDF ¶ added in v0.2.4
func (c *XeroClient) GetInvoiceAsPDF(invoiceID string) ([]byte, error)
func (*XeroClient) GetInvoiceAsURL ¶
func (c *XeroClient) GetInvoiceAsURL(invoiceID string) (*url.URL, error)
https://developer.xero.com/documentation/api/accounting/invoices#retrieving-the-online-invoice-url
func (*XeroClient) GetInvoiceByID ¶
func (c *XeroClient) GetInvoiceByID(invoiceID string) (*Invoice, error)
func (*XeroClient) GetInvoices ¶
func (c *XeroClient) GetInvoices() (*InvoicesResponse, error)
func (*XeroClient) PayInvoice ¶ added in v0.3.0
func (c *XeroClient) PayInvoice(invoiceID string, accountID string, amount float64) error
func (*XeroClient) SendInvoiceAsEmail ¶
func (c *XeroClient) SendInvoiceAsEmail(invoiceID string) error
func (*XeroClient) SetDebug ¶ added in v0.2.0
func (c *XeroClient) SetDebug(debug bool)
func (*XeroClient) SetupBaseRequest ¶
func (c *XeroClient) SetupBaseRequest(method HTTPMethod, entity string) http.Request
Click to show internal directories.
Click to hide internal directories.