web

package
v0.0.0-...-5cb58b4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package web handles receiving and supplying information within the node.

AccountBalanceController

AccountBalanceController allows for the display of the active accounts ETH and LINK balances.

API

API contains logic for the web interface to display items.

BackupController

BackupController allows for backups to be initialized over GET.

BridgeTypesController

BridgeTypesController allows for the creation of BridgeTypes on the node. BridgeTypes are the external adapters which add functionality not available in the core, from outside the node.

JobRunsController

JobRunsController allows for the creation of JobRuns within a given Job on the node.

JobSpecsController

JobSpecsController allows for the creation of specs to be added to the node, and shows the current specs which have already been added.

Router

Router defines the valid paths for the node and responds to requests.

SnapshotsController

SnapshotsController allows for the creation and showing of V1 snapshots in the node.

Index

Constants

View Source
const (
	// PaginationDefault is the number of records to supply from a paginated
	// request when no size param is supplied.
	PaginationDefault = 25

	// MediaType is the response header for JSONAPI documents.
	MediaType = "application/vnd.api+json"

	// KeyNextLink is the name of the key that contains the HREF for the next
	// document in a paginated response.
	KeyNextLink = "next"
	// KeyPreviousLink is the name of the key that contains the HREF for the
	// previous document in a paginated response.
	KeyPreviousLink = "prev"
)
View Source
const (
	// SessionName is the session name
	SessionName = "clsession"
	// SessionIDKey is the session ID key in the session map
	SessionIDKey = "clsession_id"
)

Variables

This section is empty.

Functions

func MatchExactBoxPath

func MatchExactBoxPath(boxList []string, path string) (matchedPath string)

MatchExactBoxPath returns the box path when there is an exact match for the resource and an empty string otherwise

func MatchWildcardBoxPath

func MatchWildcardBoxPath(boxList []string, path string, file string) (matchedPath string)

MatchWildcardBoxPath returns the box path when there is a wildcard match and an empty string otherwise

func NewBox

func NewBox() packr.Box

NewBox returns production build artifacts when the test tag is not present

func NewJSONAPIResponse

func NewJSONAPIResponse(resource interface{}) ([]byte, error)

NewJSONAPIResponse returns a JSONAPI response for a single resource.

func NewPaginatedResponse

func NewPaginatedResponse(url url.URL, size, page, count int, resource interface{}) ([]byte, error)

NewPaginatedResponse returns a jsonapi.Document with links to next and previous collection pages

func ParseJSONAPIResponse

func ParseJSONAPIResponse(input []byte, resource interface{}) error

ParseJSONAPIResponse parses the bytes of the root document and unmarshals it into the given resource.

func ParsePaginatedRequest

func ParsePaginatedRequest(sizeParam, pageParam string) (int, int, int, error)

ParsePaginatedRequest parses the parameters that control pagination for a collection request, returning the size and offset if specified, or a sensible default.

func ParsePaginatedResponse

func ParsePaginatedResponse(input []byte, resource interface{}, links *jsonapi.Links) error

ParsePaginatedResponse parse a JSONAPI response for a document with links

func Router

Router listens and responds to requests to the node for valid paths.

func StatusCodeForError

func StatusCodeForError(err interface{}) int

StatusCodeForError returns an http status code for an error type.

Types

type AccountBalanceController

type AccountBalanceController struct {
	App *services.ChainlinkApplication
}

AccountBalanceController returns information for the active account

func (*AccountBalanceController) Show

func (abc *AccountBalanceController) Show(c *gin.Context)

Show returns the address, plus it's ETH & LINK balance Example:

"<application>/account_balance"

type AssignmentsController

type AssignmentsController struct {
	App *services.ChainlinkApplication
}

AssignmentsController manages Assignment requests.

func (*AssignmentsController) Create

func (ac *AssignmentsController) Create(c *gin.Context)

Create adds validates, saves, and starts a new JobSpec from the v1 assignment spec format. Example:

"<application>/assignments"

func (*AssignmentsController) Show

func (ac *AssignmentsController) Show(c *gin.Context)

Show returns specified assignment ID from the v1 assignment spec format. Example:

"<application>/assignments/:ID"

type BackupController

type BackupController struct {
	App *services.ChainlinkApplication
}

BackupController streams backups over GET.

func (*BackupController) Show

func (bc *BackupController) Show(c *gin.Context)

Show streams a backup of the current db through a read-only transaction.

type BridgeTypesController

type BridgeTypesController struct {
	App *services.ChainlinkApplication
}

BridgeTypesController manages BridgeType requests in the node.

func (*BridgeTypesController) Create

func (btc *BridgeTypesController) Create(c *gin.Context)

Create adds the BridgeType to the given context.

func (*BridgeTypesController) Destroy

func (btc *BridgeTypesController) Destroy(c *gin.Context)

Destroy removes a specific Bridge.

func (*BridgeTypesController) Index

func (btc *BridgeTypesController) Index(c *gin.Context)

Index lists Bridges, one page at a time.

func (*BridgeTypesController) Show

func (btc *BridgeTypesController) Show(c *gin.Context)

Show returns the details of a specific Bridge.

type ConfigController

type ConfigController struct {
	App *services.ChainlinkApplication
}

ConfigController manages config variables

func (*ConfigController) Show

func (cc *ConfigController) Show(c *gin.Context)

Show returns the whitelist of config variables Example:

"<application>/config"

type JobRunsController

type JobRunsController struct {
	App *services.ChainlinkApplication
}

JobRunsController manages JobRun requests in the node.

func (*JobRunsController) Create

func (jrc *JobRunsController) Create(c *gin.Context)

Create starts a new Run for the requested JobSpec. Example:

"<application>/specs/:SpecID/runs"

func (*JobRunsController) Index

func (jrc *JobRunsController) Index(c *gin.Context)

Index returns paginated JobRuns for a given JobSpec Example:

"<application>/specs/:SpecID/runs?size=1&page=2"

func (*JobRunsController) Show

func (jrc *JobRunsController) Show(c *gin.Context)

Show returns the details of a JobRun. Example:

"<application>/runs/:RunID"

func (*JobRunsController) Update

func (jrc *JobRunsController) Update(c *gin.Context)

Update allows external adapters to resume a JobRun, reporting the result of the task and marking it no longer pending. Example:

"<application>/runs/:RunID"

type JobSpecsController

type JobSpecsController struct {
	App *services.ChainlinkApplication
}

JobSpecsController manages JobSpec requests.

func (*JobSpecsController) Create

func (jsc *JobSpecsController) Create(c *gin.Context)

Create adds validates, saves, and starts a new JobSpec. Example:

"<application>/specs"

func (*JobSpecsController) Index

func (jsc *JobSpecsController) Index(c *gin.Context)

Index lists JobSpecs, one page at a time. Example:

"<application>/specs?size=1&page=2"

func (*JobSpecsController) Show

func (jsc *JobSpecsController) Show(c *gin.Context)

Show returns the details of a JobSpec. Example:

"<application>/specs/:SpecID"

type ServiceAgreementsController

type ServiceAgreementsController struct {
	App *services.ChainlinkApplication
}

ServiceAgreementsController manages service agreements.

func (*ServiceAgreementsController) Create

func (sac *ServiceAgreementsController) Create(c *gin.Context)

Create builds and saves a new service agreement record.

func (*ServiceAgreementsController) Show

func (sac *ServiceAgreementsController) Show(c *gin.Context)

Show returns the details of a ServiceAgreement. Example:

"<application>/service_agreements/:SAID"

type SessionsController

type SessionsController struct {
	App *services.ChainlinkApplication
}

SessionsController manages session requests.

func (*SessionsController) Create

func (sc *SessionsController) Create(c *gin.Context)

Create creates a session ID for the given user credentials, and returns it in a cookie.

func (*SessionsController) Destroy

func (sc *SessionsController) Destroy(c *gin.Context)

Destroy erases the session ID for the sole API user.

type SnapshotsController

type SnapshotsController struct {
	App *services.ChainlinkApplication
}

SnapshotsController manages Snapshot requests.

func (*SnapshotsController) CreateSnapshot

func (sc *SnapshotsController) CreateSnapshot(c *gin.Context)

CreateSnapshot begins the job run for the given Assignment ID Example:

"/assignments/:AID/snapshots"

func (*SnapshotsController) ShowSnapshot

func (sc *SnapshotsController) ShowSnapshot(c *gin.Context)

ShowSnapshot returns snapshot for given ID Example:

"/snapshots/:ID"

type WithdrawalsController

type WithdrawalsController struct {
	App *services.ChainlinkApplication
}

WithdrawalsController can send LINK tokens to another address

func (*WithdrawalsController) Create

func (abc *WithdrawalsController) Create(c *gin.Context)

Create sends LINK from the configured oracle contract to the given address Example:

"<application>/withdrawals"

Jump to

Keyboard shortcuts

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