Documentation
¶
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type AllHostsRequest
- type BasicAuth
- type Benchmarks
- type ComparisonMatrix
- type Configuration
- type GenericOpenAPIError
- type HashResponse
- type Host
- type HostApiService
- type HostResponse
- type NavigatorApiService
- type PlotBand
- type PlotBandLabel
- type RegionalScore
- type Status
- type Ticks
- type Transaction
Constants ¶
This section is empty.
Variables ¶
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 ¶
Types ¶
type APIClient ¶
type APIClient struct { HostApi *HostApiService // 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 ¶
ChangeBasePath changes base path to allow switching to mocks
type APIKey ¶
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 ¶
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 ¶
func (a *HostApiService) Host(ctx _context.Context, id int32) (HostResponse, *_nethttp.Response, error)
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 ¶
type NavigatorApiService service
NavigatorApiService NavigatorApi service
func (*NavigatorApiService) Hash ¶
func (a *NavigatorApiService) Hash(ctx _context.Context, hash string) ([]HashResponse, *_nethttp.Response, error)
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
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
Source Files
¶
- api_host.go
- api_navigator.go
- client.go
- configuration.go
- model_all_hosts_request.go
- model_benchmarks.go
- model_comparison_matrix.go
- model_hash_response.go
- model_host.go
- model_host_response.go
- model_plot_band.go
- model_plot_band_label.go
- model_regional_score.go
- model_status.go
- model_ticks.go
- model_transaction.go
- response.go