Documentation ¶
Index ¶
- type AccountService
- func (s *AccountService) Create(ctx context.Context, account *models.Account) (*models.Account, *Response, error)
- func (s *AccountService) Delete(ctx context.Context, id string) (*Response, error)
- func (s *AccountService) Fetch(ctx context.Context, id string) (*models.Account, *Response, error)
- func (s *AccountService) List(ctx context.Context, pagination *Pagination) ([]models.Account, *Response, error)
- type Client
- type ErrorResponse
- type Links
- type Pagination
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService holds API functionality for accounts API.
func (*AccountService) Create ¶
func (s *AccountService) Create(ctx context.Context, account *models.Account) (*models.Account, *Response, error)
Create registers an existing bank account with Form3 or create a new one. The country attribute must be specified as a minimum. Depending on the country, other attributes such as bank_id and bic are mandatory.
func (*AccountService) List ¶
func (s *AccountService) List(ctx context.Context, pagination *Pagination) ([]models.Account, *Response, error)
List accounts with the ability to filter and page.
type Client ¶
type Client struct { BaseURL *url.URL Account *AccountService // contains filtered or unexported fields }
Client is API client.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. If body parameter is specified, the value pointed to by body is JSON encoded and included in as the request body.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response StatusCode int Code string `json:"error_code"` Message string `json:"error_message"` }
ErrorResponse is a custom error structure for API errors. It hold HTTP response that caused error and has all given details about an error.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
Error is required to be implemented to meet error interface
type Links ¶
type Links struct { First string `json:"first"` Last string `json:"last"` Prev string `json:"prev"` Next string `json:"next"` Self string `json:"self"` }
Links holds information about response pagination.
func (*Links) CurrentPage ¶
CurrentPage returns current page from given response. if prev link URL is invalid it throws an error.
type Pagination ¶
type Pagination struct { Page int `url:"page[number],omitempty"` PerPage int `url:"page[size],omitempty"` }
Pagination is a structure required to build query parameters for pagination.