Documentation ¶
Overview ¶
Package v2 is the main package for Temporal's http api
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 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) ConfirmPayment(c *gin.Context)
- func (api *API) CreateDashPayment(c *gin.Context)
- func (api *API) FileSizeCheck(size int64) error
- func (api *API) GetDepositAddress(c *gin.Context)
- func (api *API) ListenAndServe(ctx context.Context, addr string, tls *TLSConfig) error
- func (api *API) LogError(err error, message string, fields ...interface{}) func(c *gin.Context, code ...int)
- func (api *API) RequestSignedPaymentMessage(c *gin.Context)
- func (api *API) SystemsCheck(c *gin.Context)
- type CreditRefund
- 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 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, 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) ConfirmPayment ¶
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 ¶
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) GetDepositAddress ¶
GetDepositAddress is used to get a deposit address for a user
func (*API) ListenAndServe ¶
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 ¶
RequestSignedPaymentMessage is used to get a signed message from the GRPC API Payments Server
func (*API) SystemsCheck ¶
SystemsCheck is a basic check of system integrity
type CreditRefund ¶
CreditRefund is a data object to contain refund information