Documentation ¶
Index ¶
- Constants
- func RequireAPIToken(extDeps *extdeps.ExternalServicesBuilder) gin.HandlerFunc
- func WAPICreate(c *gin.Context)
- func WAPIDelete(c *gin.Context)
- func WAPIList(c *gin.Context)
- func WAPIRoutes(r gin.IRouter)
- type CreatePayload
- type DeletePayload
- type FailRes
- type OKRes
- type TokenAPIKey
- type TokenAPIKeyList
Constants ¶
View Source
const ( // PathAPIKeys contains a route to display apikeys. PathAPIKeys string = "apikeys" )
Variables ¶
This section is empty.
Functions ¶
func RequireAPIToken ¶
func RequireAPIToken(extDeps *extdeps.ExternalServicesBuilder) gin.HandlerFunc
RequireAPIToken checks a valid token, and stores the userID for the token to the context
func WAPICreate ¶
WAPICreate is the handler for a create api token endpoint.
func WAPIDelete ¶
WAPIDelete is the handler for the delete api token endpoint.
func WAPIRoutes ¶
WAPIRoutes sets up the routes to handle token api keys.
Types ¶
type CreatePayload ¶
type CreatePayload struct {
Description string `json:"description" binding:"required"`
}
CreatePayload is the required payload to create an API token.
type DeletePayload ¶
type DeletePayload struct {
Key string `json:"key" binding:"required"`
}
DeletePayload is the required payload to delete an API token.
type OKRes ¶
type OKRes struct {
Success bool `json:"success"`
}
OKRes is the response for a successful operation.
type TokenAPIKey ¶
type TokenAPIKey struct { Key string `json:"key"` Created string `json:"created"` Description string `json:"description"` }
TokenAPIKey has the data for an API token
type TokenAPIKeyList ¶
type TokenAPIKeyList struct {
APIKeys []TokenAPIKey `json:"apiKeys"`
}
TokenAPIKeyList has a list of TokenAPIKey's
Click to show internal directories.
Click to hide internal directories.