Documentation ¶
Overview ¶
Package presenters allow for the specification and result of a Job, its associated TaskSpecs, and every JobRun and TaskRun to be returned in a user friendly human readable format.
Index ¶
- func FriendlyBigInt(n *big.Int) string
- func ShowEthBalance(store *store.Store) ([]map[string]interface{}, error)
- func ShowLinkBalance(store *store.Store) ([]map[string]interface{}, error)
- type AccountBalance
- type ConfigWhitelist
- type Initiator
- type JobRun
- type JobSpec
- type NewAccount
- type ServiceAgreement
- type TaskSpec
- type Tx
- type UserPresenter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FriendlyBigInt ¶
FriendlyBigInt returns a string printing the integer in both decimal and hexidecimal formats.
func ShowEthBalance ¶
ShowEthBalance returns the current Eth Balance for current Account
Types ¶
type AccountBalance ¶
type AccountBalance struct { Address string `json:"address"` EthBalance *assets.Eth `json:"ethBalance"` LinkBalance *assets.Link `json:"linkBalance"` }
AccountBalance holds the hex representation of the address plus it's ETH & LINK balances
func (AccountBalance) GetID ¶
func (a AccountBalance) GetID() string
GetID returns the ID of this structure for jsonapi serialization.
func (*AccountBalance) SetID ¶
func (a *AccountBalance) SetID(value string) error
SetID is used to set the ID of this structure when deserializing from jsonapi documents.
type ConfigWhitelist ¶
type ConfigWhitelist struct { AccountAddress string `json:"accountAddress"` // contains filtered or unexported fields }
ConfigWhitelist are the non-secret values of the node
If you add an entry here, you should update NewConfigWhitelist and ConfigWhitelist#String accordingly.
func NewConfigWhitelist ¶
func NewConfigWhitelist(store *store.Store) (ConfigWhitelist, error)
NewConfigWhitelist creates an instance of ConfigWhitelist
func (ConfigWhitelist) GetID ¶
func (c ConfigWhitelist) GetID() string
GetID generates a new ID for jsonapi serialization.
func (*ConfigWhitelist) SetID ¶
func (c *ConfigWhitelist) SetID(value string) error
SetID is used to conform to the UnmarshallIdentifier interface for deserializing from jsonapi documents.
func (ConfigWhitelist) String ¶
func (c ConfigWhitelist) String() string
String returns the values as a newline delimited string
type Initiator ¶
Initiator holds the Job definition's Initiator.
func (Initiator) FriendlyAddress ¶
FriendlyAddress returns the Ethereum address if present, and a blank string if not.
func (Initiator) FriendlyRunAt ¶
FriendlyRunAt returns a human-readable string for Cron Initiator types.
func (Initiator) MarshalJSON ¶
MarshalJSON returns the JSON data of the Initiator based on its Initiator Type.
type JobRun ¶
JobRun presents an API friendly version of the data.
func (JobRun) MarshalJSON ¶
MarshalJSON returns the JSON data of the JobRun and its Initiator.
type JobSpec ¶
JobSpec holds the JobSpec definition
func (JobSpec) FriendlyCreatedAt ¶
FriendlyCreatedAt returns a human-readable string of the Job's CreatedAt field.
func (JobSpec) FriendlyEndAt ¶
FriendlyEndAt returns a human-readable string of the Job's EndAt field.
func (JobSpec) FriendlyInitiators ¶
FriendlyInitiators returns the list of Initiator types as a comma separated string.
func (JobSpec) FriendlyStartAt ¶
FriendlyStartAt returns a human-readable string of the Job's StartAt field.
func (JobSpec) FriendlyTasks ¶
FriendlyTasks returns the list of Task types as a comma separated string.
func (JobSpec) MarshalJSON ¶
MarshalJSON returns the JSON data of the Job and its Initiators.
type NewAccount ¶
NewAccount is a jsonapi wrapper for an Ethereum account.
func (NewAccount) GetName ¶
func (a NewAccount) GetName() string
GetName returns the collection name for jsonapi.
type ServiceAgreement ¶
type ServiceAgreement struct {
models.ServiceAgreement
}
ServiceAgreement presents an API friendly version of the data.
func (ServiceAgreement) FriendlyCreatedAt ¶
func (sa ServiceAgreement) FriendlyCreatedAt() string
FriendlyCreatedAt returns the ServiceAgreement's created at time in a human readable format.
func (ServiceAgreement) FriendlyExpiration ¶
func (sa ServiceAgreement) FriendlyExpiration() string
FriendlyExpiration returns the ServiceAgreement's Encumbrance expiration time in a human readable format.
func (ServiceAgreement) FriendlyPayment ¶
func (sa ServiceAgreement) FriendlyPayment() string
FriendlyPayment returns the ServiceAgreement's Encumbrance payment amount in a human readable format.
func (ServiceAgreement) MarshalJSON ¶
func (sa ServiceAgreement) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON data of the ServiceAgreement.
type TaskSpec ¶
TaskSpec holds a task specified in the Job definition.
func (TaskSpec) FriendlyParams ¶
FriendlyParams returns a map of the TaskSpec's parameters.
type Tx ¶
type Tx struct { Confirmed bool `json:"confirmed,omitempty"` Data hexutil.Bytes `json:"data,omitempty"` From *common.Address `json:"from,omitempty"` GasLimit string `json:"gasLimit,omitempty"` GasPrice string `json:"gasPrice,omitempty"` Hash common.Hash `json:"hash,omitempty"` Hex string `json:"rawHex,omitempty"` Nonce string `json:"nonce,omitempty"` SentAt string `json:"sentAt,omitempty"` To *common.Address `json:"to,omitempty"` Value string `json:"value,omitempty"` }
Tx is a jsonapi wrapper for an Ethereum Transaction.
func NewTxFromAttempt ¶
NewTxFromAttempt builds a transaction presenter from a TxAttempt
models.Tx represents a transaction in progress, with a series of models.TxAttempts, each one of these represents an ethereum transaction. A TxAttempt only stores the unique details of an ethereum transaction, with the rest of the details on its related Tx.
So for presenting a TxAttempt, we take its Hash, GasPrice etc. and get the rest of the details from its Tx.
NOTE: We take a copy here as we don't want side effects.
type UserPresenter ¶
UserPresenter wraps the user record for shipping as a jsonapi response in the API.
func (UserPresenter) GetName ¶
func (u UserPresenter) GetName() string
GetName returns the collection name for jsonapi.
func (UserPresenter) MarshalJSON ¶
func (u UserPresenter) MarshalJSON() ([]byte, error)
MarshalJSON returns the User as json.