Documentation
¶
Index ¶
Constants ¶
const (
// ApiBase is the base url for the seed api
ApiBase = "https://api.seed.co/v1/public"
)
const (
// MaxBatchSize is the maximum pagination limit for a transaction query
MaxBatchSize = 1000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balance ¶
type Balance struct { // Checking Account ID specifies the id of the checking account that this balance belongs to CheckingAccountID string `json:"checking_account_id"` // Total Available refers to the balance that is safely usable // this number is calculated in the following way TotalAvailable = Accessible - PendingDebits - ScheduledDebits TotalAvailable int64 `json:"total_available"` // Settled refers to the total amount of transactions that have settled Settled int64 `json:"settled"` // PendingCredits refers to credits that are pending PendingCredits uint64 `json:"pending_credits"` // PendingDebits refers to debits that are pending PendingDebits uint64 `json:"pending_debits"` // ScheduledDebits refers to debits that are scheduled ScheduledDebits uint64 `json:"scheduled_debits"` // Accessible refers to the balance is usable Accessible int64 `json:"accessible"` // Lockbox refers to the amount in the virtual lockbox Lockbox uint64 `json:"lockbox"` }
Balance contains relevant balance amounts for a given checking account
type BalanceRequest ¶
type BalanceRequest struct { // Checking Account ID specifies the id of the checking account for the balance in question // Must be a uuid that corresponds to a valid checking account CheckingAccountID string // Client is the seed client Client *Client }
BalanceRequest is a request for fetching a balance for a given checking account
func (*BalanceRequest) Get ¶
func (b *BalanceRequest) Get() (Balance, error)
Get retrieves the balance
type BalanceResponse ¶
type BalanceResponse struct { // Errors is a list of errors Errors ErrorList `json:"errors"` // Results is a slice of Balance objects. The size of this slice is expected to be 1 Results []Balance `json:"results"` }
BalanceResponse is the struct that the server response will get unmarshalled into
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a seed client that can be used to create different request objects to fetch data
func (*Client) NewBalanceRequest ¶
func (c *Client) NewBalanceRequest() *BalanceRequest
NewBalanceRequest creates a new balance request
func (*Client) SetClientVersion ¶
SetClientVersion sets the client version that each request will be made with
type Pages ¶
type Pages struct { // Next is the set of parameters for the next page Next PaginationParams `json:"next"` // Previous is the set of parameters for the previous page Previous PaginationParams `json:"previous"` }
Pages contains pagination information
type PaginationParams ¶
type PaginationParams struct { // Offset is the pagination offset index Offset int `json:"offest"` // Limit is the pagination limit Limit int `json:"limit"` }
PaginationParams encapsulates the two pagination values, offset and limit
func (PaginationParams) Encode ¶
func (p PaginationParams) Encode() string
Encode encodes offset and limit into a url query string
func (PaginationParams) MarshalJSON ¶
func (p PaginationParams) MarshalJSON() ([]byte, error)
MarshalJSON marshalls pagination params
func (*PaginationParams) UnmarshalJSON ¶
func (p *PaginationParams) UnmarshalJSON(d []byte) error
UnmarshalJSON unmarshalls pagination params
type Transaction ¶
type Transaction struct { // Date is the date of the transaction Date time.Time `json:"date"` // Description is the description of the transaction Description string `json:"description"` // Amount is the amount of the transaction in cents Amount int64 `json:"amount"` // Error contains any errors that happened with the transaction Error string `json:"error"` // Status is either "pending" or "settled" Status string `json:"status"` // Category is the category of the transaction Category string `json:"category"` }
Transaction contains relevant information about a transaction
type TransactionsIterator ¶
type TransactionsIterator struct {
// contains filtered or unexported fields
}
TransactionsIterator is an iterator to iterate through pages of transaction results
func (*TransactionsIterator) Next ¶
func (t *TransactionsIterator) Next() ([]Transaction, error)
Next will retrieve the next batch of transactions. It returns a slice of Transactions, and any http errors
func (*TransactionsIterator) Previous ¶
func (t *TransactionsIterator) Previous() ([]Transaction, error)
Previous will retrieve the previous batch of transactions. It returns a slice of Transactions, and any errors that happen
func (*TransactionsIterator) SetBatchSize ¶
func (t *TransactionsIterator) SetBatchSize(n int)
SetBatchSize sets the batch size for paginated results
type TransactionsRequest ¶
type TransactionsRequest struct { // CheckingAccountID is a uuid of the checking account for the transaction request CheckingAccountID string // Status is either "pending" or "settled" Status string // From is the start date of the date range, inclusive From time.Time // To is the end date of the date range, exclusive To time.Time // Client is the seed client that will send the request Client *Client }
TransactionsRequest contains fields for querying transactions
func (*TransactionsRequest) Get ¶
func (t *TransactionsRequest) Get() ([]Transaction, error)
Get retrieves a list of transactions
func (*TransactionsRequest) Iterator ¶
func (t *TransactionsRequest) Iterator() TransactionsIterator
Iterator returns a TransactionIterator
type TransactionsResponse ¶
type TransactionsResponse struct { // Errors is a list of errors Errors ErrorList `json:"errors"` // Results is a slice of transaction objects Results []Transaction `json:"results"` // Pages contains pagination information Pages Pages `json:"pages"` }
TransactionsResponse is the response object that the server data unmarshalls into