handlers

package
v0.0.0-...-741e748 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelloWorld

func HelloWorld() http.HandlerFunc

Response: String

URL Parameters: None

Description: "Returns `Hello, World!` when called. This route is for testing purposes only."

Types

type DBHandler

type DBHandler interface {
	// contains filtered or unexported methods
}

type Handler

type Handler interface {
	FetchAssetDetailsByURL() http.HandlerFunc
	FetchAssetDetailsByID() http.HandlerFunc
	CreateAsset(FileSize int64) http.HandlerFunc
	GetAsset() http.HandlerFunc
}

func NewServiceHandler

func NewServiceHandler(store *db.Store, cache cache.PostCache) Handler

type Service

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

func (*Service) CreateAsset

func (s *Service) CreateAsset(FileSize int64) http.HandlerFunc

Response: JSON

URL Parameters: None

Request Body:

  • Name: name Type: String Description: "Name under which to store the asset in the CDN."
  • Name: url_path Type: String Description: "The URL Path under which to store the asset in the CDN. If none is provided, a random path is selected."

Description: "Create Asset creates an asset with a given file, uploaded under the `data` parameter as a form file. If it succeeds, it returns a 201 Created Status. If the FileSize is too large, a 413 error is raised. If the file is not provided, a 400 error is raised."

func (*Service) FetchAssetDetailsByID

func (s *Service) FetchAssetDetailsByID() http.HandlerFunc

Response: JSON

URL Parameters: id (Integer)

Description: "Returns details of assets, given the asset ID. If it finds the asset, it returns JSON containing info about the asset. If the asset is not found, a 404 error is raised. If the ID provided is not an integer, a 400 error is raised."

func (*Service) FetchAssetDetailsByURL

func (s *Service) FetchAssetDetailsByURL() http.HandlerFunc

Response: JSON

URL Parameters: path (String)

Description: "Returns details of assets, given the path to the asset. If the asset is not found, a 404 error is raised"

func (*Service) GetAsset

func (s *Service) GetAsset() http.HandlerFunc

Response: FileType | JSON

URL Parameters: AssetURL (string)

Description: "Return an asset, given the asset url. If the asset is not found, a 404 error is returned. If it is found, the asset is returned as per it's file type."

Jump to

Keyboard shortcuts

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