user

package
v0.0.0-...-59acd12 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

Users routes

All routes that interact directly with users are grouped together under \users.

Create

Creates a new user.

Details
  • Route URL: POST /users
  • Parameters: No parameters.
  • Body:
{
  "role": "number",
  "name": "string",
  "password": "string",
  "email": "string",
  "username": "string"
}
  • Responses:
    • 400 If invalid id.
    • 400 If invalid body.
    • 400 If json fields are invalid.
    • 400 If username is already in use.
    • 400 If email is already in use.
    • 200 If succeeded.

Update

Updates a user by id.

Details
  • Route URL: PATCH /users/:id
  • Parameters: No parameters.
  • Body:
{
  "role": "number",
  "name": "string",
  "password": "string",
  "email": "string",
  "username": "string"
}
  • Responses:
    • 400 If invalid id.
    • 400 If invalid body.
    • 400 If json fields are invalid.
    • 400 If username is already in use.
    • 400 If email is already in use.
    • 404 If user not found.
    • 200 If succeeded.

Delete

Deletes a user by id.

Details
  • Route URL: DELETE /users/:id
  • Parameters: No parameters.
  • Body: No body.
  • Responses:
    • 400 If invalid id.
    • 404 If user not found.
    • 200 If succeeded.

Get users

Get a list of users.

Details
  • Route URL: GET /users
  • Parameters:
    • "limit" Limit of users returned. Default is 30, max is 30, min is 0.
    • "offset" Offset for searching. Default is 0, min is 0.
  • Body: No body.
  • Responses:
    • 200 If succeeded. With body containing it's data in the format:
{
  "id": "number",
  "username": "string",
  "name": "string"
}[]

Get user

Get a user by id.

Details
  • Route URL: GET /users/:id/users
  • Parameters: No parameters.
  • Body: No body.
  • Responses:
    • 400 If invalid id.
    • 404 If user not found.
    • 200 If succeeded. With body containing it's data in the format:
{
  "id": "number",
  "username": "string",
  "name": "string",
  "role": "number",
  "teams-ids": "number[]"
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(api *api.API) func(c *gin.Context)

Creates a new user on database. Responses:

  • 400 If invalid body.
  • 400 If json fields are invalid.
  • 400 If username is already in use.
  • 400 If email is already in use.
  • 200 If succeeded.

func DeleteHandler

func DeleteHandler(api *api.API) func(c *gin.Context)

Deletes user from databse Responses:

  • 400 If invalid id
  • 404 If user not founded
  • 201 If succeeded

func GetHandler

func GetHandler(api *api.API) func(c *gin.Context)

Get user in database Responses:

  • 400 If invalid id
  • 404 If user not foud
  • 200 If succeeded

func MGetHandler

func MGetHandler(api *api.API) func(c *gin.Context)

Get multiple users in database. Params:

  • "limit" Limit of users returned. Default is 30, max is 30, min is 0.
  • "offset" Offset for searching. Default is 0, min is 0.

Responses:

  • 400 If invalid params.
  • 200 If succeeded.

func UpdateHandler

func UpdateHandler(api *api.API) func(c *gin.Context)

Creates a new user on database. Responses:

  • 400 If invalid body.
  • 400 If json fields are invalid.
  • 400 If username or email already in use.
  • 404 If user not founded.
  • 200 If succeeded.

Types

This section is empty.

Jump to

Keyboard shortcuts

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