wtokenapi

package
v0.0.0-...-9008a76 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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.ExternalServices) gin.HandlerFunc

RequireAPIToken checks a valid token, and stores the userID for the token to the context

func WAPICreate

func WAPICreate(c *gin.Context)

WAPICreate is the handler for a create api token endpoint.

func WAPIDelete

func WAPIDelete(c *gin.Context)

WAPIDelete is the handler for the delete api token endpoint.

func WAPIList

func WAPIList(c *gin.Context)

WAPIList is the handler for the list api tokens endpoint.

func WAPIRoutes

func WAPIRoutes(r gin.IRouter)

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 FailRes

type FailRes struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

FailRes is the response for a failed operation.

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

Jump to

Keyboard shortcuts

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