controller

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
}

func NewController

func NewController() *Controller

func (*Controller) AddAccount

func (c *Controller) AddAccount(ctx *gin.Context)

AddAccount godoc @Summary Add a account @Description add by json account @Tags accounts @Accept json @Produce json @Param account body model.AddAccount true "Add account" @Success 200 {object} model.Account @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /accounts [post]

func (*Controller) AttributeExample

func (c *Controller) AttributeExample(ctx *gin.Context)

AttributeExample godoc @Summary attribute example @Description attribute @Tags example @Accept json @Produce json @Param enumstring query string false "string enums" Enums(A, B, C) @Param enumint query int false "int enums" Enums(1, 2, 3) @Param enumnumber query number false "int enums" Enums(1.1, 1.2, 1.3) @Param string query string false "string valid" minlength(5) maxlength(10) @Param int query int false "int valid" mininum(1) maxinum(10) @Param default query string false "string default" default(A) @Success 200 {string} string "answer" @Failure 400 {string} string "ok" @Failure 404 {string} string "ok" @Failure 500 {string} string "ok" @Router /examples/attribute [get]

func (*Controller) Auth

func (c *Controller) Auth(ctx *gin.Context)

Auth godoc @Summary Auth admin @Description get admin info @Tags accounts,admin @Accept json @Produce json @Success 200 {object} model.Admin @Failure 400 {object} httputil.HTTPError @Failure 401 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Security ApiKeyAuth @Router /admin/auth [post]

func (*Controller) CalcExample

func (c *Controller) CalcExample(ctx *gin.Context)

CalcExample godoc @Summary calc example @Description plus @Tags example @Accept json @Produce json @Param val1 query int true "used for calc" @Param val2 query int true "used for calc" @Success 200 {integer} integer "answer" @Failure 400 {string} string "ok" @Failure 404 {string} string "ok" @Failure 500 {string} string "ok" @Router /examples/calc [get]

func (*Controller) DeleteAccount

func (c *Controller) DeleteAccount(ctx *gin.Context)

DeleteAccount godoc @Summary Update a account @Description Delete by account ID @Tags accounts @Accept json @Produce json @Param id path int true "Account ID" Format(int64) @Success 204 {object} model.Account @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /accounts/{id} [delete]

func (*Controller) HeaderExample

func (c *Controller) HeaderExample(ctx *gin.Context)

HeaderExample godoc @Summary custome header example @Description custome header @Tags example @Accept json @Produce json @Param Authorization header string true "Authentication header" @Success 200 {string} string "answer" @Failure 400 {string} string "ok" @Failure 404 {string} string "ok" @Failure 500 {string} string "ok" @Router /examples/header [get]

func (*Controller) ListAccounts

func (c *Controller) ListAccounts(ctx *gin.Context)

ListAccounts godoc @Summary List accounts @Description get accounts @Tags accounts @Accept json @Produce json @Param q query string false "name search by q" Format(email) @Success 200 {array} model.Account @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /accounts [get]

func (*Controller) ListBottles

func (c *Controller) ListBottles(ctx *gin.Context)

ListBottles godoc @Summary List bottles @Description get bottles @Tags bottles @Accept json @Produce json @Success 200 {array} model.Bottle @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /bottles [get]

func (*Controller) PathParamsExample

func (c *Controller) PathParamsExample(ctx *gin.Context)

PathParamsExample godoc @Summary path params example @Description path params @Tags example @Accept json @Produce json @Param group_id path int true "Group ID" @Param account_id path int true "Account ID" @Success 200 {string} string "answer" @Failure 400 {string} string "ok" @Failure 404 {string} string "ok" @Failure 500 {string} string "ok" @Router /examples/groups/{group_id}/accounts/{account_id} [get]

func (*Controller) PingExample

func (c *Controller) PingExample(ctx *gin.Context)

PingExample godoc @Summary ping example @Description do ping @Tags example @Accept json @Produce json @Success 200 {string} string "pong" @Failure 400 {string} string "ok" @Failure 404 {string} string "ok" @Failure 500 {string} string "ok" @Router /examples/ping [get]

func (*Controller) SecuritiesExample

func (c *Controller) SecuritiesExample(ctx *gin.Context)

SecuritiesExample godoc @Summary custome header example @Description custome header @Tags example @Accept json @Produce json @Param Authorization header string true "Authentication header" @Success 200 {string} string "answer" @Failure 400 {string} string "ok" @Failure 404 {string} string "ok" @Failure 500 {string} string "ok" @Security ApiKeyAuth @Security OAuth2Implicit[admin, write] @Router /examples/securities [get]

func (*Controller) ShowAccount

func (c *Controller) ShowAccount(ctx *gin.Context)

ShowAccount godoc @Summary Show a account @Description get string by ID @Tags accounts @Accept json @Produce json @Param id path int true "Account ID" @Success 200 {object} model.Account @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /accounts/{id} [get]

func (*Controller) ShowBottle

func (c *Controller) ShowBottle(ctx *gin.Context)

ShowBottle godoc @Summary Show a bottle @Description get string by ID @ID get-string-by-int @Tags bottles @Accept json @Produce json @Param id path int true "Bottle ID" @Success 200 {object} model.Bottle @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /bottles/{id} [get]

func (*Controller) UpdateAccount

func (c *Controller) UpdateAccount(ctx *gin.Context)

UpdateAccount godoc @Summary Update a account @Description Update by json account @Tags accounts @Accept json @Produce json @Param id path int true "Account ID" @Param account body model.UpdateAccount true "Update account" @Success 200 {object} model.Account @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /accounts/{id} [patch]

func (*Controller) UploadAccountImage

func (c *Controller) UploadAccountImage(ctx *gin.Context)

UploadAccountImage godoc @Summary Upload account image @Description Upload file @Tags accounts @Accept multipart/form-data @Produce json @Param id path int true "Account ID" @Param file formData file true "account image" @Success 200 {object} controller.Message @Failure 400 {object} httputil.HTTPError @Failure 404 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Router /accounts/{id}/images [post]

type Message

type Message struct {
	Message string `json:"message" example:"message"`
}

Jump to

Keyboard shortcuts

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