handlers

package
v0.0.0-...-50dfd56 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFilm

func AddFilm(c *gin.Context)

AddFilm godoc @Summary Add film by json body @Description Add film json body @Tags api @Accept json @Produce json @Param Film body tmdb.Film true "Added the film by fields" @Description "Only with user role = 'admin'" @Success 200 "{"ok": "film successful added with that ID ___"}" @Failure 400 "{"error": "film is exist with that ___"}" string @Security ApiKeyAuth Token @Security ApiKeyAuth Refresh @Router /api/v1/films/ [post]

func ApiOverview

func ApiOverview(c *gin.Context)

ApiOverview godoc @Summary Api overview @Description Api overview @Tags api @Accept json @Produce json @Success 200 {object} database.Overview "Return films and user count" @Failure 400 "{"error": "can't fetch from db films"}" string @Security ApiKeyAuth Token @Security ApiKeyAuth Refresh @Router /api/v1/ [get]

func ClearCookie

func ClearCookie(c *gin.Context)

func DeleteFilm

func DeleteFilm(c *gin.Context)

DeleteFilm godoc @Summary Delete film by ID @Description Delete film by ID @Tags api @Accept json @Produce json @Param ID path int true "Delete film by ID" @Success 200 "{"ok": "film with ID ___ deleted"}" @Failure 400 "{"error": "film ID doesn't exist in database: ___"}" string @Description "Only with user role = 'admin'" @Security ApiKeyAuth Token @Security ApiKeyAuth Refresh @Router /api/v1/films/film/{ID} [delete]

func FetchAllFilms

func FetchAllFilms(c *gin.Context)

FetchAllFilms godoc @Summary Get all films @Description Get all films @Tags api @Accept json @Produce json @Success 200 {array} tmdb.Film "Return all films" @Failure 400 "{"error": "can't fetch from db films"}" string @Security ApiKeyAuth Token @Security ApiKeyAuth Refresh @Router /api/v1/films/ [get]

func FetchFilmsFilter

func FetchFilmsFilter(c *gin.Context)

FetchFilmsFilter godoc @Summary Filter films @Description Filter films by name or/and genre, year, page @Tags api @Accept json @Produce json @Param name query string false "Film name" @Param year query string false "Film year production" @Param genre query string false "Film genre" @Param page query string false "Film page of the results" @Success 200 {array} tmdb.Film "Return slice of films with filter" @Failure 400 "{"error": "no films matches"}" @Security ApiKeyAuth Token, Refresh @Router /api/v1/films/filter [get]

func FetchPage

func FetchPage(c *gin.Context)

FetchPage godoc @Summary Fetch by page films @Description Filter films page @Tags api @Accept json @Produce json @Param ID path string true "Film page of the results" @Success 200 {array} tmdb.Film "Return slice of films with filter" @Failure 400 "{"error": "no films matches"/"bad page request"/ "invalid page number"}" @Security ApiKeyAuth Token, Refresh @securityDefinitions.ApiKeyAuth[Refresh,Token] @Router /api/v1/films/page/{ID} [get]

func FetchSingleFilm

func FetchSingleFilm(c *gin.Context)

FetchSingleFilm godoc @Summary Get single film by ID @Description Get single film by ID @Tags api @Accept json @Produce json @Param ID path int true "Get single film by ID" @Success 200 {object} tmdb.Film "Return single film by ID" @Failure 400 "{"error": "film ID doesn't exist in database: ____"}" string @Security ApiKeyAuth Token @Security ApiKeyAuth Refresh @Router /api/v1/films/film/{ID} [get]

func InsertTokensToCookie

func InsertTokensToCookie(c *gin.Context, accessToken, refreshToken string, accessTokenExp, refreshTokenExp time.Time)

func RespondWithError

func RespondWithError(c *gin.Context, code int, message interface{})

func RespondWithSuccess

func RespondWithSuccess(c *gin.Context, code int, message interface{})

func SignIn

func SignIn(c *gin.Context)

SignIn godoc @Summary Sign In @Description Sign In into server, add cookies @Tags users @Accept json @Produce json @Param Login body database.User false "Add login and password" @Success 200 "{"success":"Sign In"}" @Header 200 {string} Token "JWT Token" @Header 200 {string} Refresh "JWT refresh Token" @Failure 406 "{"error":"this user isn't in the database."}" @Router /users/auth/signin/ [post]

func SignOut

func SignOut(c *gin.Context)

SignOut godoc @Summary Sign Out @Description Sign Out from server, delete cookies @Tags users @Accept json @Produce json @Success 200 "{"success":"Sign Out"}" @Failure 406 "{"error":"http: named cookie not present"/"wrong refresh token"}" @Router /users/auth/signout/ [get]

func SignUp

func SignUp(c *gin.Context)

SignUp godoc @Summary Sign Up @Description Sign Up into server, add cookies @Tags users @Accept json @Produce json @Param Login body database.User false "Add login and password" @Header 200 {string} Token "JWT Token" @Header 200 {string} Refresh "JWT refresh Token" @Success 200 "{"success":"Sign Up"}" @Failure 406 "{"error":"this user is already exist in database."}" @Router /users/auth/signup/ [post]

func UpdateFilm

func UpdateFilm(c *gin.Context)

UpdateFilm godoc @Summary Update film by json body @Description Update film by ID @Tags api @Accept json @Produce json @Param Film body tmdb.Film true "Update the film by fields" @Description "Only with user role = 'admin'" @Success 200 "{"ok": "film successful updated with that ID ___"}" @Failure 400 "{"error": "film isn't exist with that ID ___"}" string @Security ApiKeyAuth Token @Security ApiKeyAuth Refresh @Router /api/v1/films/ [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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