api

package
v0.0.0-...-919b350 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API handles Face Detect requests, register routes and creates the HTTP server.

func NewAPI

func NewAPI(addr string, d download.Downloader, fd facedetect.FaceDetector) *API

NewAPI creates a HTTP API responsible for serving face detection requests. Call Serve afterwards and pass a parent context and the return value of Routes as parameters.

func (*API) Routes

func (a *API) Routes() http.Handler

Routes returns a http.Handler with routes configured.

func (*API) Serve

func (a *API) Serve(ctx context.Context, handler http.Handler) error

Serve starts a HTTP server and serves provided handler. To invoke face detection endpoint, perform a GET request on /v1/face-detect?={image_url}.

type Error

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

Error is reserved for future use.

type Faces

type Faces struct {
	Faces []facedetect.Face `json:"Faces"`
}

Faces structure is response sent to client. It encapsulates response from face detector.

Jump to

Keyboard shortcuts

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