api

package
v0.0.0-...-d437fa4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2014 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package api provides the RESTful API of the wavepipe media server.

Index

Constants

View Source
const APIDocumentation = "https://github.com/mdlayher/wavepipe/blob/master/API.md"

APIDocumentation provides a link to the current API documentation

View Source
const APIVersion = "v0"

APIVersion is the current version of the API

Variables

This section is empty.

Functions

func APIInfo

func APIInfo(r render.Render, params martini.Params)

APIInfo returns information about the API

func GetAlbums

func GetAlbums(r render.Render, params martini.Params)

GetAlbums retrieves one or more albums from wavepipe, and returns a HTTP status and JSON

func GetArtists

func GetArtists(r render.Render, req *http.Request, params martini.Params)

GetArtists retrieves one or more artists from wavepipe, and returns a HTTP status and JSON

func GetFolders

func GetFolders(r render.Render, params martini.Params)

GetFolders retrieves one or more folders from wavepipe, and returns a HTTP status and JSON

func GetLogin

func GetLogin(r render.Render, req *http.Request, sessionUser *data.User, params martini.Params)

GetLogin creates a new session on the wavepipe API, and returns a HTTP status and JSON

func GetLogout

func GetLogout(r render.Render, req *http.Request, session *data.Session, params martini.Params)

GetLogout destroys a new session from the wavepipe API, and returns a HTTP status and JSON

func GetSongs

func GetSongs(r render.Render, params martini.Params)

GetSongs retrieves one or more songs from wavepipe, and returns a HTTP status and JSON

func GetStream

func GetStream(httpRes http.ResponseWriter, r render.Render, params martini.Params)

GetStream a raw, non-transcoded, media file stream from wavepipe. On success, this API will return a binary stream. On failure, it will return a JSON error.

func GetTranscode

func GetTranscode(httpReq *http.Request, httpRes http.ResponseWriter, r render.Render, params martini.Params)

GetTranscode returns a transcoded media file stream from wavepipe. On success, this API will return a binary transcode. On failure, it will return a JSON error.

Types

type AlbumsResponse

type AlbumsResponse struct {
	Error  *Error       `json:"error"`
	Albums []data.Album `json:"albums"`
	Songs  []data.Song  `json:"songs"`
	// contains filtered or unexported fields
}

AlbumsResponse represents the JSON response for /api/albums

func (*AlbumsResponse) RenderError

func (a *AlbumsResponse) RenderError(code int, message string)

RenderError renders a JSON error message with the specified HTTP status code and message

func (*AlbumsResponse) ServerError

func (a *AlbumsResponse) ServerError()

ServerError is a shortcut to render a HTTP 500 with generic "server error" message

type ArtistsResponse

type ArtistsResponse struct {
	Error   *Error        `json:"error"`
	Artists []data.Artist `json:"artists"`
	Albums  []data.Album  `json:"albums"`
	Songs   []data.Song   `json:"songs"`
	// contains filtered or unexported fields
}

ArtistsResponse represents the JSON response for /api/artists

func (*ArtistsResponse) RenderError

func (a *ArtistsResponse) RenderError(code int, message string)

RenderError renders a JSON error message with the specified HTTP status code and message

func (*ArtistsResponse) ServerError

func (a *ArtistsResponse) ServerError()

ServerError is a shortcut to render a HTTP 500 with generic "server error" message

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Error represents an error produced by the API

type ErrorResponse

type ErrorResponse struct {
	Error *Error `json:"error"`
	// contains filtered or unexported fields
}

ErrorResponse represents the JSON response for endpoints which only return an error

func (*ErrorResponse) RenderError

func (e *ErrorResponse) RenderError(code int, message string)

RenderError renders a JSON error message with the specified HTTP status code and message

func (*ErrorResponse) ServerError

func (e *ErrorResponse) ServerError()

ServerError is a shortcut to render a HTTP 500 with generic "server error" message

type FoldersResponse

type FoldersResponse struct {
	Error      *Error        `json:"error"`
	Folders    []data.Folder `json:"folders"`
	Subfolders []data.Folder `json:"subfolders"`
	Songs      []data.Song   `json:"songs"`
	// contains filtered or unexported fields
}

FoldersResponse represents the JSON response for /api/folders

func (*FoldersResponse) RenderError

func (f *FoldersResponse) RenderError(code int, message string)

RenderError renders a JSON error message with the specified HTTP status code and message

func (*FoldersResponse) ServerError

func (f *FoldersResponse) ServerError()

ServerError is a shortcut to render a HTTP 500 with generic "server error" message

type Information

type Information struct {
	Error         *Error   `json:"error"`
	Version       string   `json:"version"`
	Supported     []string `json:"supported"`
	Documentation string   `json:"documentation"`
	Endpoints     []string `json:"endpoints"`
}

Information represents information about the API

type LoginResponse

type LoginResponse struct {
	Error   *Error        `json:"error"`
	Session *data.Session `json:"session"`
	// contains filtered or unexported fields
}

LoginResponse represents the JSON response for /api/logins

func (*LoginResponse) RenderError

func (l *LoginResponse) RenderError(code int, message string)

RenderError renders a JSON error message with the specified HTTP status code and message

func (*LoginResponse) ServerError

func (l *LoginResponse) ServerError()

ServerError is a shortcut to render a HTTP 500 with generic "server error" message

type SongsResponse

type SongsResponse struct {
	Error *Error      `json:"error"`
	Songs []data.Song `json:"songs"`
	// contains filtered or unexported fields
}

SongsResponse represents the JSON response for /api/songs

func (*SongsResponse) RenderError

func (s *SongsResponse) RenderError(code int, message string)

RenderError renders a JSON error message with the specified HTTP status code and message

func (*SongsResponse) ServerError

func (s *SongsResponse) ServerError()

ServerError is a shortcut to render a HTTP 500 with generic "server error" message

Directories

Path Synopsis
Package auth provides the authentication methods for the API of the wavepipe media server.
Package auth provides the authentication methods for the API of the wavepipe media server.

Jump to

Keyboard shortcuts

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