server

package
v0.0.0-...-5a969d9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeDeleteRequest

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

DecodeDeleteRequest returns a decoder for requests sent to the tus delete endpoint.

func DecodeHeadRequest

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

DecodeHeadRequest returns a decoder for requests sent to the tus head endpoint.

func DecodePatchRequest

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

DecodePatchRequest returns a decoder for requests sent to the tus patch endpoint.

func DecodePostRequest

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

DecodePostRequest returns a decoder for requests sent to the tus post endpoint.

func DeleteTusPath

func DeleteTusPath(id string) string

DeleteTusPath returns the URL path to the tus service delete HTTP endpoint.

func EncodeDeleteError

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

EncodeDeleteError returns an encoder for errors returned by the delete tus endpoint.

func EncodeDeleteResponse

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

EncodeDeleteResponse returns an encoder for responses returned by the tus delete endpoint.

func EncodeHeadError

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

EncodeHeadError returns an encoder for errors returned by the head tus endpoint.

func EncodeHeadResponse

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

EncodeHeadResponse returns an encoder for responses returned by the tus head endpoint.

func EncodeOptionsError

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

EncodeOptionsError returns an encoder for errors returned by the options tus endpoint.

func EncodeOptionsResponse

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

EncodeOptionsResponse returns an encoder for responses returned by the tus options endpoint.

func EncodePatchError

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

EncodePatchError returns an encoder for errors returned by the patch tus endpoint.

func EncodePatchResponse

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

EncodePatchResponse returns an encoder for responses returned by the tus patch endpoint.

func EncodePostError

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

EncodePostError returns an encoder for errors returned by the post tus endpoint.

func EncodePostResponse

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

EncodePostResponse returns an encoder for responses returned by the tus post endpoint.

func HeadTusPath

func HeadTusPath(id string) string

HeadTusPath returns the URL path to the tus service head HTTP endpoint.

func Mount

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

Mount configures the mux to serve the tus endpoints.

func MountDeleteHandler

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

MountDeleteHandler configures the mux to serve the "tus" service "delete" endpoint.

func MountHeadHandler

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

MountHeadHandler configures the mux to serve the "tus" service "head" endpoint.

func MountOptionsHandler

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

MountOptionsHandler configures the mux to serve the "tus" service "options" endpoint.

func MountPatchHandler

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

MountPatchHandler configures the mux to serve the "tus" service "patch" endpoint.

func MountPostHandler

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

MountPostHandler configures the mux to serve the "tus" service "post" endpoint.

func NewDeleteHandler

func NewDeleteHandler(
	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

NewDeleteHandler creates a HTTP handler which loads the HTTP request and calls the "tus" service "delete" endpoint.

func NewDeletePayload

func NewDeletePayload(id string, tusResumable string) *tus.DeletePayload

NewDeletePayload builds a tus service delete endpoint payload.

func NewHeadHandler

func NewHeadHandler(
	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

NewHeadHandler creates a HTTP handler which loads the HTTP request and calls the "tus" service "head" endpoint.

func NewHeadPayload

func NewHeadPayload(id string, tusResumable string) *tus.HeadPayload

NewHeadPayload builds a tus service head endpoint payload.

func NewOptionsHandler

func NewOptionsHandler(
	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

NewOptionsHandler creates a HTTP handler which loads the HTTP request and calls the "tus" service "options" endpoint.

func NewPatchHandler

func NewPatchHandler(
	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

NewPatchHandler creates a HTTP handler which loads the HTTP request and calls the "tus" service "patch" endpoint.

func NewPatchPayload

func NewPatchPayload(id string, tusResumable string, uploadOffset int64, uploadChecksum *string) *tus.PatchPayload

NewPatchPayload builds a tus service patch endpoint payload.

func NewPostHandler

func NewPostHandler(
	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

NewPostHandler creates a HTTP handler which loads the HTTP request and calls the "tus" service "post" endpoint.

func NewPostPayload

func NewPostPayload(tusResumable string, uploadLength *int64, uploadDeferLength *int, uploadChecksum *string, uploadMetadata *string, tusMaxSize *int64) *tus.PostPayload

NewPostPayload builds a tus service post endpoint payload.

func OptionsTusPath

func OptionsTusPath() string

OptionsTusPath returns the URL path to the tus service options HTTP endpoint.

func PatchTusPath

func PatchTusPath(id string) string

PatchTusPath returns the URL path to the tus service patch HTTP endpoint.

func PostTusPath

func PostTusPath() string

PostTusPath returns the URL path to the tus service post HTTP endpoint.

Types

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
	Head    http.Handler
	Patch   http.Handler
	Options http.Handler
	Post    http.Handler
	Delete  http.Handler
}

Server lists the tus service endpoint HTTP handlers.

func New

func New(
	e *tus.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 tus 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 tus 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.

Jump to

Keyboard shortcuts

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