resources

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQueryParams

func GetQueryParams(queryParams url.Values) (filter string, page int64, pageSize int64)

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, msg string)

func RespondWithJson

func RespondWithJson(w http.ResponseWriter, code int, payload interface{})

Types

type CategoryRouter

type CategoryRouter struct {
	// contains filtered or unexported fields
}

func ProvideCategoryRouter

func ProvideCategoryRouter(s services.CategoryService) CategoryRouter

func (*CategoryRouter) CreateCategory

func (cs *CategoryRouter) CreateCategory(w http.ResponseWriter, r *http.Request)

CreateCategory godoc @Summary Create a new Category @Description Create a new Category @Tags categories @Accept json @Produce json @Param category body dto.InsertCategory true "New category" @Security ApiKeyAuth @Success 201 {object} models.Category @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 500 {object} ErrorMessage @Router /categories [post]

func (*CategoryRouter) DeleteCategoryByID

func (cs *CategoryRouter) DeleteCategoryByID(w http.ResponseWriter, r *http.Request)

DeleteCategoryByID godoc @Summary Delete a category by ID @Description Delete a category by ID @Tags categories @Accept json @Produce json @Param id path int true "Category ID" @Security ApiKeyAuth @Success 200 @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /categories [delete]

func (*CategoryRouter) GetAllCategories

func (cs *CategoryRouter) GetAllCategories(w http.ResponseWriter, r *http.Request)

GetAllCategories godoc @Summary Get details of all categories @Description Get details of all categories @Tags categories @Accept json @Produce json @Param search query string false "Search by name" @Param page query int false "Page number" @Param pageSize query int false "Page size" @Security ApiKeyAuth @Success 200 {array} models.Category @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /categories [get]

func (*CategoryRouter) GetAllVideosByCategoryID

func (cs *CategoryRouter) GetAllVideosByCategoryID(w http.ResponseWriter, r *http.Request)

GetAllVideosByCategoryID godoc @Summary Get all videos by category ID @Description Get all videos by category ID @Tags videos @Accept json @Produce json @Param id path int true "Category ID" @Security ApiKeyAuth @Success 200 {array} models.Video @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /categories/{id}/videos [get]

func (*CategoryRouter) GetCategoryByID

func (cs *CategoryRouter) GetCategoryByID(w http.ResponseWriter, r *http.Request)

GetCategoryByID godoc @Summary Get details of a category by ID @Description Get details of a category by ID @Tags categories @Accept json @Produce json @Param id path int true "Category ID" @Security ApiKeyAuth @Success 200 {object} models.Category @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /categories/{id} [get]

func (*CategoryRouter) UpdateCategoryByID

func (cs *CategoryRouter) UpdateCategoryByID(w http.ResponseWriter, r *http.Request)

UpdateCategoryByID godoc @Summary Update a category by ID @Description Update a category by ID @Tags categories @Accept json @Produce json @Param id path int true "Category ID" @Param category body dto.InsertCategory true "New category values" @Security ApiKeyAuth @Success 200 {object} models.Category @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /categories [put]

type ErrorMessage added in v1.0.3

type ErrorMessage struct {
	Error string `json:"error" example:"example error"`
}

ErrorMessage represents a error model

type VideoRouter

type VideoRouter struct {
	// contains filtered or unexported fields
}

func ProvideVideoRouter

func ProvideVideoRouter(s services.VideoService) VideoRouter

func (*VideoRouter) CreateVideo

func (vr *VideoRouter) CreateVideo(w http.ResponseWriter, r *http.Request)

CreateVideo godoc @Summary Create a new Video @Description Create a new Video @Tags videos @Accept json @Produce json @Param video body dto.InsertVideo true "New video" @Security ApiKeyAuth @Success 201 {object} models.Video @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 500 {object} ErrorMessage @Router /videos [post]

func (*VideoRouter) DeleteVideoByID

func (vr *VideoRouter) DeleteVideoByID(w http.ResponseWriter, r *http.Request)

DeleteVideoByID godoc @Summary Delete a video by ID @Description Delete a video by ID @Tags videos @Accept json @Produce json @Param id path int true "Video ID" @Security ApiKeyAuth @Success 200 @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /videos [delete]

func (*VideoRouter) GetAllFreeVideos

func (vr *VideoRouter) GetAllFreeVideos(w http.ResponseWriter, r *http.Request)

GetAllFreeVideos godoc @Summary Get all free videos @Description Get all free videos @Tags videos @Accept json @Produce json @Success 200 {array} models.Video @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /videos/free [get]

func (*VideoRouter) GetAllVideos

func (vr *VideoRouter) GetAllVideos(w http.ResponseWriter, r *http.Request)

GetAllVideos godoc @Summary Get details of all videos @Description Get details of all videos @Tags videos @Accept json @Produce json @Param search query string false "Search by name" @Param page query int false "Page number" @Param pageSize query int false "Page size" @Security ApiKeyAuth @Success 200 {array} models.Video @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /videos [get]

func (*VideoRouter) GetVideoByID

func (vr *VideoRouter) GetVideoByID(w http.ResponseWriter, r *http.Request)

GetVideoByID godoc @Summary Get details of a video by ID @Description Get details of a video by ID @Tags videos @Accept json @Produce json @Param id path int true "Video ID" @Security ApiKeyAuth @Success 200 {object} models.Video @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /videos/{id} [get]

func (*VideoRouter) UpdateVideoByID

func (vr *VideoRouter) UpdateVideoByID(w http.ResponseWriter, r *http.Request)

UpdateVideoByID godoc @Summary Update a video by ID @Description Update a video by ID @Tags videos @Accept json @Produce json @Param id path int true "Video ID" @Param category body dto.InsertVideo true "New video values" @Security ApiKeyAuth @Success 200 {object} models.Video @Failure 400 {object} ErrorMessage @Failure 401 {string} string @Failure 404 @Failure 500 {object} ErrorMessage @Router /videos [put]

Jump to

Keyboard shortcuts

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