api

package
v0.0.0-...-2718fd8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2014 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeCDNHandler

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

FakeCDNHandler will return the image stream for the hippo. TODO: this is just temporal until we have a proper CDN.

func GetHandler

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

GetHandler is a JSON endpoint that returns ALL the hippos paginated. It can be filtered with ?verified=true or ?verified=false

func GetHippoHandler

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

GetHippoHandler is going to find a hippo by Mongo ID and return it in JSON format. In case that the hippo is not found, we are going to return a 404.

func PostHandler

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

PostHandler is able to receive hippo image and store them in our backend.

func RandomHippoHandler

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

RandomHippoHandler will return a JSON response with a verified hippo

func VoteHippoHandler

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

VoteHippoHandler is going to increment the number of votes for a cerating hippo

Types

type PaginatedResponse

type PaginatedResponse struct {
	Meta struct {
		HasPrevious bool `json:"hasPrevious"`
		HasNext     bool `json:"hasNext"`
		Pages       int  `json:"pages"`
	} `json:"meta"`
	Hippos []*mongo.Hippo `json:"hippos"`
}

PaginatedResponse is the struct used for paginated JSON responses

Jump to

Keyboard shortcuts

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