Package api

import "github.com/sliard/interview-accountapi-form3/api"

Overview ▾


const (
    EnvApiAddress = "FORM3_API_ADDR"

type AccountAttributes

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

type AccountData

Account represents an account in the form3 org section. See https://api-docs.form3.tech/api.html#organisation-accounts for more information about fields.

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

type Client

Client is the client to the form3 API. Create a client with NewClient.

type Client struct {
    // contains filtered or unexported fields

func NewClient

func NewClient(c *Config) (*Client, error)

func (*Client) CreateAccount

func (c *Client) CreateAccount(account *AccountData) (*AccountData, error)

CreateAccount Create an account with AccountData

func (*Client) DeleteAccount

func (c *Client) DeleteAccount(accountId string, version int64) error

func (*Client) FetchAccount

func (c *Client) FetchAccount(accountId string) (*AccountData, error)

func (*Client) SetLogger

func (c *Client) SetLogger(logger LeveledLogger)

type Config

Config is used to configure the creation of the client.

type Config struct {

    // Address is the address of the form3 api server. This should be a complete
    // URL such as "https://api-docs.form3.tech". If you need a custom SSL
    // cert or use a proxy, you need to specify a custom HttpClient.
    Address string

    // HttpClient is the HTTP client to use. We set sane defaults for the
    // http.Client and its associated http.Transport created in DefaultConfig.
    HttpClient *http.Client

    // Logger is the leveled logger to provide to the retryable HTTP client.
    Logger LeveledLogger

    // Timeout is for setting custom timeout parameter in the HttpClient
    Timeout time.Duration
    // contains filtered or unexported fields

func DefaultConfig

func DefaultConfig() *Config

func (*Config) ReadEnvironment

func (c *Config) ReadEnvironment()

ReadEnvironment reads configuration information from the environment.

type LeveledLogger

LeveledLogger interface implements the basic methods that a logger library needs

type LeveledLogger interface {
    Error(string, ...interface{})
    Info(string, ...interface{})
    Debug(string, ...interface{})
    Warn(string, ...interface{})