Documentation ¶
Index ¶
- Constants
- type AccessToken
- type Account
- type AccountResponse
- type Balance
- type BalanceResponse
- type Client
- func (c *Client) GetAccessToken(ctx context.Context, scope TokenScope) (*AccessToken, error)
- func (c *Client) GetAccountBalance(ctx context.Context, accountID string) (*Balance, error)
- func (c *Client) GetAccountTransactions(ctx context.Context, req *TransactionsRequest) (*TransactionsResponse, error)
- func (c *Client) GetAccounts(ctx context.Context) ([]Account, error)
- func (c *Client) SetAccessToken(token *AccessToken) *Client
- func (c *Client) SetProxy(u string) *Client
- func (c *Client) SetToken(token *AccessToken) *Client
- type TokenScope
- type TokenType
- type Transaction
- type TransactionStatus
- type TransactionType
- type TransactionsRequest
- type TransactionsResponse
Constants ¶
const ( TransactionTypeCredit = "CREDIT" TransactionTypeDebit = "DEBIT" )
const (
TransactionStatusPosted = "POSTED"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct { Token string `json:"access_token"` Type TokenType `json:"token_type"` ExpiresIn int64 `json:"expires_in"` Scope TokenScope `json:"scope"` // contains filtered or unexported fields }
AccessToken contains a temporary authorization key.
func (*AccessToken) IsExpired ¶
func (token *AccessToken) IsExpired() bool
IsExpired returns whether the token has expired.
type AccountResponse ¶
type AccountResponse struct { Data struct { Accounts []Account `json:"accounts"` } `json:"data"` Links struct { Self string `json:"self"` } `json:"links"` Metadata struct { TotalPages int64 `json:"totalPages"` } `json:"meta"` }
AccountResponse describes the response data returned for retrieving a list of accounts.
type BalanceResponse ¶
type BalanceResponse struct { Data struct { Balance } `json:"data"` Links struct { Self string `json:"self"` } `json:"links"` Metadata struct { TotalPages int64 `json:"totalPages"` } `json:"meta"` }
BalanceResponse describes the response data returned for retrieving an account's balance.
type Client ¶
type Client struct { ClientID string ClientSecret string // contains filtered or unexported fields }
Client defines a stateful REST client wrapper for the Investec Open API.
func NewClientForTesting ¶
NewClientForTesting returns a Ziggy client with a custom baseURL.
func (*Client) GetAccessToken ¶
func (c *Client) GetAccessToken(ctx context.Context, scope TokenScope) ( *AccessToken, error)
GetAccessToken obtains an access token.
func (*Client) GetAccountBalance ¶
GetAccountBalance obtains a specified account's balance.
func (*Client) GetAccountTransactions ¶
func (c *Client) GetAccountTransactions(ctx context.Context, req *TransactionsRequest) (*TransactionsResponse, error)
GetAccountTransactions obtains a specified account's transactions.
func (*Client) GetAccounts ¶
GetAccounts obtains a list of accounts.
func (*Client) SetAccessToken ¶
func (c *Client) SetAccessToken(token *AccessToken) *Client
func (*Client) SetToken ¶
func (c *Client) SetToken(token *AccessToken) *Client
SetToken sets a temporary authorization token on the Ziggy client.
type TokenScope ¶
type TokenScope string
TokenScope describes the access scope of a token.
const (
TokenScopeAccounts TokenScope = "accounts"
)
type TokenType ¶
type TokenType string
TokenType describes the kind of token.
const (
TokenTypeBearer TokenType = "Bearer"
)
type Transaction ¶
type Transaction struct { AccountID string `json:"accountId"` Type TransactionType `json:"type"` Status TransactionStatus `json:"status"` Description string `json:"description"` CardNumber string `json:"cardNumber"` PostingDate time.Time `json:"postingDate"` ValueDate time.Time `json:"valueDate"` ActionDate time.Time `json:"actionDate"` TransactionDate time.Time `json:"transactionDate"` Amount float64 `json:"amount"` }
Transaction describes some activity which has occurred on an account.
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(data []byte) error
UnmarshalJSON satisfies the json.Unmarshaler interface.
type TransactionStatus ¶
type TransactionStatus string
TransactionStatus describes the current state of a transaction.
type TransactionType ¶
type TransactionType string
TransactionType describes the kind of the transaction.
type TransactionsRequest ¶
type TransactionsRequest struct { AccountID string `json:"-"` // Optional. StartDate time.Time `json:"fromDate,omitempty"` // Optional. EndDate time.Time `json:"toDate,omitempty"` }
TransactionRequest describes the request parameters available for retrieving account transactions. All parameters are requires unless specified.
type TransactionsResponse ¶
type TransactionsResponse struct { Data struct { Transactions []Transaction `json:"transactions"` } `json:"data"` Links struct { Self string `json:"self"` } `json:"links"` Metadata struct { TotalPages int64 `json:"totalPages"` } `json:"meta"` }
TransactionsResponse describes the response data returned for retrieving account transactions.