Documentation
¶
Index ¶
- func Request(method string, params interface{}) (Response, Error)
- func SignedRequest(method string, params interface{}) (Response, Error)
- func TrueRNG(apiKey string) trueRNG
- type BlobsReq
- type DecimalFractionsReq
- type Error
- type GaussiansReq
- type IntegersReq
- type Random
- type RequestShell
- type Response
- type ResponseShell
- type Result
- type SignedFloatData
- type SignedIntegerData
- type SignedResult
- type SignedStringData
- type Status
- type StatusReq
- type StringsReq
- type UUIDsReq
- type VerifiedSignature
- type VerifySignatureReq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignedRequest ¶
Types ¶
type DecimalFractionsReq ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data []interface{} `json:"data,omitempty"`
}
Core error object. Includes error message, the status code returned by the API, and optional data returned by the upstream API.
type GaussiansReq ¶
type IntegersReq ¶
type Random ¶
type Random struct {
Data []interface{} `json:"data"`
CompletionTime string `json:"completionTime"`
SerialNumber int `json:"serialNumber"`
HashedApiKey string `json:"hashedApiKey"`
}
A deeply nested inner JSON object contained inside ResponseShell.Random, which includes everything we asked for. For basic methods, `Data` and `CompletionTime` are returned. For signed methods, the values `HashedApiKey` and `SerialNumber` are also returned.
type RequestShell ¶
type RequestShell struct {
Version string `json:"jsonrpc"`
Params interface{} `json:"params"`
Method string `json:"method"`
Id int `json:"id"`
}
The outer JSON wrapper we send in our request body. It contains `params`, which is a JSON object containing all the method parameters. Typically, a struct implementing RequestShell will be populated for you.
type Response ¶
type Response interface {
Content() interface{}
}
An interface that all Status, Result and SignedResult implement so that they can be returned as valid outputs of the Request and SignedRequest functions. The expectation is that any struct that satisfies this interface has the actual data we would care about.
type ResponseShell ¶
type ResponseShell struct {
Version string `json:"jsonrpc"`
Result json.RawMessage `json:"result"`
Error Error `json:"error"`
Id int `json:"id"`
}
The outer JSON wrapper we receive in our request body. It contains `result`, which is a JSON object containing an object containing all the actual data we care for. `error` is returned from the API in lieu of `result` in the event of an error. 'id' and versions are constants supplied and returned by the API.
type Result ¶
type Result struct {
Random Random `json:"random"`
BitsUsed int `json:"bitsUsed"`
BitsLeft int `json:"bitsLeft"`
RequestsLeft int `json:"requestsLeft"`
AdvisoryDelay int `json:"advisoryDelay"`
}
A nested inner JSON wrapper around Random within ResponseShell.Result. It includes some basic diagnostic information as well. One of four types implementing Response interface
type SignedFloatData ¶
type SignedIntegerData ¶
type SignedResult ¶
type SignedResult struct {
Raw json.RawMessage `json:"random"`
Signature string `json:"signature"`
BitsUsed int `json:"bitsUsed"`
BitsLeft int `json:"bitsLeft"`
RequestsLeft int `json:"requestsLeft"`
AdvisoryDelay int `json:"advisoryDelay"`
}
A nested inner JSON wrapper around Random within ResponseShell.Result. It includes some basic diagnostic information as well as a signature to verify the source of the data. One of four types implementing Response interface. Raw is an alias for Random here.
func (SignedResult) Content ¶
func (sr SignedResult) Content() interface{}
type SignedStringData ¶
type Status ¶
type Status struct {
Status string `json:"status"`
CreationTime string `json:"creationTime"`
BitsLeft int `json:"bitsLeft"`
RequestsLeft int `json:"requestsLeft"`
TotalBits int `json:"totalBits"`
TotalRequests int `json:"totalRequests"`
}
A nested inner JSON object within ResponseShell.Result. It includes only basic diagnostic information. One of four types implementing Response interface; returned directly as part of the GetUsage method.
type StringsReq ¶
type VerifiedSignature ¶
type VerifiedSignature struct {
Authenticity bool `json:"authenticiity"`
}
A nested inner JSON object within ResponseShell.Result. It includes only basic diagnostic information. One of four types implementing Response interface; returned directly as part of the GetUsage method.
func (VerifiedSignature) Content ¶
func (vs VerifiedSignature) Content() interface{}