media

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	List(g *gin.Context)
	Find(g *gin.Context)
	Upload(g *gin.Context)
	Update(g *gin.Context)
	Delete(g *gin.Context)
}

Handler defines methods for media items to interact with the server.

type Media

type Media struct {
	*deps.Deps
	// contains filtered or unexported fields
}

Media defines the handler for all media item routes.

func New

func New(d *deps.Deps) *Media

New

Creates a new media handler.

func (*Media) Delete

func (m *Media) Delete(ctx *gin.Context)

Delete

Returns http.StatusOK if the media item was deleted. Returns http.StatusInternalServerError if there was an error updating the media item. Returns http.StatusBadRequest if the the media item wasn't found or no ID was passed.

func (*Media) Find

func (m *Media) Find(ctx *gin.Context)

Find

Returns http.StatusOK if the media items were obtained. Returns http.StatusBadRequest if the ID wasn't passed or failed to convert. Returns http.StatusInternalServerError if there as an error obtaining the media items.

func (*Media) List

func (m *Media) List(ctx *gin.Context)

List

Returns http.StatusOK if there are no media items or success. Returns http.StatusInternalServerError if there was an error getting the media items. Returns http.StatusBadRequest if there was conflict or the request was invalid.

func (*Media) Update

func (m *Media) Update(ctx *gin.Context)

Update

Returns http.StatusOK if the media item was updated successfully. Returns http.StatusBadRequest if the ID wasn't passed or failed to convert. Returns http.StatusInternalServerError if there was an error updating the media item.

func (*Media) Upload

func (m *Media) Upload(ctx *gin.Context)

Upload

If there were no files attached to the body, more than 1 attached to the body or the validation failed.

Returns http.StatusUnauthorized if the user wasn't authenticated. Returns http.StatusOK if the media item was successfully uploaded. Returns http.StatusUnsupportedMediaType if the media item failed to validate. Returns http.StatusInternalServerError if there as an error uploading the media item. Returns http.StatusBadRequest if the file length was incorrect or there were no files.

Jump to

Keyboard shortcuts

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