rest

package
v0.0.0-...-cab7180 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartRestServer

func StartRestServer(orm *db.DbOrm, port int)

@securityDefinitions.apikey ApiKeyAuth @in header @name Authorization

Types

type AddTagRequest

type AddTagRequest struct {
	TagID string `json:"tag_id"`
}

type Base

type Base struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type CreateGuestRequest

type CreateGuestRequest struct {
	Name string `json:"name"`
	Doc  string `json:"doc,omitempty"`
}

type CreateScoreRequest

type CreateScoreRequest struct {
	Date        time.Time `json:"date" time_format:"RFC3339"`
	Description string    `json:"description,omitempty"`
	GuestID     string    `json:"guest_id"`
}

type CreateTagRequest

type CreateTagRequest struct {
	Name string `json:"name"`
}

type Guest

type Guest struct {
	Base               `json:",inline"`
	CreateGuestRequest `json:",inline"`
}

type HTTPResponse

type HTTPResponse struct {
	Msg string `json:"msg,omitempty" example:"any message"`
}

type IDResponse

type IDResponse struct {
	ID string `json:"id"`
}

type RestService

type RestService struct {
	Service *service.Service
}

func NewRestService

func NewRestService(service *service.Service) *RestService

func (*RestService) AddTag

func (t *RestService) AddTag(c *fiber.Ctx) error

AddTag godoc @Summary add a tag to a score @ID addTag @Tags Score @Description Router for add a tag to a score @Accept json @Produce json @Param score_id path string true "Score ID" @Param body body AddTagRequest true "JSON body for add a tag to a score" @Success 200 {object} HTTPResponse @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /scores/{score_id}/tags [post]

func (*RestService) CreateGuest

func (t *RestService) CreateGuest(c *fiber.Ctx) error

CreateGuest godoc @Summary create a new guest @ID createGuest @Tags Guest @Description Router for create a new guest @Accept json @Produce json @Param body body CreateGuestRequest true "JSON body for create a new guest" @Success 200 {object} IDResponse @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /guests [post]

func (*RestService) CreateScore

func (t *RestService) CreateScore(c *fiber.Ctx) error

CreateScore godoc @Summary create a new score @ID createScore @Tags Score @Description Router for create a new score @Accept json @Produce json @Param body body CreateScoreRequest true "JSON body for create a new score" @Success 200 {object} IDResponse @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /scores [post]

func (*RestService) CreateTag

func (t *RestService) CreateTag(c *fiber.Ctx) error

CreateTag godoc @Summary create a new tag @ID createTag @Tags Tag @Description Router for create a new tag @Accept json @Produce json @Param body body CreateTagRequest true "JSON body for create a new tag" @Success 200 {object} IDResponse @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /tags [post]

func (*RestService) FindGuest

func (t *RestService) FindGuest(c *fiber.Ctx) error

FindGuest godoc @Summary find a guest @ID findGuest @Tags Guest @Description Router for find a guest @Accept json @Produce json @Param guest_id path string true "Guest ID" @Success 200 {object} Guest @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /guests/{guest_id} [get]

func (*RestService) FindScore

func (t *RestService) FindScore(c *fiber.Ctx) error

FindScore godoc @Summary find a score @ID findScore @Tags Score @Description Router for find a score @Accept json @Produce json @Param score_id path string true "Score ID" @Success 200 {object} Score @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /scores/{score_id} [get]

func (*RestService) FindTag

func (t *RestService) FindTag(c *fiber.Ctx) error

FindTag godoc @Summary find a tag @ID findTag @Tags Tag @Description Router for find a tag @Accept json @Produce json @Param tag_id path string true "Tag ID" @Success 200 {object} Tag @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /tags/{tag_id} [get]

func (*RestService) SearchTags

func (t *RestService) SearchTags(c *fiber.Ctx) error

SearchTags godoc @Summary search tags @ID searchTags @Tags Tag @Description Router for search tags @Accept json @Produce json @Param q query SearchTagsRequest false "query for search tags" @Success 200 {array} Tag @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /tags [get]

func (*RestService) UseScore

func (t *RestService) UseScore(c *fiber.Ctx) error

UseScore godoc @Summary use a score @ID useScore @Tags Score @Description Router for use a score @Accept json @Produce json @Param score_id path string true "Score ID" @Success 200 {object} HTTPResponse @Failure 400 {object} HTTPResponse @Failure 403 {object} HTTPResponse @Router /scores/{score_id}/use [post]

type Score

type Score struct {
	Base               `json:",inline"`
	CreateGuestRequest `json:",inline"`
	WasUsed            bool      `json:"was_used"`
	UsedIn             time.Time `json:"used_in,omitempty"`
	Tags               []Tag     `json:"tags,omitempty"`
}

type SearchTagsRequest

type SearchTagsRequest struct {
	Name string `query:"name"`
}

type Tag

type Tag struct {
	Base             `json:",inline"`
	CreateTagRequest `json:",inline"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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