handlers

package
v0.0.0-...-7657855 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

func NewAuthHandler

func NewAuthHandler(ctx context.Context, collection *mongo.Collection) *AuthHandler

func (*AuthHandler) AuthMiddleware

func (handler *AuthHandler) AuthMiddleware() gin.HandlerFunc

func (*AuthHandler) GetUserHandler

func (handler *AuthHandler) GetUserHandler(c *gin.Context)

swagger:operation GET /user/:username auth getUser Gets an user --- produces: - application/json responses:

'200':
    description: Successful operation
'404':
    description: User not found

func (*AuthHandler) RefreshHandler

func (handler *AuthHandler) RefreshHandler(c *gin.Context)

swagger:operation POST /refresh auth refresh Refresh token --- produces: - application/json responses:

'200':
    description: Successful operation
'401':
    description: Invalid credentials

func (*AuthHandler) SignInHandler

func (handler *AuthHandler) SignInHandler(c *gin.Context)

swagger:operation POST /signin auth signIn Login with username and password --- produces: - application/json responses:

'200':
    description: Successful operation
'401':
    description: Invalid credentials

func (*AuthHandler) SignUpHandler

func (handler *AuthHandler) SignUpHandler(c *gin.Context)

swagger:operation POST /signup auth signup Signs up an user --- produces: - application/json responses:

'200':
    description: Successful operation
'400':
    description: User already exists
'500':
    description: Internal error

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.StandardClaims
}

type JWTOutput

type JWTOutput struct {
	Token   string    `json:"token"`
	Expires time.Time `json:"expires"`
}

type RecipesHandler

type RecipesHandler struct {
	// contains filtered or unexported fields
}

func NewRecipesHandler

func NewRecipesHandler(ctx context.Context, collection *mongo.Collection, redisClient *redis.Client) *RecipesHandler

func (*RecipesHandler) DeleteRecipeHandler

func (handler *RecipesHandler) DeleteRecipeHandler(c *gin.Context)

swagger:operation DELETE /recipes/{id} recipes deleteRecipe Delete an existing recipe --- produces: - application/json parameters:

  • name: id in: path description: ID of the recipe required: true type: string

responses:

'200':
    description: Successful operation
'404':
    description: Invalid recipe ID

func (*RecipesHandler) GetRecipeHandler

func (handler *RecipesHandler) GetRecipeHandler(c *gin.Context)

swagger:operation GET /recipes/:id recipes getRecipe Returns a recipe by its ID --- produces: - application/json responses:

'200':
    description: Successful operation

func (*RecipesHandler) ListRecipesHandler

func (handler *RecipesHandler) ListRecipesHandler(c *gin.Context)

swagger:operation GET /recipes recipes listRecipes Returns list of recipes --- produces: - application/json responses:

'200':
    description: Successful operation

func (*RecipesHandler) NewRecipeHandler

func (handler *RecipesHandler) NewRecipeHandler(c *gin.Context)

swagger:operation POST /recipes recipes newRecipe Create a new recipe --- produces: - application/json responses:

'200':
    description: Successful operation
'400':
    description: Invalid input

func (*RecipesHandler) SearchRecipeHandler

func (handler *RecipesHandler) SearchRecipeHandler(c *gin.Context)

swagger:operation GET /recipes/search recipes findRecipe Search recipes based on tags --- produces: - application/json parameters:

  • name: tag in: query description: recipe tag required: true type: string

responses:

'200':
    description: Successful operation

func (*RecipesHandler) UpdateRecipeHandler

func (handler *RecipesHandler) UpdateRecipeHandler(c *gin.Context)

swagger:operation PUT /recipes/{id} recipes updateRecipe Update an existing recipe --- parameters:

  • name: id in: path description: ID of the recipe required: true type: string

produces: - application/json responses:

'200':
    description: Successful operation
'400':
    description: Invalid input
'404':
    description: Invalid recipe ID

Jump to

Keyboard shortcuts

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