handler

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIHandlerFunc added in v0.0.4

func APIHandlerFunc(rp RequestProcessFunc) http.HandlerFunc

APIHandlerFunc 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

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 CreateExperiment added in v0.0.4

func CreateExperiment(repo *repository.Experiments) RequestProcessFunc

CreateExperiment returns a function that saves the experiment as passed in the body request

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, assignmentsRepo *repository.Assignments) RequestProcessFunc

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

func GetExperiments added in v0.0.2

func GetExperiments(repo *repository.Experiments, assignmentsRepo *repository.Assignments) RequestProcessFunc

GetExperiments returns a function that returns a *serializer.Response with the list of existing experiments

func GetFeatures

func GetFeatures(filePairRepo *repository.FilePairs, featuresRepo *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, diff *service.Diff) 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 OAuthCallback

func OAuthCallback(
	oAuth *service.OAuth,
	jwt *service.JWT,
	userRepo *repository.Users,
	logger logrus.FieldLogger,
) RequestProcessFunc

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

func SaveAssignment

func SaveAssignment(repo *repository.Assignments) RequestProcessFunc

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

func UpdateExperiment added in v0.0.4

func UpdateExperiment(repo *repository.Experiments, assignmentsRepo *repository.Assignments) RequestProcessFunc

UpdateExperiment returns a function that updates the experiment as passed in the body request

func UploadFilePairs added in v0.0.4

func UploadFilePairs(db *dbutil.DB) RequestProcessFunc

UploadFilePairs returns a function that imports file pair from import db file to the experiment

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, gaTrackingID 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