biwse

package module
v0.0.0-...-3a4850c Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 16 Imported by: 0

README

Biwse Go Library

GoDoc

This API client generated from OpenAPI specification.

Installation

go get -u github.com/biwse/biwse-go

Example

import "github.com/biwse/biwse-go"

...
// Prepare client
token := "<api_token>"
config := biwse.NewConfiguration()
ctx := context.WithValue(context.Background(), biwse.ContextAccessToken, token)
client := biwse.NewAPIClient(config)
//Call any API endpoint
balance, response, err := client.AppApi.GetBalance(ctx, "<app_id>", "btc")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	AppApi *AppApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Biwse API V1 Reference API v1.0.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type Address

type Address struct {
	// New receive address
	Address string `json:"address,omitempty"`
}

type AppApiService

type AppApiService service

func (*AppApiService) CreateAddress

func (a *AppApiService) CreateAddress(ctx context.Context, appId string, coin string) (Address, *http.Response, error)

AppApiService Create new address Create new receive address for yor wallet.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param coin The wallet identidier

@return Address

func (*AppApiService) CreateInvoice

func (a *AppApiService) CreateInvoice(ctx context.Context, appId string, appInvoice AppInvoice) (AppInvoiceCreated, *http.Response, error)

AppApiService Create invoice Create new invoice. In response you get url of invoice page

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param appInvoice

@return AppInvoiceCreated

func (*AppApiService) CreateWalletInvoice

func (a *AppApiService) CreateWalletInvoice(ctx context.Context, appId string, coin string, walletInvoice WalletInvoice) (WalletInvoiceCreated, *http.Response, error)

AppApiService Create wallet invoice Create new invoice for specific wallet. In response you get url of invoice page.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param coin The wallet identidier
  • @param walletInvoice

@return WalletInvoiceCreated

func (*AppApiService) GetBalance

func (a *AppApiService) GetBalance(ctx context.Context, appId string, coin string) (WalletBalance, *http.Response, error)

AppApiService Retrieve wallet balance Retrieve wallet confirmed and total balance

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param coin The wallet identidier

@return WalletBalance

func (*AppApiService) GetInvoice

func (a *AppApiService) GetInvoice(ctx context.Context, appId string, invoiceId string) (InvoiceStatus, *http.Response, error)

AppApiService Retreive invoice info Retrieve invoice with specified identifier string

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param invoiceId Invoice ID

@return InvoiceStatus

func (*AppApiService) SendOnePayment

func (a *AppApiService) SendOnePayment(ctx context.Context, appId string, coin string, payment Payment) (Transaction, *http.Response, error)

AppApiService Send one payment Send one payments from wallet to one recipient

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param coin The wallet identidier
  • @param payment

@return Transaction

func (*AppApiService) SendPayments

func (a *AppApiService) SendPayments(ctx context.Context, appId string, coin string, payments Payments) (Transaction, *http.Response, error)

AppApiService Send payments Send payments from wallet to one or many recipents

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param appId The application identidier
  • @param coin The wallet identidier
  • @param payments

@return Transaction

type AppInvoice

type AppInvoice struct {
	// Invoice's amount
	AmountUsd float32 `json:"amount_usd"`
	// Callback url
	CallbackLink string `json:"callback_link,omitempty"`
	// Redirect user after payment
	SuccessUrl string `json:"success_url,omitempty"`
	// Your invoice internal identifier
	InvoiceNumber string `json:"invoice_number,omitempty"`
}

type AppInvoiceCreated

type AppInvoiceCreated struct {
	// Invoice ID
	Id string `json:"id,omitempty"`
	// Invoice page URL
	Url string `json:"url,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type Error

type Error struct {
}

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type InvoiceStatus

type InvoiceStatus struct {
	// Invoice's amount
	Msg  string            `json:"msg,omitempty"`
	Data InvoiceStatusData `json:"data,omitempty"`
}

type InvoiceStatusData

type InvoiceStatusData struct {
	// Invoice's amount
	Amount float32 `json:"amount,omitempty"`
	// Number of transaction confirmations
	Confs float32 `json:"confs,omitempty"`
	// Payment receieved on address
	Address string `json:"address,omitempty"`
	// Transaction hash
	TxHash string `json:"tx_hash,omitempty"`
	// Currency type
	Type bool `json:"type,omitempty"`
	// Payment accepted or not
	Accepted bool `json:"accepted,omitempty"`
	// Verification hash
	VerificationHash string `json:"verification_hash,omitempty"`
}

type Payment

type Payment struct {
	// Recipient address
	Address string `json:"address"`
	// Amount to send.
	Amount float32 `json:"amount"`
}

type Payments

type Payments struct {
	// Payments array
	Payments []Payment `json:"payments,omitempty"`
}

type Transaction

type Transaction struct {
	// Sended transaction ID
	TxHash string `json:"tx_hash,omitempty"`
}

type WalletBalance

type WalletBalance struct {
	// Total wallet balance.
	Total float32 `json:"total,omitempty"`
	// Fund in wallet available to withdrawal.
	Confirmed float32 `json:"confirmed,omitempty"`
}

type WalletInvoice

type WalletInvoice struct {
	// Invoice's amount
	Amount float32 `json:"amount"`
	// Callback url
	CallbackLink string `json:"callback_link,omitempty"`
	// Redirect user after payment
	SuccessUrl string `json:"success_url,omitempty"`
}

type WalletInvoiceCreated

type WalletInvoiceCreated struct {
	// Invoice ID
	Id string `json:"id,omitempty"`
	// Invoice page URL
	Url string `json:"url,omitempty"`
	// Receiving address that was created for invoice
	Address string `json:"address,omitempty"`
}

Jump to

Keyboard shortcuts

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