server

package
v0.0.0-...-d47a9da Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeProjectRequest

func DecodeProjectRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeProjectRequest returns a decoder for requests sent to the activity project endpoint.

func DecodeStationRequest

func DecodeStationRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeStationRequest returns a decoder for requests sent to the activity station endpoint.

func EncodeProjectError

func EncodeProjectError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeProjectError returns an encoder for errors returned by the project activity endpoint.

func EncodeProjectResponse

func EncodeProjectResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeProjectResponse returns an encoder for responses returned by the activity project endpoint.

func EncodeStationError

func EncodeStationError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeStationError returns an encoder for errors returned by the station activity endpoint.

func EncodeStationResponse

func EncodeStationResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeStationResponse returns an encoder for responses returned by the activity station endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the activity endpoints.

func MountCORSHandler

func MountCORSHandler(mux goahttp.Muxer, h http.Handler)

MountCORSHandler configures the mux to serve the CORS endpoints for the service activity.

func MountProjectHandler

func MountProjectHandler(mux goahttp.Muxer, h http.Handler)

MountProjectHandler configures the mux to serve the "activity" service "project" endpoint.

func MountStationHandler

func MountStationHandler(mux goahttp.Muxer, h http.Handler)

MountStationHandler configures the mux to serve the "activity" service "station" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

NewCORSHandler creates a HTTP handler which returns a simple 200 response.

func NewProjectHandler

func NewProjectHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewProjectHandler creates a HTTP handler which loads the HTTP request and calls the "activity" service "project" endpoint.

func NewProjectPayload

func NewProjectPayload(id int64, page *int64, auth *string) *activity.ProjectPayload

NewProjectPayload builds a activity service project endpoint payload.

func NewStationHandler

func NewStationHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewStationHandler creates a HTTP handler which loads the HTTP request and calls the "activity" service "station" endpoint.

func NewStationPayload

func NewStationPayload(id int64, page *int64, auth *string) *activity.StationPayload

NewStationPayload builds a activity service station endpoint payload.

func ProjectActivityPath

func ProjectActivityPath(id int64) string

ProjectActivityPath returns the URL path to the activity service project HTTP endpoint.

func StationActivityPath

func StationActivityPath(id int64) string

StationActivityPath returns the URL path to the activity service station HTTP endpoint.

Types

type ActivityEntryResponseBody

type ActivityEntryResponseBody struct {
	ID        int64                       `form:"id" json:"id" xml:"id"`
	Key       string                      `form:"key" json:"key" xml:"key"`
	Project   *ProjectSummaryResponseBody `form:"project" json:"project" xml:"project"`
	Station   *StationSummaryResponseBody `form:"station" json:"station" xml:"station"`
	CreatedAt int64                       `form:"created_at" json:"created_at" xml:"created_at"`
	Type      string                      `form:"type" json:"type" xml:"type"`
	Meta      interface{}                 `form:"meta" json:"meta" xml:"meta"`
}

ActivityEntryResponseBody is used to define fields on response body types.

type ActivityEntryResponseBodyCollection

type ActivityEntryResponseBodyCollection []*ActivityEntryResponseBody

ActivityEntryResponseBodyCollection is used to define fields on response body types.

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type ProjectBadRequestResponseBody

type ProjectBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ProjectBadRequestResponseBody is the type of the "activity" service "project" endpoint HTTP response body for the "bad-request" error.

func NewProjectBadRequestResponseBody

func NewProjectBadRequestResponseBody(res *goa.ServiceError) *ProjectBadRequestResponseBody

NewProjectBadRequestResponseBody builds the HTTP response body from the result of the "project" endpoint of the "activity" service.

type ProjectForbiddenResponseBody

type ProjectForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ProjectForbiddenResponseBody is the type of the "activity" service "project" endpoint HTTP response body for the "forbidden" error.

func NewProjectForbiddenResponseBody

func NewProjectForbiddenResponseBody(res *goa.ServiceError) *ProjectForbiddenResponseBody

NewProjectForbiddenResponseBody builds the HTTP response body from the result of the "project" endpoint of the "activity" service.

type ProjectNotFoundResponseBody

type ProjectNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ProjectNotFoundResponseBody is the type of the "activity" service "project" endpoint HTTP response body for the "not-found" error.

func NewProjectNotFoundResponseBody

func NewProjectNotFoundResponseBody(res *goa.ServiceError) *ProjectNotFoundResponseBody

NewProjectNotFoundResponseBody builds the HTTP response body from the result of the "project" endpoint of the "activity" service.

type ProjectResponseBody

type ProjectResponseBody struct {
	Activities ActivityEntryResponseBodyCollection `form:"activities" json:"activities" xml:"activities"`
	Total      int32                               `form:"total" json:"total" xml:"total"`
	Page       int32                               `form:"page" json:"page" xml:"page"`
}

ProjectResponseBody is the type of the "activity" service "project" endpoint HTTP response body.

func NewProjectResponseBody

func NewProjectResponseBody(res *activityviews.ProjectActivityPageView) *ProjectResponseBody

NewProjectResponseBody builds the HTTP response body from the result of the "project" endpoint of the "activity" service.

type ProjectSummaryResponseBody

type ProjectSummaryResponseBody struct {
	ID   int64  `form:"id" json:"id" xml:"id"`
	Name string `form:"name" json:"name" xml:"name"`
}

ProjectSummaryResponseBody is used to define fields on response body types.

type ProjectUnauthorizedResponseBody

type ProjectUnauthorizedResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ProjectUnauthorizedResponseBody is the type of the "activity" service "project" endpoint HTTP response body for the "unauthorized" error.

func NewProjectUnauthorizedResponseBody

func NewProjectUnauthorizedResponseBody(res *goa.ServiceError) *ProjectUnauthorizedResponseBody

NewProjectUnauthorizedResponseBody builds the HTTP response body from the result of the "project" endpoint of the "activity" service.

type Server

type Server struct {
	Mounts  []*MountPoint
	Station http.Handler
	Project http.Handler
	CORS    http.Handler
}

Server lists the activity service endpoint HTTP handlers.

func New

func New(
	e *activity.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the activity service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type StationBadRequestResponseBody

type StationBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

StationBadRequestResponseBody is the type of the "activity" service "station" endpoint HTTP response body for the "bad-request" error.

func NewStationBadRequestResponseBody

func NewStationBadRequestResponseBody(res *goa.ServiceError) *StationBadRequestResponseBody

NewStationBadRequestResponseBody builds the HTTP response body from the result of the "station" endpoint of the "activity" service.

type StationForbiddenResponseBody

type StationForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

StationForbiddenResponseBody is the type of the "activity" service "station" endpoint HTTP response body for the "forbidden" error.

func NewStationForbiddenResponseBody

func NewStationForbiddenResponseBody(res *goa.ServiceError) *StationForbiddenResponseBody

NewStationForbiddenResponseBody builds the HTTP response body from the result of the "station" endpoint of the "activity" service.

type StationNotFoundResponseBody

type StationNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

StationNotFoundResponseBody is the type of the "activity" service "station" endpoint HTTP response body for the "not-found" error.

func NewStationNotFoundResponseBody

func NewStationNotFoundResponseBody(res *goa.ServiceError) *StationNotFoundResponseBody

NewStationNotFoundResponseBody builds the HTTP response body from the result of the "station" endpoint of the "activity" service.

type StationResponseBody

type StationResponseBody struct {
	Activities ActivityEntryResponseBodyCollection `form:"activities" json:"activities" xml:"activities"`
	Total      int32                               `form:"total" json:"total" xml:"total"`
	Page       int32                               `form:"page" json:"page" xml:"page"`
}

StationResponseBody is the type of the "activity" service "station" endpoint HTTP response body.

func NewStationResponseBody

func NewStationResponseBody(res *activityviews.StationActivityPageView) *StationResponseBody

NewStationResponseBody builds the HTTP response body from the result of the "station" endpoint of the "activity" service.

type StationSummaryResponseBody

type StationSummaryResponseBody struct {
	ID   int64  `form:"id" json:"id" xml:"id"`
	Name string `form:"name" json:"name" xml:"name"`
}

StationSummaryResponseBody is used to define fields on response body types.

type StationUnauthorizedResponseBody

type StationUnauthorizedResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

StationUnauthorizedResponseBody is the type of the "activity" service "station" endpoint HTTP response body for the "unauthorized" error.

func NewStationUnauthorizedResponseBody

func NewStationUnauthorizedResponseBody(res *goa.ServiceError) *StationUnauthorizedResponseBody

NewStationUnauthorizedResponseBody builds the HTTP response body from the result of the "station" endpoint of the "activity" service.

Jump to

Keyboard shortcuts

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