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 ¶
Media defines the handler for all media item routes.
func (*Media) Delete ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.