Documentation ¶
Overview ¶
Package monobank - is MonoBank API client https://api.monobank.ua/docs/
Index ¶
- Constants
- Variables
- type Account
- type Accounts
- type Authorizer
- type CardType
- type Client
- type ClientInfo
- type CommonAPI
- type CorpAuth
- type CorpAuthMaker
- type CorpAuthMakerAPI
- type CorporateAPI
- type CorporateClient
- func (c CorporateClient) Auth(ctx context.Context, callbackURL string, permissions ...string) (*TokenRequest, error)
- func (c CorporateClient) CheckAuth(ctx context.Context, requestID string) error
- func (c CorporateClient) ClientInfo(ctx context.Context, requestID string) (*ClientInfo, error)
- func (c CorporateClient) SetWebHook(ctx context.Context, uri string) error
- func (c CorporateClient) Transactions(ctx context.Context, requestID, accountID string, from, to time.Time) (Transactions, error)
- type Currencies
- type Currency
- type PersAuth
- type PersonalAPI
- type PersonalClient
- func (c PersonalClient) ClientInfo(ctx context.Context) (*ClientInfo, error)
- func (c PersonalClient) SetWebHook(ctx context.Context, uri string) error
- func (c PersonalClient) Transactions(ctx context.Context, accountID string, from, to time.Time) (Transactions, error)
- func (c PersonalClient) WithAuth(auth Authorizer) PersonalClient
- type PublicAPI
- type PublicAuthorizer
- type TokenRequest
- type Transaction
- type Transactions
- type WebHookData
- type WebHookRequest
- type WebHookResponse
Constants ¶
View Source
const ( // PermSt - statements(transactions) and client info of individual(фізичної особи). PermSt = "s" // PermPI - personal information(first and last names). PermPI = "p" // PermFOP - statements(transactions) and client info of private entrepreneur(ФОП). PermFOP = "f" )
Permissions.
Variables ¶
View Source
var ( ErrDecodePrivateKey = errors.New("failed to decode private key") ErrEncodePublicKey = errors.New("failed to encode public key with sha1") ErrNoPrivateKey = errors.New("failed to find private key block") ErrInvalidEC = errors.New("invalid elliptic curve private key value") ErrInvalidPrivateKey = errors.New("invalid private key length") )
Errors.
View Source
var ErrEmptyAuthMaker = errors.New("authMaker is nil")
View Source
var ErrEmptyRequest = errors.New("empty request")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { AccountID string `json:"id"` SendID string `json:"sendId"` 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"` IBAN string `json:"iban"` }
type Authorizer ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientInfo ¶
type ClientInfo struct { ID string `json:"clientId"` Name string `json:"name"` WebHookURL string `json:"webHookUrl"` Accounts Accounts `json:"accounts"` }
ClientInfo - client/user info Personal API - https://api.monobank.ua/docs/#/definitions/UserInfo Corporate API - https://api.monobank.ua/docs/corporate.html#/definitions/UserInfo
type CorpAuth ¶ added in v0.9.0
type CorpAuth struct { *CorpAuthMaker // contains filtered or unexported fields }
type CorpAuthMaker ¶ added in v0.9.0
type CorpAuthMaker struct { KeyID string // X-Key-Id - ID key of the service // contains filtered or unexported fields }
func NewCorpAuthMaker ¶ added in v0.9.0
func NewCorpAuthMaker(secKey []byte) (*CorpAuthMaker, error)
func (*CorpAuthMaker) New ¶ added in v0.9.0
func (c *CorpAuthMaker) New(requestID string) Authorizer
func (*CorpAuthMaker) NewPermissions ¶ added in v0.9.0
func (c *CorpAuthMaker) NewPermissions(permissions ...string) Authorizer
type CorpAuthMakerAPI ¶ added in v0.9.0
type CorpAuthMakerAPI interface { // New returns corp Authorizer for endpoints with Request ID. New(requestID string) Authorizer // NewPermissions returns corp Authorizer for Auth endpoint to get Request ID. // Omitting permissions means all permissions. NewPermissions(permissions ...string) Authorizer }
type CorporateAPI ¶ added in v0.7.0
type CorporateAPI interface { CommonAPI // Auth initializes access. // https://api.monobank.ua/docs/corporate.html#operation--personal-auth-request-post Auth(ctx context.Context, callbackURL string, permissions ...string) (*TokenRequest, error) // CheckAuth checks status of request for client's personal data. // https://api.monobank.ua/docs/corporate.html#operation--personal-auth-request-get CheckAuth(ctx context.Context, requestID string) error // ClientInfo - https://api.monobank.ua/docs/corporate.html#operation--personal-client-info-get ClientInfo(ctx context.Context, requestID string) (*ClientInfo, error) // Transactions - gets bank account statements(transactions) // https://api.monobank.ua/docs/corporate.html#operation--personal-statement--account---from---to--get Transactions(ctx context.Context, requestID, accountID string, from, to time.Time) (Transactions, error) }
type CorporateClient ¶ added in v0.8.0
type CorporateClient struct {
// contains filtered or unexported fields
}
func NewCorporateClient ¶ added in v0.8.0
func NewCorporateClient(client *http.Client, authMaker CorpAuthMakerAPI) (CorporateClient, error)
NewCorporateClient returns corporate client
func (CorporateClient) Auth ¶ added in v0.8.0
func (c CorporateClient) Auth(ctx context.Context, callbackURL string, permissions ...string) (*TokenRequest, error)
Auth initializes access.
func (CorporateClient) CheckAuth ¶ added in v0.8.0
func (c CorporateClient) CheckAuth(ctx context.Context, requestID string) error
func (CorporateClient) ClientInfo ¶ added in v0.8.0
func (c CorporateClient) ClientInfo(ctx context.Context, requestID string) (*ClientInfo, error)
func (CorporateClient) SetWebHook ¶ added in v0.8.0
func (c CorporateClient) SetWebHook(ctx context.Context, uri string) error
SetWebHook sets webhook for corporate API.
func (CorporateClient) Transactions ¶ added in v0.8.0
func (c CorporateClient) Transactions(ctx context.Context, requestID, accountID string, from, to time.Time) (Transactions, error)
type Currencies ¶
type Currencies []Currency
type PersAuth ¶ added in v0.9.0
type PersAuth struct {
// contains filtered or unexported fields
}
func NewPersonalAuthorizer ¶
type PersonalAPI ¶ added in v0.2.0
type PersonalAPI interface { CommonAPI // ClientInfo - https://api.monobank.ua/docs/#/definitions/UserInfo ClientInfo(context.Context) (*ClientInfo, error) // Transactions - gets bank account statements // https://api.monobank.ua/docs/#/definitions/StatementItems Transactions(ctx context.Context, accountID string, from, to time.Time) (Transactions, error) }
type PersonalClient ¶ added in v0.8.0
type PersonalClient struct {
// contains filtered or unexported fields
}
func NewPersonalClient ¶ added in v0.8.0
func NewPersonalClient(client *http.Client) PersonalClient
func (PersonalClient) ClientInfo ¶ added in v0.8.0
func (c PersonalClient) ClientInfo(ctx context.Context) (*ClientInfo, error)
func (PersonalClient) SetWebHook ¶ added in v0.8.0
func (c PersonalClient) SetWebHook(ctx context.Context, uri string) error
func (PersonalClient) Transactions ¶ added in v0.8.0
func (c PersonalClient) Transactions(ctx context.Context, accountID string, from, to time.Time) ( Transactions, error)
TODO: make `to` optional
func (PersonalClient) WithAuth ¶ added in v0.8.0
func (c PersonalClient) WithAuth(auth Authorizer) PersonalClient
WithAuth returns copy of PersonalClient with authorizer
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"` OriginalMCC int32 `json:"originalMcc"` 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"` ReceiptID string `json:"receiptId"` EDRPOU string `json:"counterEdrpou"` IBAN string `json:"counterIban"` }
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"` }
Click to show internal directories.
Click to hide internal directories.