Help us shape the future of Go! Take the 2026 Go Developer Survey

controllers

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllDefinitions

func AllDefinitions(c *fiber.Ctx) error

AllDefinitions godoc

@Summary		Get all the definitions
@Description	Gets a list of all definitions
@ID				all-definitions
@Tags			definitions
@Security		ApiKeyAuth
@param			Authorization	header	string	true	"Authorization"
@Produce		json
@Success		200	array		definitions.Endpoint
@Failure		500	{object}	ErrorResponse
@Router			/definitions [get]

func AllReports

func AllReports(c *fiber.Ctx) error

AllReports godoc

@Summary		Get all the reports
@Description	Gets a list of all reports that can be filtered with a query
@ID				all-reports
@Tags			reports
@Produce		json
@Param			where	query		string	false	"Query in the format: field.op.value (optional)"
@Param			format	query		string	false	"Return format: json or csv (default: json)"
@Success		200		array		pipeline.Report
@Failure		500		{object}	ErrorResponse
@Router			/reports [get]

func CreateDefinition

func CreateDefinition(c *fiber.Ctx) error

CreateDefinition godoc

@Summary		Create a definition
@Description	Creates a new definition
@ID				create-definition
@Tags			definitions
@Security		ApiKeyAuth
@param			Authorization	header	string	true	"Authorization"
@Accept			json
@Produce		json
@Param			definition	body		definitions.Endpoint	true	"Endpoint definition"
@Success		201			{object}	definitions.Endpoint
@Failure		400			{object}	ErrorResponse
@Failure		500			{object}	ErrorResponse
@Router			/definitions [post]

func Definition

func Definition(c *fiber.Ctx) error

Definition godoc

@Summary		Get one definition
@Description	Gets a single definition identified by his endpoint name
@ID				definition
@Tags			definitions
@Security		ApiKeyAuth
@param			Authorization	header	string	true	"Authorization"
@Produce		json
@Param			name	path		string	true	"Bluetooth"
@Success		200		{object}	definitions.Endpoint
@Failure		404		{object}	ErrorResponse
@Failure		500		{object}	ErrorResponse
@Router			/definitions/:name [get]

func GetHealth

func GetHealth(c *fiber.Ctx) error

GetHealth godoc

@Summary		Health check
@Description	Get the health status of the API
@ID				health
@Tags			health
@Produce		json
@Success		200
@Router			/health [get]

func LoginUser

func LoginUser(c *fiber.Ctx) error

LoginUser godoc

@Summary		Logs a user in
@Schemes		LoginRequest LoginResponse ErrorResponse
@Description	Logs a user in using the provided credentials
@ID				login-user
@Tags			authentication
@Accept			application/json
@Produces		application/json
@Param			data	body		LoginRequest	true	"content"
@Success		200		{object}	LoginResponse
@Failure		400		{object}	ErrorResponse
@Failure		401		{object}	ErrorResponse
@Failure		500		{object}	ErrorResponse
@Router			/login [post]

func Report

func Report(c *fiber.Ctx) error

Report godoc

@Summary		Get one report
@Description	Gets a single report identified by his id
@ID				report
@Tags			reports
@Produce		json
@Param			format	query		string	false	"json"
@Param			id		path		string	true	"qNg8rJX"
@Success		200		{object}	pipeline.Report
@Failure		404		{object}	ErrorResponse
@Failure		500		{object}	ErrorResponse
@Router			/reports/:id [get]

Types

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"` // Holds the information about what happened
}

ErrorResponse is the message returned to the client if any type of error happened

func Err

func Err(err error) ErrorResponse

Err is a helper function to convert an `error` to an `ErrorResponse`

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" validation:"required"`
	Password string `json:"password" validation:"required"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

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