v2

package
v2.0.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2018 License: Apache-2.0 Imports: 41 Imported by: 0

README

Temporal API V2

API Reference

Documentation

Overview

Package v2 is the main package for Temporal's http api

Index

Constants

View Source
const (
	// FilesUploadBucket is the bucket files are stored into before being processed
	FilesUploadBucket = "filesuploadbucket"
	// RtcCostUsd is the price of a single RTC in USD
	RtcCostUsd = 0.125
)

Variables

This section is empty.

Functions

func CheckAccessForPrivateNetwork

func CheckAccessForPrivateNetwork(username, networkName string, db *gorm.DB) error

CheckAccessForPrivateNetwork checks if a user has access to a private network

func Fail

func Fail(c *gin.Context, err error, code ...int)

Fail fails context with given error and optional status code. Defaults to http.StatusInternalServerError

func FailNotAuthorized

func FailNotAuthorized(c *gin.Context, message string)

FailNotAuthorized is a failure used when a user is unauthorized for an action

func FailWithBadRequest

func FailWithBadRequest(c *gin.Context, message string)

FailWithBadRequest fails context with a bad request error and given message

func FailWithMessage

func FailWithMessage(c *gin.Context, message string, code ...int)

FailWithMessage fails context with given message and optional status code. Defaults to http.StatusInternalServerError

func FailWithMissingField

func FailWithMissingField(c *gin.Context, field string)

FailWithMissingField is a failure used when a post form does not exist

func GetAuthenticatedUserFromContext

func GetAuthenticatedUserFromContext(c *gin.Context) (string, error)

GetAuthenticatedUserFromContext is used to pull the eth address of hte user

func Respond

func Respond(c *gin.Context, status int, body gin.H)

Respond is a wrapper used to handle API responses

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is our API service

func Initialize

func Initialize(

	cfg *config.TemporalConfig,
	version string,
	debug bool,

	l *zap.SugaredLogger,
	lens pbLens.IndexerAPIClient,
	orch pbOrch.ServiceClient,
	signer pbSigner.SignerClient,

) (*API, error)

Initialize is used ot initialize our API service. debug = true is useful for debugging database issues.

func (*API) Close

func (api *API) Close()

Close releases API resources

func (*API) ConfirmPayment

func (api *API) ConfirmPayment(c *gin.Context)

ConfirmPayment is used to confirm a payment after sending it. By giving Temporal the TxHash, we can then validate that hte payment was made, and validated by the appropriate blockchain.

func (*API) CreateDashPayment

func (api *API) CreateDashPayment(c *gin.Context)

CreateDashPayment is used to create a dash payment via chainrider

func (*API) FileSizeCheck

func (api *API) FileSizeCheck(size int64) error

FileSizeCheck is used to check and validate the size of the uploaded file

func (*API) GetDepositAddress

func (api *API) GetDepositAddress(c *gin.Context)

GetDepositAddress is used to get a deposit address for a user

func (*API) ListenAndServe

func (api *API) ListenAndServe(ctx context.Context, addr string, tls *TLSConfig) error

ListenAndServe spins up the API server

func (*API) LogError

func (api *API) LogError(err error, message string, fields ...interface{}) func(c *gin.Context, code ...int)

LogError is a wrapper used by the API to handle logging of errors. Returns a callback to also fail a gin context with an optional status code, which defaults to http.StatusInternalServerError. Fields is an optional set of params provided in pairs, where the first of a pair is the key, and the second is the value

func (*API) RequestSignedPaymentMessage

func (api *API) RequestSignedPaymentMessage(c *gin.Context)

RequestSignedPaymentMessage is used to get a signed message from the GRPC API Payments Server

func (*API) SystemsCheck

func (api *API) SystemsCheck(c *gin.Context)

SystemsCheck is a basic check of system integrity

type CreditRefund

type CreditRefund struct {
	Username string
	CallType string
	Cost     float64
}

CreditRefund is a data object to contain refund information

type TLSConfig

type TLSConfig struct {
	CertFile string
	KeyFile  string
}

TLSConfig is used to enable TLS on the API service

Jump to

Keyboard shortcuts

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