handlers

package
v0.0.0-...-6aa4138 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSeries

func CreateSeries(w http.ResponseWriter, r *http.Request, database *sql.DB, appDirectory *string)

Uploads a series, its episodes, and its cover to the database and stores them within the storage folder.

Specifications:

  • Method : POST
  • Endpoint : /series
  • Auth? : False

HTTP request multipart form:

  • video-files : REQUIRED. Uploaded video files.
  • name : REQUIRED. Name of the soon-to-be uploaded series.
  • description : REQUIRED. Description of the series.

HTTP response JSON contents:

  • status_code : HTTP status code.
  • message : If error, Message detailing the error.
  • data : Series id, title

func CreateSplash

func CreateSplash(w http.ResponseWriter, r *http.Request)

Uploads a new splash art to a series.

func CreateVideo

func CreateVideo(w http.ResponseWriter, r *http.Request, database *sql.DB, appDirectory *string)

Allows the client to upload a video to the file system and store its information to the database.

Specifications:

  • Method : POST
  • Endpoint : /videos
  • Auth? : False

HTTP form data:

  • series-id : REQUIRED. Series id.
  • title : REQUIRED. Video title.

HTTP response JSON contents:

  • status_code : HTTP status code.
  • message : If error, message detailing the error.

func DeleteSeries

func DeleteSeries(w http.ResponseWriter, r *http.Request, database *sql.DB, appDirectory *string)

Deletes a series, its episodes, and its cover from the database and storage folders.

Specifications:

  • Method : DELETE
  • Endpoint : /series/{id}
  • Auth? : False

HTTP request path parameters:

  • id : REQUIRED. UUID of the series.

HTTP response JSON contents:

  • status_code : HTTP status code.
  • message : If error, Message detailing the error.

func DeleteSplash

func DeleteSplash(w http.ResponseWriter, r *http.Request)

Delete an existing series's splash art.

func DeleteVideo

func DeleteVideo(w http.ResponseWriter, r *http.Request, database *sql.DB, appDirectory *string)

Deletes a video from the database and file system.

Specifications:

  • Method : DELETE
  • Endpoint : /videos/{id}
  • Auth? : False

HTTP request path parameters:

  • id : REQUIRED. UUID of the video.

func ReadCover

func ReadCover(w http.ResponseWriter, r *http.Request, database *sql.DB, appDirectory *string)

Returns the covers stored in the database and file-system. If none are present, return a placeholder cover.

Specifications:

  • Method : GET
  • Endpoint : /series/{id}/cover
  • Auth? : False

HTTP request path parameters:

  • id : REQUIRED. UUID of the series.

func ReadSeries

func ReadSeries(w http.ResponseWriter, r *http.Request, database *sql.DB)

Gets and returns an array of series stored in the database.

Specifications:

  • Method : GET
  • Endpoint : /series/{id}
  • Auth? : False

HTTP request query parameters:

  • series_id : OPTIONAL. UUID of the series.

HTTP response JSON contents:

  • status_code : HTTP status code.
  • message : If error, Message detailing the error.
  • data : Series contents, each returning id, episode count, title, description.

func ReadSeriesEpisodes

func ReadSeriesEpisodes(w http.ResponseWriter, r *http.Request, database *sql.DB)

Gets and returns an array of episodes of a series stored in the database.

Specifications:

  • Method : GET
  • Endpoint : /series/{id}/episodes
  • Auth? : False

HTTP request path parameters:

  • id : REQUIRED. UUID of the series.

HTTP response JSON contents:

  • status_code : HTTP status code.
  • message : If error, Message detailing the error.
  • data : Series episodes, each returning id, episode.

func ReadSplash

func ReadSplash(w http.ResponseWriter, r *http.Request)

Return an existing series's splash art.

func ReadVideo

func ReadVideo(w http.ResponseWriter, r *http.Request, database *sql.DB)

Allows the client to retrieve the details of a specific uploaded video via passed in id.

Specifications:

  • Method : GET
  • Endpoint : /videos/{id}
  • Auth? : False

HTTP request path parameters:

  • id : REQUIRED. UUID of the video.

HTTP response JSON contents:

  • status_code : HTTP status code.
  • message : If error, message detailing the error.
  • data : id, series_id, title (if empty, json data is empty)

func StreamHandler

func StreamHandler(w http.ResponseWriter, r *http.Request, database *sql.DB, appDirectory *string)

Returns a video stream to the client using the id.

Specifications:

  • Method : GET
  • Endpoint : /stream/{id}
  • Auth? : False

HTTP request path parameters:

  • id : REQUIRED. UUID of the video.

func UpdateSplash

func UpdateSplash(w http.ResponseWriter, r *http.Request)

Update an existing series's splash art.

Types

This section is empty.

Jump to

Keyboard shortcuts

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