bunq

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

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

Go to latest
Published: May 25, 2018 License: MIT Imports: 20 Imported by: 0

README

go-bunq

GoDoc Build Status Go Report Card

A Go client library for accessing the public bunq API.

Features

The library aims to help with making calls to the public bunq API:

  • Abstracting the serialization/deserialization of request and response data
  • Key pair management
  • API key, token and signature management

Roadmap

The project is currently under active development. Check the wiki for a listing of all pending/planned work.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeviceNotFound = errors.New("device not found")

ErrDeviceNotFound is returned when a single Device resource was not found.

View Source
var ErrDeviceServerNotFound = errors.New("device server not found")

ErrDeviceServerNotFound is returned when a single DeviceServer resource was not found.

View Source
var ErrInstallationNotFound = errors.New("installation not found")

ErrInstallationNotFound is returned when a single Installation resource was not found.

View Source
var ErrUserNotFound = errors.New("user not found")

ErrUserNotFound is returned when a single User resource was not found.

Functions

This section is empty.

Types

type Address

type Address struct {
	Street      string `json:"street"`
	HouseNumber string `json:"house_number"`
	POBox       string `json:"po_box"`
	PostalCode  string `json:"postal_code"`
	City        string `json:"city"`
	Country     string `json:"country"`
}

type Alias

type Alias struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Name  string `json:"name"`
}

type Avatar

type Avatar struct {
	UUID       string        `json:"uuid"`
	AnchorUUID string        `json:"anchor_uuid"`
	Image      []AvatarImage `json:"image"`
}

type AvatarImage

type AvatarImage struct {
	AttachmentPublicUUID string `json:"attachment_public_uuid"`
	ContentType          string `json:"content_type"`
	Height               int    `json:"height"`
	Width                int    `json:"width"`
}

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
	APIKey     string
	Token      string
	PrivateKey *rsa.PrivateKey
}

Client is the API client for the public bunq API.

func NewClient

func NewClient() *Client

NewClient returns a new Client.

func (*Client) CreateDeviceServer

func (c *Client) CreateDeviceServer(description string, permittedIPs []net.IP) (*DeviceServer, error)

CreateDeviceServer creates a DeviceServer resource at the bunq API.

func (*Client) CreateInstallation

func (c *Client) CreateInstallation() (*Installation, error)

CreateInstallation creates an installation resource at the bunq API.

func (*Client) CreateSession

func (c *Client) CreateSession() (*Session, error)

CreateSession creates a new session for a DeviceServer at the bunq API.

func (*Client) GetDevice

func (c *Client) GetDevice(id int) (interface{}, error)

GetDevice gets a Device resource at the bunq API.

func (*Client) GetDeviceServer

func (c *Client) GetDeviceServer(id int) (*DeviceServer, error)

GetDeviceServer gets a DeviceServer resource at the bunq API.

func (*Client) GetInstallation

func (c *Client) GetInstallation(id int) (*Installation, error)

GetInstallation gets an Installation resource at the bunq API.

func (*Client) GetInstallationID

func (c *Client) GetInstallationID() (int, error)

GetInstallationID gets the installation ID of the Installation used for the current session.

func (*Client) GetUser

func (c *Client) GetUser(id int) (interface{}, error)

GetUser gets a User resource at the bunq API.

func (*Client) ListDeviceServers

func (c *Client) ListDeviceServers() ([]*DeviceServer, error)

ListDeviceServers gets a list of DeviceServer resources at the bunq API.

func (*Client) ListDevices

func (c *Client) ListDevices() ([]interface{}, error)

ListDevices gets a list of Device resources at the bunq API.

func (*Client) ListUsers

func (c *Client) ListUsers() ([]interface{}, error)

ListUsers gets a list of User resources at the bunq API.

func (*Client) SetPrivateKey

func (c *Client) SetPrivateKey(r io.Reader) error

SetPrivateKey reads and parses private key data into a private key.

type DevicePhone

type DevicePhone struct {
	ID          int
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Description string
	PhoneNumber string
	OS          string
	Status      string
}

A DevicePhone represents a Device at the bunq API.

type DeviceServer

type DeviceServer struct {
	ID          int
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Description string
	IP          net.IP
	Status      string
}

A DeviceServer represents a DeviceServe at the bunq API.

type DirectorAlias

type DirectorAlias struct {
	UUID           string `json:"uuid"`
	Avatar         Avatar `json:"avatar"`
	PublicNickName string `json:"public_nick_name"`
	DisplayName    string `json:"display_name"`
	Country        string `json:"country"`
}

type Error

type Error struct {
	ErrorDescription           string
	ErrorDescriptionTranslated string
}

Error represents an error returned by the bunq API.

type Errors

type Errors []Error

Errors is an array of Error structs.

func (Errors) Error

func (e Errors) Error() string

type Installation

type Installation struct {
	ID              int
	Token           InstallationToken
	ServerPublicKey string
}

An Installation represents an installation resource at the bunq API.

type InstallationToken

type InstallationToken struct {
	ID        int
	CreatedAt time.Time
	UpdatedAt time.Time
	Token     string
}

An InstallationToken is used for authenticating requests to the bunq API.

type Limit

type Limit struct {
	Value    string `json:"value"`
	Currency string `json:"currency"`
}

type NotificationFilter

type NotificationFilter struct {
	NotificationDeliveryMethod string `json:"notification_delivery_method"`
	NotificationTarget         string `json:"notification_target"`
	Category                   string `json:"category"`
}

type Session

type Session struct {
	ID          int
	Token       SessionToken
	UserCompany UserCompany
}

A Session represents a SessionServer at the bunq API.

type SessionToken

type SessionToken struct {
	ID    int
	Token string
}

A SessionToken is used for authenticating requests to the bunq API.

type Time

type Time time.Time

Time represents a parsed timestamp returned by the bunq API.

func (*Time) MarshalText

func (ariTime *Time) MarshalText() ([]byte, error)

MarshalText implements the encoding.MarshalText interface for custom time type.

func (*Time) UnmarshalJSON

func (ariTime *Time) UnmarshalJSON(input []byte) error

UnmarshalJSON is being used to parse timestamps from the bunq API. Bunq timestamps come into this format: "2015-06-13 23:19:16.215235"

type UBO

type UBO struct {
	Name        string `json:"name"`
	DateOfBirth Time   `json:"date_of_birth"`
	Nationality string `json:"nationality"`
}

type UserCompany

type UserCompany struct {
	ID                                 int                  `json:"id"`
	CreatedAt                          Time                 `json:"created"`
	UpdatedAt                          Time                 `json:"updated"`
	PublicUUID                         string               `json:"public_uuid"`
	Name                               string               `json:"name"`
	DisplayName                        string               `json:"display_name"`
	PublicNickName                     string               `json:"public_nick_name"`
	Alias                              []Alias              `json:"alias"`
	ChamberOfCommerceNumber            string               `json:"chamber_of_commerce_number"`
	TypeOfBusinessEntity               string               `json:"type_of_business_entity"`
	SectorOfIndustry                   string               `json:"sector_of_industry"`
	CounterBankIBAN                    string               `json:"counter_bank_IBAN"`
	Avatar                             Avatar               `json:"avatar"`
	AddressMain                        Address              `json:"address_main"`
	AddressPostal                      Address              `json:"address_postal"`
	VersionTermsOfService              string               `json:"version_terms_of_service"`
	DirectorAlias                      DirectorAlias        `json:"director_alias"`
	Language                           string               `json:"language"`
	Region                             string               `json:"region"`
	UBO                                []UBO                `json:"UBO"`
	Status                             string               `json:"status"`
	SubStatus                          string               `json:"sub_status"`
	SessionTimeout                     int                  `json:"session_timeout"`
	DailyLimitWithoutConfirmationLogin Limit                `json:"daily_limit_without_confirmation_login"`
	NotificationFilters                []NotificationFilter `json:"notification_filters"`
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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