package
0.4.0
Repository: https://github.com/will7200/go-crypto-sync.git
Documentation: pkg.go.dev

# README

Go API client for coinbase

Coinbase provides a simple and powerful REST API to integrate bitcoin, bitcoin cash, litecoin and ethereum payments into your business or application.

This API reference provides information on available endpoints and how to interact with it. To read more about the API, visit our API documentation.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2019-11-15
  • Package version: 0.1.0
  • Build date: 2022-02-13T12:21:21.233-08:00[America/Los_Angeles]
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./coinbase"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.coinbase.com/v2

ClassMethodHTTP requestDescription
AccountsApiGetAccountGet /accounts/{account_id}Retrieve Account
AccountsApiListAccountsGet /accountsList Accounts
AccountsApiListTransactionsGet /accounts/{account_id}/transactionsList transactions
ExchangeRatesApiGetExchangeRateForGet /exchange-ratesGet current exchange rates. Default base currency is USD but it can be defined as any supported currency. Returned rates will define the exchange rate for one unit of the base currency.
ExchangeRatesApiGetSellPriceGet /prices/{currency_pair_1}-{currency_pair_2}/sellExchanges Rates for currency pair
UsersApiCurrentUserGet /userShow current user

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: CB-ACCESS-KEY
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: CB-ACCESS-KEY and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAccount instantiates a new Account object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewAccountBalance instantiates a new AccountBalance object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewAccountBalanceWithDefaults instantiates a new AccountBalance object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewAccountWithDefaults instantiates a new Account object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResonse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.
NewCurrency instantiates a new Currency object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCurrencyExchange instantiates a new CurrencyExchange object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCurrencyExchangeWithDefaults instantiates a new CurrencyExchange object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCurrencyWithDefaults instantiates a new Currency object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewErrorResponse instantiates a new ErrorResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewErrorResponseErrors instantiates a new ErrorResponseErrors object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewErrorResponseErrorsWithDefaults instantiates a new ErrorResponseErrors object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewErrorResponseWithDefaults instantiates a new ErrorResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewExchangeRates instantiates a new ExchangeRates object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewExchangeRatesWithDefaults instantiates a new ExchangeRates object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewInlineResponse200 instantiates a new InlineResponse200 object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewInlineResponse2001 instantiates a new InlineResponse2001 object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewInlineResponse2001WithDefaults instantiates a new InlineResponse2001 object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewInlineResponse2002 instantiates a new InlineResponse2002 object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewInlineResponse2002WithDefaults instantiates a new InlineResponse2002 object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewInlineResponse2003 instantiates a new InlineResponse2003 object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewInlineResponse2003WithDefaults instantiates a new InlineResponse2003 object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewInlineResponse200WithDefaults instantiates a new InlineResponse200 object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewInvalidToken instantiates a new InvalidToken object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewInvalidTokenErrors instantiates a new InvalidTokenErrors object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewInvalidTokenErrorsWithDefaults instantiates a new InvalidTokenErrors object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewInvalidTokenWithDefaults instantiates a new InvalidToken object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewPagination instantiates a new Pagination object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPaginationWithDefaults instantiates a new Pagination object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUser instantiates a new User object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUserWithDefaults instantiates a new User object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
PtrBool is a helper routine that returns a pointer to given boolean value.
PtrFloat32 is a helper routine that returns a pointer to given float value.
PtrFloat64 is a helper routine that returns a pointer to given float value.
PtrInt is a helper routine that returns a pointer to given integer value.
PtrInt32 is a helper routine that returns a pointer to given integer value.
PtrInt64 is a helper routine that returns a pointer to given integer value.
PtrString is a helper routine that returns a pointer to given string value.
PtrTime is helper routine that returns a pointer to given Time value.

# Variables

ContextAPIKeys takes a string apikey as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextServerIndex uses a server configuration from the index.
ContextServerVariables overrides a server configuration variables.

# Structs

Account struct for Account.
AccountBalance struct for AccountBalance.
APIClient manages communication with the CoinBase API API v2019-11-15 In most cases there should be only one, shared, APIClient.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
No description provided by the author
APIResponse stores the API response returned by the server.
Configuration stores the configuration of the API client.
Currency struct for Currency.
CurrencyExchange struct for CurrencyExchange.
ErrorResponse struct for ErrorResponse.
ErrorResponseErrors struct for ErrorResponseErrors.
ExchangeRates struct for ExchangeRates.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
InlineResponse200 struct for InlineResponse200.
InlineResponse2001 struct for InlineResponse2001.
InlineResponse2002 struct for InlineResponse2002.
InlineResponse2003 struct for InlineResponse2003.
InvalidToken struct for InvalidToken.
InvalidTokenErrors struct for InvalidTokenErrors.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Pagination struct for Pagination.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.
User struct for User.

# Type aliases

AccountsApiService AccountsApi service.
ExchangeRatesApiService ExchangeRatesApi service.
ServerConfigurations stores multiple ServerConfiguration items.
UsersApiService UsersApi service.