handler

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2018 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

Get returns an http.HandlerFunc that will serve the user request taking the serializer.Response and errors from the passed RequestProcessFunc

func Login

func Login(oAuth *service.OAuth) http.HandlerFunc

Login handler redirects user to oauth provider

func OAuthCallback

func OAuthCallback(
	oAuth *service.OAuth,
	jwt *service.JWT,
	userRepo *repository.Users,
	uiDomain string,
	logger logrus.FieldLogger,
) http.HandlerFunc

OAuthCallback makes exchange with oauth provider, gets&creates user and redirects to index page with JWT token

Types

type Export

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

Export contains handlers for file export

func NewExport

func NewExport(db *dbutil.DB, exportsPath string) *Export

NewExport creates new Export

func (*Export) Create

func (h *Export) Create(r *http.Request) (*serializer.Response, error)

Create creates new export file and returns a *serializer.Response with the name of new file

func (*Export) Download

func (h *Export) Download(w http.ResponseWriter, r *http.Request)

Download writes requested file to response

func (*Export) List

func (h *Export) List(r *http.Request) (*serializer.Response, error)

List returns a *serializer.Response with a list of files for export

type RequestProcessFunc

type RequestProcessFunc func(*http.Request) (*serializer.Response, error)

RequestProcessFunc is a function that takes an http.Request, and returns a serializer.Response and an error

func GetAssignmentsForUserExperiment

func GetAssignmentsForUserExperiment(repo *repository.Assignments) RequestProcessFunc

GetAssignmentsForUserExperiment returns a function that returns a *serializer.Response with the assignments for the logged user and a passed experiment if these assignments do not already exist, they are created in advance

func GetExperimentDetails

func GetExperimentDetails(repo *repository.Experiments) RequestProcessFunc

GetExperimentDetails returns a function that returns a *serializer.Response with the details of a requested experiment

func GetFeatures

func GetFeatures(repo *repository.Features) RequestProcessFunc

GetFeatures returns a function that returns a *serializer.Response with the list of features for blobId

func GetFilePairAnnotations

func GetFilePairAnnotations(repo *repository.Assignments) RequestProcessFunc

GetFilePairAnnotations returns a function that returns a *serializer.Response with the Annotation results for the given File Pair and Experiment IDs

func GetFilePairDetails

func GetFilePairDetails(repo *repository.FilePairs) RequestProcessFunc

GetFilePairDetails returns a function that returns a *serializer.Response with the details of the requested FilePair

func GetFilePairs

func GetFilePairs(repo *repository.FilePairs) RequestProcessFunc

GetFilePairs returns a function that returns a *serializer.Response with the list of file pairs for the given experiment ID

func Me

func Me(usersRepo *repository.Users) RequestProcessFunc

Me handler returns a function that returns a *serializer.Response with the information about the current user

func SaveAssignment

func SaveAssignment(repo *repository.Assignments) RequestProcessFunc

SaveAssignment returns a function that saves the user answers as passed in the body request

func Version added in v0.0.1

func Version(version string) RequestProcessFunc

Version returns a function that returns a *serializer.Response with a current version of server

type Static added in v0.0.1

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

Static contains handlers to serve static using go-bindata

func NewStatic added in v0.0.1

func NewStatic(dir, serverURL string) *Static

NewStatic creates new Static

func (*Static) ServeHTTP added in v0.0.1

func (s *Static) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves any static file from static directory or fallbacks on index.hml

func (*Static) ServeIndexHTML added in v0.0.1

func (s *Static) ServeIndexHTML(initialState interface{}) http.HandlerFunc

ServeIndexHTML serves index.html file with initial state

Jump to

Keyboard shortcuts

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