Documentation ¶
Index ¶
- func GetRegisteredJobSpecs(w http.ResponseWriter, r *http.Request)
- func InputDataExample(w http.ResponseWriter, r *http.Request)
- func NewRouter() *mux.Router
- func PendingTaskRun(w http.ResponseWriter, r *http.Request)
- func ResumeFromPending(w http.ResponseWriter, r *http.Request)
- func ReturnBigInt(w http.ResponseWriter, r *http.Request)
- func ReturnError(w http.ResponseWriter, r *http.Request)
- func TaskRun(w http.ResponseWriter, r *http.Request)
- func WriteData(w http.ResponseWriter, result RunResult)
- type Chainlink
- type Data
- type Details
- type MiddlewareFunc
- type Route
- type Routes
- type RunResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRegisteredJobSpecs ¶
func GetRegisteredJobSpecs(w http.ResponseWriter, r *http.Request)
func InputDataExample ¶
func InputDataExample(w http.ResponseWriter, r *http.Request)
InputDataExample reads the input JSON given from the core, calls the GetRestData method, and fulfills the request. It will log both the input and output JSON for troubleshooting.
func PendingTaskRun ¶
func PendingTaskRun(w http.ResponseWriter, r *http.Request)
GetPending method, and returns a RunResult with the pending status set to true. It will log both the input and output JSON for troubleshooting.
func ResumeFromPending ¶
func ResumeFromPending(w http.ResponseWriter, r *http.Request)
ResumeFromPending allows you to resume a pending run, given its JobRunID.
func ReturnBigInt ¶
func ReturnBigInt(w http.ResponseWriter, r *http.Request)
ReturnBigInt reads the input JSON given from the core, calls the GetBigInt method, and fulfills the request. It will log both the input and output JSON for troubleshooting.
func ReturnError ¶
func ReturnError(w http.ResponseWriter, r *http.Request)
ReturnError returns an error back to the caller
func TaskRun ¶
func TaskRun(w http.ResponseWriter, r *http.Request)
TaskRun reads the input JSON given from the core, calls the GetData method, and fulfills the request. It will log both the input and output JSON for troubleshooting.
func WriteData ¶
func WriteData(w http.ResponseWriter, result RunResult)
WriteData returns the data to the requester
Types ¶
type Chainlink ¶
Chainlink contains the fields necessary for receiving the data that will be sent to the adapter and for returing back to the node itself.
func RequestData ¶
func RequestData(w http.ResponseWriter, r *http.Request) Chainlink
RequestData makes the call to the external resources (in this case, that's simulated in chainlink.go).
type Data ¶
type Data struct { Value string `json:"value,omitempty"` Details Details `json:"details,omitempty"` Other string `json:"other,omitempty"` }
Data should be modeled after the target endpoint. You can use something like JSON-to-Go to make this easy: https://mholt.github.io/json-to-go/
type Details ¶
type Details struct { Close string `json:"close,omitempty"` Open float64 `json:"open,omitempty"` Current string `json:"current,omitempty"` }
Details is just a simple nested JSON object.
type MiddlewareFunc ¶
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
type RunResult ¶
type RunResult struct { JobRunID string `json:"jobRunId"` Data Data `json:"data"` Status string `json:"status"` ErrorMessage null.String `json:"error"` Pending bool `json:"pending"` }
RunResult formats the response data to the format that the node expects.
func GetData ¶
GetData is where you woud reach out to your desired endpoint and store the response in the Data struct.
func GetInputData ¶
GetInputData allows data to be passed into the adapter and the result will be determined based on what it is given. Pass in '{"other": "GetData"}' to retrieve the value "10000" Pass in '{"other": "GetBigInt"}' to retrieve the value "20000" Pass in '{"other": "GetRestData"}' to retrieve the value "30000"
func GetPending ¶
GetPending returns the pending field as true without data.
func GetReportData ¶
GetReportData allows data to be passed into the adapter and the result will be determined based on what it is given.