siastats

package module
v0.0.0-...-8693b0b Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: MIT Imports: 20 Imported by: 0

README

Go API client for siastats

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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-10-03
  • Package version: 1.0.0
  • 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
go get github.com/antihax/optional

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

import "./siastats"

Documentation for API Endpoints

All URIs are relative to https://siastats.info:3500/navigator-api

Class Method HTTP request Description
HostApi AllHosts Post /allhosts Summary information and SiaStats final scores of all the hosts in the Sia network.
HostApi Host Get /host/{id} Information and detailed SiaStats benchmarks about a host.
NavigatorApi Hash Get /hash/{hash} Returns the information about any hash (address, Tx, contract...) or block height on the blockchain
NavigatorApi Status Get /status Global status and blockchain sync situation of SiaStats nodes

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 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

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 {
	HostApi *HostApiService

	NavigatorApi *NavigatorApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the siastats.info API API v2019-10-03 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)

ChangeBasePath changes 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 OpenAPI 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:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type AllHostsRequest

type AllHostsRequest struct {
	Network string `json:"network"`
	List    string `json:"list"`
}

AllHostsRequest struct for AllHostsRequest

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 Benchmarks

type Benchmarks struct {
	FinalScore       int32  `json:"finalScore,omitempty"`
	Latency          int32  `json:"latency,omitempty"`
	LatencyScore     int32  `json:"latencyScore,omitempty"`
	Up               int64  `json:"up,omitempty"`
	UpScore          int32  `json:"upScore,omitempty"`
	Down             int64  `json:"down,omitempty"`
	DownScore        int32  `json:"downScore,omitempty"`
	ContractSuccess  bool   `json:"contractSuccess,omitempty"`
	BenchFailureRate int32  `json:"benchFailureRate,omitempty"`
	ErrorType        string `json:"errorType,omitempty"`
	ErrorDescription string `json:"errorDescription,omitempty"`
	ErrorFull        string `json:"errorFull,omitempty"`
}

Benchmarks struct for Benchmarks

type ComparisonMatrix

type ComparisonMatrix struct {
	Stored        int32   `json:"stored,omitempty"`
	Price         float32 `json:"price,omitempty"`
	Collateral    float32 `json:"collateral,omitempty"`
	Up            float32 `json:"up,omitempty"`
	Down          float32 `json:"down,omitempty"`
	ContractPrice float32 `json:"contractPrice,omitempty"`
}

ComparisonMatrix struct for ComparisonMatrix

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
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

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

AddDefaultHeader adds a new HTTP header to the default header in the request

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 HashResponse

type HashResponse struct {
	Type                string        `json:"Type,omitempty"`
	MasterHash          string        `json:"MasterHash,omitempty"`
	BalanceSc           float64       `json:"balanceSc,omitempty"`
	ReceivedSc          float64       `json:"receivedSc,omitempty"`
	SentSc              float64       `json:"sentSc,omitempty"`
	BalanceSf           float32       `json:"balanceSf,omitempty"`
	TotalTxCount        int32         `json:"TotalTxCount,omitempty"`
	FirstSeen           int32         `json:"firstSeen,omitempty"`
	Last100Transactions []Transaction `json:"last100Transactions,omitempty"`
}

HashResponse struct for HashResponse

type Host

type Host struct {
	Id                 float32 `json:"Id,omitempty"`
	Online             bool    `json:"Online,omitempty"`
	Pubkey             string  `json:"Pubkey,omitempty"`
	CurrentIp          string  `json:"CurrentIp,omitempty"`
	CountryCode        string  `json:"CountryCode,omitempty"`
	TotalStorage       float32 `json:"TotalStorage,omitempty"`
	AcceptingContracts bool    `json:"AcceptingContracts,omitempty"`
	Version            string  `json:"Version,omitempty"`
	UsedStorage        float32 `json:"UsedStorage,omitempty"`
	Collateral         int32   `json:"Collateral,omitempty"`
	ContractPrice      int32   `json:"ContractPrice,omitempty"`
	StoragePrice       int32   `json:"StoragePrice,omitempty"`
	UploadPrice        int32   `json:"UploadPrice,omitempty"`
	DownloadPrice      int32   `json:"DownloadPrice,omitempty"`
	Rank               int32   `json:"Rank,omitempty"`
	FinalScore         int32   `json:"FinalScore,omitempty"`
	ErrorType          string  `json:"ErrorType,omitempty"`
}

Host struct for Host

type HostApiService

type HostApiService service

HostApiService HostApi service

func (*HostApiService) AllHosts

func (a *HostApiService) AllHosts(ctx _context.Context, allHostsRequest AllHostsRequest) ([]Host, *_nethttp.Response, error)

AllHosts Summary information and SiaStats final scores of all the hosts in the Sia network.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param allHostsRequest

@return []Host

func (*HostApiService) Host

Host Information and detailed SiaStats benchmarks about a host.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id SiaStats host ID

@return HostResponse

type HostResponse

type HostResponse struct {
	RequestStatus    string           `json:"requestStatus,omitempty"`
	Id               int32            `json:"id,omitempty"`
	Online           bool             `json:"online,omitempty"`
	Rank             int32            `json:"rank,omitempty"`
	Network          string           `json:"network,omitempty"`
	Pubkey           string           `json:"pubkey,omitempty"`
	Ip               string           `json:"ip,omitempty"`
	Lon              float32          `json:"lon,omitempty"`
	Lat              float32          `json:"lat,omitempty"`
	Isp              string           `json:"isp,omitempty"`
	CountryCode      string           `json:"countryCode,omitempty"`
	CountryName      string           `json:"countryName,omitempty"`
	MaxDuration      float32          `json:"maxDuration,omitempty"`
	TotalStorage     float32          `json:"totalStorage,omitempty"`
	UsedStorage      float32          `json:"usedStorage,omitempty"`
	Collateral       float32          `json:"collateral,omitempty"`
	StoragePrice     float32          `json:"storagePrice,omitempty"`
	UploadPrice      float32          `json:"uploadPrice,omitempty"`
	DownloadPrice    float32          `json:"downloadPrice,omitempty"`
	MinContractPrice float32          `json:"minContractPrice,omitempty"`
	FirstSeenBlock   int32            `json:"firstSeenBlock,omitempty"`
	Version          string           `json:"version,omitempty"`
	SectorSize       int32            `json:"sectorSize,omitempty"`
	WindowSize       int32            `json:"windowSize,omitempty"`
	SeenBy           []string         `json:"seenBy,omitempty"`
	Benchmarks       Benchmarks       `json:"benchmarks,omitempty"`
	ComparisonMatrix ComparisonMatrix `json:"comparisonMatrix,omitempty"`
	Ticks            Ticks            `json:"ticks,omitempty"`
	PlotBands        []PlotBand       `json:"plotBands,omitempty"`
	RegionalScores   []RegionalScore  `json:"regionalScores,omitempty"`
	Uptime1m         float32          `json:"uptime1m,omitempty"`
	Uptime6m         float32          `json:"uptime6m,omitempty"`
}

HostResponse struct for HostResponse

type NavigatorApiService service

NavigatorApiService NavigatorApi service

Hash Returns the information about any hash (address, Tx, contract...) or block height on the blockchain

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param hash hash or block height

@return []HashResponse

Status Global status and blockchain sync situation of SiaStats nodes

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

@return []Status

type PlotBand

type PlotBand struct {
	Color string        `json:"color,omitempty"`
	From  int64         `json:"from,omitempty"`
	To    int64         `json:"to,omitempty"`
	Label PlotBandLabel `json:"label,omitempty"`
}

PlotBand struct for PlotBand

type PlotBandLabel

type PlotBandLabel struct {
	Text      string `json:"text,omitempty"`
	Rotation  int32  `json:"rotation,omitempty"`
	TextAlign string `json:"textAlign,omitempty"`
	Align     string `json:"align,omitempty"`
	X         int32  `json:"x,omitempty"`
	Y         int32  `json:"y,omitempty"`
}

PlotBandLabel struct for PlotBandLabel

type RegionalScore

type RegionalScore struct {
	Region       string `json:"region,omitempty"`
	Latency      int32  `json:"latency,omitempty"`
	Up           string `json:"up,omitempty"`
	Down         string `json:"down,omitempty"`
	LatencyScore int32  `json:"latencyScore,omitempty"`
	UpScore      int32  `json:"upScore,omitempty"`
	DownScore    int32  `json:"downScore,omitempty"`
	FinalScore   int32  `json:"finalScore,omitempty"`
}

RegionalScore struct for RegionalScore

type Status

type Status struct {
	Consensusblock int32  `json:"consensusblock,omitempty"`
	Lastblock      int32  `json:"lastblock,omitempty"`
	Heartbeat      int64  `json:"heartbeat,omitempty"`
	Peers          int32  `json:"peers,omitempty"`
	Version        string `json:"version,omitempty"`
}

Status struct for Status

type Ticks

type Ticks struct {
	Total      [][]float32 `json:"total,omitempty"`
	Used       [][]float32 `json:"used,omitempty"`
	Storage    [][]float32 `json:"storage,omitempty"`
	Bandwidth  [][]float32 `json:"bandwidth,omitempty"`
	Collateral [][]float32 `json:"collateral,omitempty"`
}

Ticks struct for Ticks

type Transaction

type Transaction struct {
	MasterHash string  `json:"MasterHash,omitempty"`
	ScChange   float64 `json:"ScChange,omitempty"`
	SfChange   float32 `json:"SfChange,omitempty"`
	Height     int32   `json:"Height,omitempty"`
	Timestamp  string  `json:"Timestamp,omitempty"`
	TxType     string  `json:"TxType,omitempty"`
}

Transaction struct for Transaction

Jump to

Keyboard shortcuts

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