Documentation ¶
Index ¶
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Float(v float64) *float64
- func Int(v int) *int
- func String(v string) *string
- func Stringify(message interface{}) string
- type Account
- type AccountsService
- type Client
- type Error
- type ErrorResponse
- type Escrow
- type EscrowsService
- type Response
- type ResponseData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper function that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func Float ¶
Float is a helper function that allocates a new float64 value to store v and returns a pointer to it.
func Int ¶
Int is a helper function that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.
Types ¶
type Account ¶
type Account struct { Username *string `json:"username,omitempty"` TradingPartnersCount *int `json:"trading_partners_count,omitempty"` FeedbacksUnconfirmedCount *int `json:"feedbacks_unconfirmed_count,omitempty"` TradeVolumeText *string `json:"trade_volume_text,omitempty"` HasCommonTrades *bool `json:"has_common_trades,omitempty"` ConfirmedTradeCountText *string `json:"confirmed_trade_count_text,omitempty"` BlockedCount *int `json:"blocked_count,omitempty"` FeedbackCount *int `json:"feedback_count,omitempty"` Url *string `json:"url,omitempty"` TrustedCount *int `json:"trusted_count,omitempty"` }
Account represents a LocalBitcoins account.
type AccountsService ¶
type AccountsService struct {
// contains filtered or unexported fields
}
AccountsService provides access to all account related functions in the LocalBitcoins API.
type Client ¶
type Client struct { // Base URL used for API requests. Must end with a trailing slash. BaseURL *url.URL // User agent sent when communicating with the LocalBitcoins API. UserAgent string // Services for talking to different parts of the LocalBitcoins API. Accounts *AccountsService Escrows *EscrowsService // contains filtered or unexported fields }
A Client manages communication with the LocalBitcoins API.
func NewClient ¶
Returns a new LocalBitcoins API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods that require authentication (most, if not all, do), provide an http.Client that will perform the authentication for you (such as that provided by the goauth2 library).
func (*Client) Do ¶
Sends an API request and returns the API response. The API response is decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) NewRequest ¶
Creates an API request. A relative URl can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type ErrorResponse ¶
An ErrorResponse reports an error caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Escrow ¶
type Escrow struct { CreatedAt *time.Time `json:"created_at,omitempty"` BuyerUsername *string `json:"buyer_username,omitempty"` ReferenceCode *string `json:"reference_code,omitempty"` Currency *string `json:"currency,omitempty"` Amount *float64 `json:"amount,string,omitempty"` AmountBTC *float64 `json:"amount_btc,string,omitempty"` ExchangeRateUpdatedAt *time.Time `json:"exchange_rate_updated_at,omitempty"` // contains filtered or unexported fields }
Escrow represents an escrow as returned by the LocalBitcoins API.
type EscrowsService ¶
type EscrowsService struct {
// contains filtered or unexported fields
}
EscrowsService handles all escrow-related communications with the LocalBitcoins API.
type Response ¶
Response is a LocalBitcoins API response. This wraps the standard http.Response returned from LocalBitcoins and provides convenient access to things like pagination links.
type ResponseData ¶
type ResponseData struct { Data interface{} `json:"data"` Actions interface{} `json:"actions"` }
Represents data as returned by the LocalBitcoins API. Wraps the data and actions objects.