organisation_api

package module
v0.0.0-...-2611860 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

Organisation API

This is a client API for the accounts resource under Organisation defined on the Form3 documentation.

Structure

organisation-api
    ├───.idea
    └───scripts
       └───db

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugClient = &OrganisationApiClient{
	Client:       http.DefaultClient,
	ClientConfig: DebugConfig,
}

DebugClient Default client for debugging.

View Source
var DebugConfig = &ClientConfig{
	RootUrl:        defaultRootUrl,
	DebugLog:       log.New(os.Stdout, "DEBUG\t", log.Ldate|log.Ltime),
	IsDebugEnabled: true,
}

DebugConfig Config meant for debugging capabilities, with logging.

View Source
var DefaultClient = &OrganisationApiClient{
	Client: &http.Client{
		Timeout: 10 * time.Second,
		Transport: &http.Transport{
			TLSHandshakeTimeout: 5 * time.Second,
		},
	},
	ClientConfig: DefaultConfig,
}

DefaultClient Default client with timeout defined.

View Source
var DefaultConfig = &ClientConfig{
	RootUrl:        defaultRootUrl,
	DebugLog:       nil,
	IsDebugEnabled: false,
}

DefaultConfig Default config with no logging or debugging.

Functions

This section is empty.

Types

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"`
}

AccountAttributes Model representing the attributes of an account.

type AccountData

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"`
}

AccountData Model representing an account in the server.

type ClientConfig

type ClientConfig struct {
	RootUrl        *url.URL
	DebugLog       *log.Logger
	IsDebugEnabled bool
}

ClientConfig Struct representing the client config.

type ClientResponse

type ClientResponse struct {
	Data       *AccountData
	StatusCode int
	Success    bool
}

ClientResponse Represents a response from the API client, not the API itself.

type OrganisationApiClient

type OrganisationApiClient struct {
	*http.Client
	ClientConfig *ClientConfig
}

OrganisationApiClient Struct for the API client. It uses http.Client as composition.

func (*OrganisationApiClient) CreateAccount

func (c *OrganisationApiClient) CreateAccount(data AccountData) (*ClientResponse, error)

CreateAccount Creates a new resource given the AccountData. Uses defaultContext as the context.

func (*OrganisationApiClient) CreateAccountWithContext

func (c *OrganisationApiClient) CreateAccountWithContext(data AccountData, ctx context.Context) (*ClientResponse, error)

CreateAccountWithContext Creates a new resource given the AccountData with the given context.

func (*OrganisationApiClient) DeleteAccount

func (c *OrganisationApiClient) DeleteAccount(id string, version int64) (*ClientResponse, error)

DeleteAccount Deletes account with given id and version. Uses defaultContext as the context.

func (*OrganisationApiClient) DeleteAccountWithContext

func (c *OrganisationApiClient) DeleteAccountWithContext(id string, version int64, ctx context.Context) (*ClientResponse, error)

DeleteAccountWithContext Deletes account with given id, version and context.

func (*OrganisationApiClient) FetchAccount

func (c *OrganisationApiClient) FetchAccount(id string) (*ClientResponse, error)

FetchAccount Fetches the account given an id. Uses defaultContext as the context.

func (*OrganisationApiClient) FetchAccountWithContext

func (c *OrganisationApiClient) FetchAccountWithContext(id string, ctx context.Context) (*ClientResponse, error)

FetchAccountWithContext Fetches the account given an id and context.

Jump to

Keyboard shortcuts

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