gomono

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 8 Imported by: 0

README

Golang bindings for the Monobank API

GoDoc Go Report Card Travis

All methods are fairly self explanatory, and reading the godoc page should explain everything. If something isn't clear, open an issue or submit a pull request.

The scope of this project is just to provide a wrapper around the API without any additional features. There are other projects for creating something with plugins and command handlers without having to design all that yourself.

Example

Please take a look at examples/example.go.

Run it using:

cd examples/
go run example.go -token <your-token>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrencyInfo

type CurrencyInfo struct {
	CurrencyCodeA int32   `json:"currencyCodeA"`
	CurrencyCodeB int32   `json:"currencyCodeB"`
	Date          int32   `json:"date"`
	RateSell      float64 `json:"rateSell"`
	RateBuy       float64 `json:"rateBuy"`
	RateCross     float64 `json:"rateCross"`
}

CurrencyInfo describes the one-pair currency information.

type CurrencyInfos

type CurrencyInfos []CurrencyInfo

CurrencyInfos describes list of currency info.

type MonobankClient

type MonobankClient struct {
	// Token is monobank access token.
	Token string
	// contains filtered or unexported fields
}

MonobankClient holds data about monobank client.

func NewMonobankClient added in v0.1.1

func NewMonobankClient(token string) *MonobankClient

NewMonobankClient returns new MonobankClient.

func (*MonobankClient) GetBankCurrency

func (mc *MonobankClient) GetBankCurrency() (*CurrencyInfos, error)

GetBankCurrency returns all available currency infos.

func (*MonobankClient) GetClientInfo

func (mc *MonobankClient) GetClientInfo() (*UserInfo, error)

GetClientInfo returns all available info about the client.

func (*MonobankClient) GetPersonalStatements

func (mc *MonobankClient) GetPersonalStatements(account string, from, to int64) (*StatementItems, error)

GetPersonalStatements returns all transaction by the given account in the particular period of time.

func (*MonobankClient) GetPersonalStatementsTillNow

func (mc *MonobankClient) GetPersonalStatementsTillNow(account string, from int64) (*StatementItems, error)

GetPersonalStatementsTillNow returns all transaction by the given account in the particular period of time. It uses GetPersonalStatements but defines `to` param as now time.

func (*MonobankClient) SetWebhook added in v0.1.1

func (mc *MonobankClient) SetWebhook(webhookURL string) error

SetWebhook sets webhook for monobank to send events.

type StatementItem

type StatementItem struct {
	ID              string `json:"id"`
	Time            int32  `json:"time"`
	Description     string `json:"description"`
	Mcc             int32  `json:"mcc"`
	Hold            bool   `json:"hold"`
	Amount          int64  `json:"amount"`
	OperationAmount int64  `json:"operationAmount"`
	CurrencyCode    int32  `json:"currencyCode"`
	CommissionRate  int64  `json:"commissionRate"`
	CashbackAmount  int64  `json:"cashbackAmount"`
	Balance         int64  `json:"balance"`
}

StatementItem describes the transaction in the particular point in time.

type StatementItems

type StatementItems []StatementItem

StatementItems describes list of statement items.

type UserAccount

type UserAccount struct {
	ID           string `json:"id"`
	Balance      int64  `json:"balance"`
	CreditLimit  int64  `json:"creditLimit"`
	CurrencyCode int32  `json:"currencyCode"`
	CashbackType string `json:"cashbackType"` // TODO: make it enum
}

UserAccount describes the client's account.

type UserAccounts

type UserAccounts []UserAccount

UserAccounts describes list of user accounts.

type UserInfo

type UserInfo struct {
	Name       string       `json:"name"`
	WebHookURL string       `json:"webHookUrl"`
	Accounts   UserAccounts `json:"accounts"`
}

UserInfo describes the client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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