form3

package
v0.0.0-...-2a3c411 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) ([]byte, error)

CheckResponse checks the API response for errors. Status codes outside the 200 range are considered errors.

Types

type Account

type Account struct {
	Data *AccountData `json:"data"`
}

Account represents an account.

type AccountAttributes

type AccountAttributes struct {
	AccountClassification   string   `json:"account_classification"`
	AccountMatchingOptOut   bool     `json:"account_matching_opt_out"`
	AccountNumber           string   `json:"account_number"`
	AlternativeNames        []string `json:"alternative_names"`
	BankID                  string   `json:"bank_id"`
	BankIDCode              string   `json:"bank_id_code"`
	BaseCurrency            string   `json:"base_currency"`
	Bic                     string   `json:"bic"`
	Country                 string   `json:"country"`
	Iban                    string   `json:"iban"`
	JointAccount            bool     `json:"joint_account"`
	Name                    []string `json:"name"`
	SecondaryIdentification string   `json:"secondary_identification"`
	Status                  *string  `json:"status,omitempty"`
	Switched                bool     `json:"switched"`
}

AccountAttributes represents account attributes for an account.

type AccountData

type AccountData struct {
	Attributes     *AccountAttributes `json:"attributes"`
	ID             string             `json:"id"`
	OrganisationID string             `json:"organisation_id"`
	Type           string             `json:"type"`
	Version        int64              `json:"version"`
}

AccountData represents data related to an account.

type AccountResponse

type AccountResponse struct {
	Account *AccountResponseData `json:"data"`
	Self    string               `json:"self"`
}

AccountResponse represents the response for a fetched account.

type AccountResponseData

type AccountResponseData struct {
	Attributes     *AccountAttributes `json:"attributes"`
	CreatedOn      time.Time          `json:"created_on"`
	ID             string             `json:"id"`
	ModifiedOn     time.Time          `json:"modified_on"`
	OrganisationID string             `json:"organisation_id"`
	Type           string             `json:"type"`
	Version        int                `json:"version"`
}

AccountResponseData represents the response data related to a fetched account.

type AccountsService

type AccountsService service

AccountsService handles communication with the Account resource methods of the Form3 API.

Form3 API docs: https://www.api-docs.form3.tech/api/schemes/bacs/accounts/resource-types

func (*AccountsService) CreateAccount

func (s *AccountsService) CreateAccount(ctx context.Context, body *Account) (*AccountResponse, *Response, error)

CreateAccount creates an account.

Form3 API docs: https://www.api-docs.form3.tech/api/schemes/bacs/accounts/create-an-account

func (*AccountsService) DeleteAccount

func (s *AccountsService) DeleteAccount(ctx context.Context, options *DeleteOptions) (*Response, error)

DeleteAccount deletes an account.

Form3 API docs: https://www.api-docs.form3.tech/api/schemes/bacs/accounts/delete-an-account

func (*AccountsService) GetAccount

func (s *AccountsService) GetAccount(ctx context.Context, id string) (*AccountResponse, *Response, error)

GetAccount fetches an account.

Form3 API docs: https://www.api-docs.form3.tech/api/schemes/bacs/accounts/fetch-an-account

type Client

type Client struct {
	BaseUrl *url.URL

	Accounts *AccountsService
	// contains filtered or unexported fields
}

Client manages communication with the Form3 API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Form3 API client.

func (*Client) Client

func (c *Client) Client() *http.Client

Client returns the configured HTTP client.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request.

func (*Client) SendRequest

func (c *Client) SendRequest(req *http.Request, v interface{}) (*Response, error)

SendRequest sends an API request and returns the API response.

type DeleteOptions

type DeleteOptions struct {
	AccountID string
	Version   int64
}

DeleteOptions represents URL parameters for the DELETE endpoint.

type ErrorResponse

type ErrorResponse struct {
	Status       int
	ErrorMessage string `json:"error_message,omitempty"`
}

ErrorResponse represents an error response with a status code and an error message.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error formats the ErrorResponse.

type Response

type Response struct {
	*http.Response
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL