swagger

package
Version: v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 20 Imported by: 0

README

Go API client for swagger

The LBRY blockchain is read into SQL where important structured information can be extracted through the Chain Query API.

Overview

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

  • API version: 0.1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen

Installation

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

    "./swagger"

Documentation for API Endpoints

All URIs are relative to http://0.0.0.0:6300/api

Class Method HTTP request Description
DefaultApi AutoUpdate Post /autoupdate auto updates the application with the latest release based on TravisCI webhook
QueryApi SQLQuery Get /sql Use SQL in a RESTful way
StatApi AddressSummary Get /addresssummary Returns a summary of Address activity
StatApi ChainQueryStatus Get /status Returns important status information about Chain Query

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a 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

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {

	// API Services
	DefaultApi *DefaultApiService
	QueryApi   *QueryApiService
	StatApi    *StatApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Chain Query API v0.1.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 APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AddressSummary

type AddressSummary struct {
	Address string `json:"Address,omitempty"`

	// Total amount received by address from all transactions it was a part of.
	TotalReceived float64 `json:"TotalReceived,omitempty"`

	// Total amount sent from address for all transactions it was a part of.
	TotalSent float64 `json:"TotalSent,omitempty"`

	// The current balance of an address
	Balance float64 `json:"Balance,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 ChainqueryStatus added in v1.2.3

type ChainqueryStatus struct {
	TableStatus   []TableSize `json:"TableStatus,omitempty"`
	SemVersion    string
	VersionShort  string
	VersionLong   string
	CommitMessage string
}

Contains an array of tables and their row count.

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 DefaultApiService added in v0.1.0

type DefaultApiService service

func (*DefaultApiService) AutoUpdate added in v0.1.0

func (a *DefaultApiService) AutoUpdate(ctx context.Context, payload interface{}) (*http.Response, error)
DefaultApiService auto updates the application with the latest release based on TravisCI webhook

takes a webhook as defined by https://docs.travis-ci.com/user/notifications/#Webhooks-Delivery-Format, validates the public key, chooses whether or not update the application. If so it shuts down the api, downloads the latest release from https://github.com/lbryio/chainquery/releases, replaces the binary and starts the api again. * @param ctx context.Context for authentication, logging, tracing, etc. @param payload @return

type QueryApiService

type QueryApiService service

func (*QueryApiService) SQLQuery

func (a *QueryApiService) SQLQuery(ctx context.Context, query string, values []string) ([]interface{}, *http.Response, error)
QueryApiService Use SQL in a RESTful way

API exposed for sending SQL queries directly against the chainquery database. Since this is an exposed API there are limits to its use. These limits include queries per hour, read-only, limited to 60 second timeout. * @param ctx context.Context for authentication, logging, tracing, etc. @param query The SQL query to be put against the chainquery database. @param values when passing in a query use '?' for values which will be replaced in order of appearance with this array. @return []interface{}

type StatApiService

type StatApiService service

func (*StatApiService) AddressSummary

func (a *StatApiService) AddressSummary(ctx context.Context, lbryAddress string) (AddressSummary, *http.Response, error)
StatApiService Returns a summary of Address activity

It returns sent, recieved, balance, and number of transactions it has been used in. * @param ctx context.Context for authentication, logging, tracing, etc. @param lbryAddress A LbryAddress @return AddressSummary

func (*StatApiService) ChainQueryStatus added in v0.1.0

func (a *StatApiService) ChainQueryStatus(ctx context.Context) (ChainqueryStatus, *http.Response, error)

StatApiService Returns important status information about Chain Query * @param ctx context.Context for authentication, logging, tracing, etc. @return ChainqueryStatus

type TableSize

type TableSize struct {

	// Name of the table being referenced.
	TableName string `json:"TableName,omitempty"`

	// The number of rows in the referenced table
	NrRows int64 `json:"NrRows,omitempty"`
}

Contains the name and number of rows for a table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL