api

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortBadRequest

func AbortBadRequest(c *gin.Context, err error)

func AbortForbidden

func AbortForbidden(c *gin.Context)

func AbortInternalServerError

func AbortInternalServerError(c *gin.Context, err error)

func AbortNotFound

func AbortNotFound(c *gin.Context)

func AbortUnauthorized

func AbortUnauthorized(c *gin.Context)

func BearerToken

func BearerToken(ctx *gin.Context) (string, error)

func GetClaims

func GetClaims(ctx *gin.Context) jwt.MapClaims

func GetIntegrationId

func GetIntegrationId(ctx *gin.Context) string

func GetLocaleCode

func GetLocaleCode(ctx *gin.Context) string

func GetMemberId

func GetMemberId(ctx *gin.Context) string

func GetOrigin

func GetOrigin(ctx *gin.Context) string

func GetPlanId

func GetPlanId(ctx *gin.Context) string

func GetPlanName

func GetPlanName(ctx *gin.Context) string

func GetTrustFundId deprecated

func GetTrustFundId(ctx *gin.Context) int

Deprecated: Use GetPlanId instead

func HandleError

func HandleError(c *gin.Context, err striveexceptions.Exception)

func NoContentResponse

func NoContentResponse(c *gin.Context)

func OkResponse

func OkResponse(c *gin.Context, data interface{})

func ReadFileFromRequest

func ReadFileFromRequest(req *http.Request, formKey string) ([]byte, string, error)

func Realm

func Realm(ctx *gin.Context) string

func SetClaims

func SetClaims(ctx *gin.Context, claims jwt.MapClaims)

func SetIntegrationId

func SetIntegrationId(ctx *gin.Context, integrationId string)

func SetLocaleCode

func SetLocaleCode(ctx *gin.Context, localeCode string)

func SetPlanId

func SetPlanId(ctx *gin.Context, planId string)

func SetPlanName

func SetPlanName(ctx *gin.Context, planName string)

func SetTrustFundId deprecated

func SetTrustFundId(ctx *gin.Context, trustFundId int)

Deprecated: Use SetPlanId instead

func UserId

func UserId(ctx *gin.Context) string

func Username

func Username(ctx *gin.Context) string

Types

type Api

type Api interface {
	GetRoutes() []ApiRoute
}

type ApiError

type ApiError struct {
	Message string      `json:"message"`
	Path    string      `json:"path"`
	Code    int         `json:"code"`
	Detail  interface{} `json:"detail"`
}

func NewError deprecated

func NewError(message, path string, statusCode int) *ApiError

Deprecated: Will be removed in future versions

func NewErrorCode

func NewErrorCode(message, path string, err error) *ApiError

type ApiResponse

type ApiResponse struct {
	Data  interface{} `json:"data"`
	Error *ApiError   `json:"error"`
}

func (ApiResponse) Serialize

func (r ApiResponse) Serialize() (*string, *string)

func (ApiResponse) ToString

func (r ApiResponse) ToString() string

type ApiRoute

type ApiRoute struct {
	MethodType MethodType
	Anonymous  bool
	// Deprecated: Use SkipPlanCheck instead
	SkipTrustFundCheck   bool
	SkipPlanCheck        bool
	SkipIntegrationCheck bool
	Path                 string
	Handler              gin.HandlerFunc
}

func (ApiRoute) ShouldCheckPlanId

func (a ApiRoute) ShouldCheckPlanId() bool

type EventHandlerError

type EventHandlerError struct {
	Error    error
	CanRetry bool
}

func FatalEventError

func FatalEventError(err error) *EventHandlerError

func RetriableEventError

func RetriableEventError(err error) *EventHandlerError

type EventHandlerFunc

type EventHandlerFunc func(e event.Event) *EventHandlerError

type EventRoute

type EventRoute struct {
	AlwaysAck    bool
	Handler      EventHandlerFunc
	Subscription subscribe.Subscription
}

type MethodType

type MethodType int
const (
	GET MethodType = iota
	POST
	PUT
	DELETE
)

Jump to

Keyboard shortcuts

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