Documentation
¶
Overview ¶
Package v2 is the main package for Temporal's V2 http API. API reference is available [here](https://documenter.getpostman.com/view/4295780/RWEcQM6W#intro)
Index ¶
- Constants
- func CheckAccessForPrivateNetwork(username, networkName string, db *gorm.DB) error
- func Fail(c *gin.Context, err error, code ...int)
- func FailNotAuthorized(c *gin.Context, message string)
- func FailWithBadRequest(c *gin.Context, message string)
- func FailWithMessage(c *gin.Context, message string, code ...int)
- func FailWithMissingField(c *gin.Context, field string)
- func GetAuthToken(c *gin.Context) string
- func GetAuthenticatedUserFromContext(c *gin.Context) (string, error)
- func Respond(c *gin.Context, status int, body gin.H)
- type API
- func (api *API) Close()
- func (api *API) ConfirmETHPayment(c *gin.Context)
- func (api *API) CreateDashPayment(c *gin.Context)
- func (api *API) FileSizeCheck(size int64) error
- func (api *API) GetIPFSEndpoint(networkName string) string
- func (api *API) ListenAndServe(ctx context.Context, addr string, tlsConfig *TLSConfig) error
- func (api *API) LogError(c *gin.Context, err error, message string, fields ...interface{}) func(code ...int)
- func (api *API) RequestSignedPaymentMessage(c *gin.Context)
- func (api *API) SystemsCheck(c *gin.Context)
- type Clients
- type CreditRefund
- type Options
- type TLSConfig
Constants ¶
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 ¶
CheckAccessForPrivateNetwork checks if a user has access to a private network
func Fail ¶
Fail fails context with given error and optional status code. Defaults to http.StatusInternalServerError
func FailNotAuthorized ¶
FailNotAuthorized is a failure used when a user is unauthorized for an action
func FailWithBadRequest ¶
FailWithBadRequest fails context with a bad request error and given message
func FailWithMessage ¶
FailWithMessage fails context with given message and optional status code. Defaults to http.StatusInternalServerError
func FailWithMissingField ¶
FailWithMissingField is a failure used when a post form does not exist
func GetAuthToken ¶
GetAuthToken is used to retrieve the jwt token from an authenticated request
func GetAuthenticatedUserFromContext ¶
GetAuthenticatedUserFromContext is used to pull the eth address of hte user
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, opts Options, clients Clients, l *zap.SugaredLogger, ) (*API, error)
Initialize is used ot initialize our API service. debug = true is useful for debugging database issues.
func (*API) ConfirmETHPayment ¶
ConfirmETHPayment is used to confirm an ethereum based payment
func (*API) CreateDashPayment ¶
CreateDashPayment is used to create a dash payment via chainrider
func (*API) FileSizeCheck ¶
FileSizeCheck is used to check and validate the size of the uploaded file
func (*API) GetIPFSEndpoint ¶
GetIPFSEndpoint is used to construct the api url to connect to for private ipfs networks. in the case of dev mode it returns an default, non nexus based ipfs api address
func (*API) ListenAndServe ¶
ListenAndServe spins up the API server
func (*API) LogError ¶
func (api *API) LogError(c *gin.Context, err error, message string, fields ...interface{}) func(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
Passing in the initial gin.Context to LogError is used to extract the X-Request-ID associated with the given request to make it easier to debug user-submitted erros.
func (*API) RequestSignedPaymentMessage ¶
RequestSignedPaymentMessage is used to get a signed message from the GRPC API Payments Server this is currently used for ETH+RTC smart-contract facilitated payments
func (*API) SystemsCheck ¶
SystemsCheck is a basic check of system integrity
type Clients ¶
type Clients struct { Lens pbLens.IndexerAPIClient Orch pbOrch.ServiceClient Signer pbSigner.SignerClient }
Clients is used to configure service clients we use
type CreditRefund ¶
CreditRefund is a data object to contain refund information