Documentation ¶
Overview ¶
Package mono - is MonoBank API client https://api.monobank.ua/docs/
Index ¶
- type Account
- type Accounts
- type Authorizer
- type CardType
- type Client
- func (c Client) Auth(ctx context.Context, callbackURL string) (*TokenRequest, error)
- func (c Client) CheckAuth(ctx context.Context) error
- func (c Client) ClientInfo(ctx context.Context) (*ClientInfo, error)
- func (c Client) Currency(ctx context.Context) (Currencies, error)
- func (c Client) SetWebHook(ctx context.Context, uri string) error
- func (c Client) Transactions(ctx context.Context, accountID string, from, to time.Time) (Transactions, error)
- func (c Client) WithAuth(auth Authorizer) Client
- func (c Client) WithBaseURL(uri string) Client
- type ClientInfo
- type CorporateAPI
- type Currencies
- type Currency
- type PersonalAPI
- type PersonalAuthorizer
- type PublicAPI
- type PublicAuthorizer
- type TokenRequest
- type Transaction
- type Transactions
- type WebHookData
- type WebHookRequest
- type WebHookResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { AccountID string `json:"id"` Balance int64 `json:"balance"` CreditLimit int64 `json:"creditLimit"` CurrencyCode int `json:"currencyCode"` CashbackType string `json:"cashbackType"` // enum: None, UAH, Miles CardMasks []string `json:"maskedPan"` // card number masks Type CardType `json:"type"` }
type Authorizer ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) CheckAuth ¶ added in v0.7.0
CheckAuth checks status of request for client's personal data.
func (Client) ClientInfo ¶
func (c Client) ClientInfo(ctx context.Context) (*ClientInfo, error)
func (Client) Transactions ¶ added in v0.2.0
func (c Client) Transactions(ctx context.Context, accountID string, from, to time.Time) ( Transactions, error)
TODO: make `to` optional
func (Client) WithAuth ¶
func (c Client) WithAuth(auth Authorizer) Client
WithAuth returns copy of Client with authorizer
func (Client) WithBaseURL ¶
WithAuth returns copy of Client with overridden baseURL
type ClientInfo ¶
type ClientInfo struct { Name string `json:"name"` WebHookURL string `json:"webHookUrl"` Accounts Accounts `json:"accounts"` }
ClientInfo - client/user info
type CorporateAPI ¶ added in v0.7.0
type CorporateAPI interface { PersonalAPI // Auth initializes access. // Use corporate authorizer for it Auth(ctx context.Context, callbackURL string) (*TokenRequest, error) // CheckAuth checks status of request for client's personal data. CheckAuth(context.Context) error }
type Currencies ¶
type Currencies []Currency
type PersonalAPI ¶ added in v0.2.0
type PersonalAPI interface { PublicAPI // ClientInfo - https://api.monobank.ua/docs/#/definitions/UserInfo ClientInfo(context.Context) (*ClientInfo, error) // Transactions - gets bank account statements(transations) // https://api.monobank.ua/docs/#/definitions/StatementItems Transactions(ctx context.Context, accountID string, from, to time.Time) (Transactions, error) // SetWebHook - sets webhook for statements SetWebHook(ctx context.Context, uri string) error }
type PersonalAuthorizer ¶
type PersonalAuthorizer struct {
// contains filtered or unexported fields
}
func NewPersonalAuthorizer ¶
func NewPersonalAuthorizer(token string) PersonalAuthorizer
type PublicAPI ¶ added in v0.2.0
type PublicAPI interface { // Currency https://api.monobank.ua/docs/#/definitions/CurrencyInfo Currency(context.Context) (Currencies, error) }
type PublicAuthorizer ¶
type PublicAuthorizer struct{}
func NewPublicAuthorizer ¶
func NewPublicAuthorizer() PublicAuthorizer
type TokenRequest ¶ added in v0.7.0
type Transaction ¶ added in v0.2.0
type Transaction struct { ID string `json:"id"` Time epoch.Seconds `json:"time"` Description string `json:"description"` MCC int32 `json:"mcc"` Hold bool `json:"hold"` Amount int64 `json:"amount"` OperationAmount int64 `json:"operationAmount"` CurrencyCode int `json:"currencyCode"` CommissionRate int64 `json:"commissionRate"` CashbackAmount int64 `json:"cashbackAmount"` Balance int64 `json:"balance"` Comment string `json:"comment"` }
Transaction - bank account statement
type WebHookData ¶
type WebHookData struct { AccountID string `json:"account"` Transaction Transaction `json:"statementItem"` }
type WebHookRequest ¶
type WebHookRequest struct {
WebHookURL string `json:"webHookUrl"`
}
type WebHookResponse ¶
type WebHookResponse struct { Type string `json:"type"` // "StatementItem" Data WebHookData `json:"data"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.