server

package
v0.0.0-...-63cd2eb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeDownloadRequest

func DecodeDownloadRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeDownloadRequest returns a decoder for requests sent to the updown download endpoint.

func DecodeUploadRequest

func DecodeUploadRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeUploadRequest returns a decoder for requests sent to the updown upload endpoint.

func DownloadUpdownPath

func DownloadUpdownPath(filename string) string

DownloadUpdownPath returns the URL path to the updown service download HTTP endpoint.

func EncodeDownloadError

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

EncodeDownloadError returns an encoder for errors returned by the download updown endpoint.

func EncodeDownloadResponse

func EncodeDownloadResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeDownloadResponse returns an encoder for responses returned by the updown download endpoint.

func EncodeUploadError

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

EncodeUploadError returns an encoder for errors returned by the upload updown endpoint.

func EncodeUploadResponse

func EncodeUploadResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeUploadResponse returns an encoder for responses returned by the updown upload endpoint.

func Mount

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

Mount configures the mux to serve the updown endpoints.

func MountDownloadHandler

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

MountDownloadHandler configures the mux to serve the "updown" service "download" endpoint.

func MountUploadHandler

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

MountUploadHandler configures the mux to serve the "updown" service "upload" endpoint.

func NewDownloadHandler

func NewDownloadHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewDownloadHandler creates a HTTP handler which loads the HTTP request and calls the "updown" service "download" endpoint.

func NewUploadHandler

func NewUploadHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewUploadHandler creates a HTTP handler which loads the HTTP request and calls the "updown" service "upload" endpoint.

func NewUploadPayload

func NewUploadPayload(dir string, contentType string) *updown.UploadPayload

NewUploadPayload builds a updown service upload endpoint payload.

func UploadUpdownPath

func UploadUpdownPath(dir string) string

UploadUpdownPath returns the URL path to the updown service upload HTTP endpoint.

Types

type DownloadInternalErrorResponseBody

type DownloadInternalErrorResponseBody 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"`
}

DownloadInternalErrorResponseBody is the type of the "updown" service "download" endpoint HTTP response body for the "internal_error" error.

func NewDownloadInternalErrorResponseBody

func NewDownloadInternalErrorResponseBody(res *goa.ServiceError) *DownloadInternalErrorResponseBody

NewDownloadInternalErrorResponseBody builds the HTTP response body from the result of the "download" endpoint of the "updown" service.

type DownloadInvalidFilePathResponseBody

type DownloadInvalidFilePathResponseBody 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"`
}

DownloadInvalidFilePathResponseBody is the type of the "updown" service "download" endpoint HTTP response body for the "invalid_file_path" error.

func NewDownloadInvalidFilePathResponseBody

func NewDownloadInvalidFilePathResponseBody(res *goa.ServiceError) *DownloadInvalidFilePathResponseBody

NewDownloadInvalidFilePathResponseBody builds the HTTP response body from the result of the "download" endpoint of the "updown" service.

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 Server

type Server struct {
	Mounts   []*MountPoint
	Upload   http.Handler
	Download http.Handler
}

Server lists the updown service endpoint HTTP handlers.

func New

func New(
	e *updown.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(ctx context.Context, err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the updown 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) MethodNames

func (s *Server) MethodNames() []string

MethodNames returns the methods served.

func (*Server) Mount

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the updown endpoints.

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 UploadInternalErrorResponseBody

type UploadInternalErrorResponseBody 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"`
}

UploadInternalErrorResponseBody is the type of the "updown" service "upload" endpoint HTTP response body for the "internal_error" error.

func NewUploadInternalErrorResponseBody

func NewUploadInternalErrorResponseBody(res *goa.ServiceError) *UploadInternalErrorResponseBody

NewUploadInternalErrorResponseBody builds the HTTP response body from the result of the "upload" endpoint of the "updown" service.

type UploadInvalidMediaTypeResponseBody

type UploadInvalidMediaTypeResponseBody 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"`
}

UploadInvalidMediaTypeResponseBody is the type of the "updown" service "upload" endpoint HTTP response body for the "invalid_media_type" error.

func NewUploadInvalidMediaTypeResponseBody

func NewUploadInvalidMediaTypeResponseBody(res *goa.ServiceError) *UploadInvalidMediaTypeResponseBody

NewUploadInvalidMediaTypeResponseBody builds the HTTP response body from the result of the "upload" endpoint of the "updown" service.

type UploadInvalidMultipartRequestResponseBody

type UploadInvalidMultipartRequestResponseBody 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"`
}

UploadInvalidMultipartRequestResponseBody is the type of the "updown" service "upload" endpoint HTTP response body for the "invalid_multipart_request" error.

func NewUploadInvalidMultipartRequestResponseBody

func NewUploadInvalidMultipartRequestResponseBody(res *goa.ServiceError) *UploadInvalidMultipartRequestResponseBody

NewUploadInvalidMultipartRequestResponseBody builds the HTTP response body from the result of the "upload" endpoint of the "updown" service.

Jump to

Keyboard shortcuts

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