server

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFollowRequest

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

DecodeFollowRequest returns a decoder for requests sent to the following follow endpoint.

func DecodeFollowersRequest

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

DecodeFollowersRequest returns a decoder for requests sent to the following followers endpoint.

func DecodeUnfollowRequest

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

DecodeUnfollowRequest returns a decoder for requests sent to the following unfollow endpoint.

func EncodeFollowError

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

EncodeFollowError returns an encoder for errors returned by the follow following endpoint.

func EncodeFollowResponse

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

EncodeFollowResponse returns an encoder for responses returned by the following follow endpoint.

func EncodeFollowersError

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

EncodeFollowersError returns an encoder for errors returned by the followers following endpoint.

func EncodeFollowersResponse

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

EncodeFollowersResponse returns an encoder for responses returned by the following followers endpoint.

func EncodeUnfollowError

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

EncodeUnfollowError returns an encoder for errors returned by the unfollow following endpoint.

func EncodeUnfollowResponse

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

EncodeUnfollowResponse returns an encoder for responses returned by the following unfollow endpoint.

func FollowFollowingPath

func FollowFollowingPath(id int64) string

FollowFollowingPath returns the URL path to the following service follow HTTP endpoint.

func FollowersFollowingPath

func FollowersFollowingPath(id int64) string

FollowersFollowingPath returns the URL path to the following service followers HTTP endpoint.

func Mount

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

Mount configures the mux to serve the following endpoints.

func MountCORSHandler

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

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

func MountFollowHandler

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

MountFollowHandler configures the mux to serve the "following" service "follow" endpoint.

func MountFollowersHandler

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

MountFollowersHandler configures the mux to serve the "following" service "followers" endpoint.

func MountUnfollowHandler

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

MountUnfollowHandler configures the mux to serve the "following" service "unfollow" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

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

func NewFollowHandler

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

NewFollowHandler creates a HTTP handler which loads the HTTP request and calls the "following" service "follow" endpoint.

func NewFollowPayload

func NewFollowPayload(id int64, auth *string) *following.FollowPayload

NewFollowPayload builds a following service follow endpoint payload.

func NewFollowersHandler

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

NewFollowersHandler creates a HTTP handler which loads the HTTP request and calls the "following" service "followers" endpoint.

func NewFollowersPayload

func NewFollowersPayload(id int64, page *int64) *following.FollowersPayload

NewFollowersPayload builds a following service followers endpoint payload.

func NewUnfollowHandler

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

NewUnfollowHandler creates a HTTP handler which loads the HTTP request and calls the "following" service "unfollow" endpoint.

func NewUnfollowPayload

func NewUnfollowPayload(id int64, auth *string) *following.UnfollowPayload

NewUnfollowPayload builds a following service unfollow endpoint payload.

func UnfollowFollowingPath

func UnfollowFollowingPath(id int64) string

UnfollowFollowingPath returns the URL path to the following service unfollow HTTP endpoint.

Types

type AvatarResponseBody

type AvatarResponseBody struct {
	URL string `form:"url" json:"url" xml:"url"`
}

AvatarResponseBody 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 FollowBadRequestResponseBody

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

FollowBadRequestResponseBody is the type of the "following" service "follow" endpoint HTTP response body for the "bad-request" error.

func NewFollowBadRequestResponseBody

func NewFollowBadRequestResponseBody(res *goa.ServiceError) *FollowBadRequestResponseBody

NewFollowBadRequestResponseBody builds the HTTP response body from the result of the "follow" endpoint of the "following" service.

type FollowForbiddenResponseBody

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

FollowForbiddenResponseBody is the type of the "following" service "follow" endpoint HTTP response body for the "forbidden" error.

func NewFollowForbiddenResponseBody

func NewFollowForbiddenResponseBody(res *goa.ServiceError) *FollowForbiddenResponseBody

NewFollowForbiddenResponseBody builds the HTTP response body from the result of the "follow" endpoint of the "following" service.

type FollowNotFoundResponseBody

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

FollowNotFoundResponseBody is the type of the "following" service "follow" endpoint HTTP response body for the "not-found" error.

func NewFollowNotFoundResponseBody

func NewFollowNotFoundResponseBody(res *goa.ServiceError) *FollowNotFoundResponseBody

NewFollowNotFoundResponseBody builds the HTTP response body from the result of the "follow" endpoint of the "following" service.

type FollowUnauthorizedResponseBody

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

FollowUnauthorizedResponseBody is the type of the "following" service "follow" endpoint HTTP response body for the "unauthorized" error.

func NewFollowUnauthorizedResponseBody

func NewFollowUnauthorizedResponseBody(res *goa.ServiceError) *FollowUnauthorizedResponseBody

NewFollowUnauthorizedResponseBody builds the HTTP response body from the result of the "follow" endpoint of the "following" service.

type FollowerResponseBody

type FollowerResponseBody struct {
	ID     int64               `form:"id" json:"id" xml:"id"`
	Name   string              `form:"name" json:"name" xml:"name"`
	Avatar *AvatarResponseBody `form:"avatar,omitempty" json:"avatar,omitempty" xml:"avatar,omitempty"`
}

FollowerResponseBody is used to define fields on response body types.

type FollowerResponseBodyCollection

type FollowerResponseBodyCollection []*FollowerResponseBody

FollowerResponseBodyCollection is used to define fields on response body types.

type FollowersBadRequestResponseBody

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

FollowersBadRequestResponseBody is the type of the "following" service "followers" endpoint HTTP response body for the "bad-request" error.

func NewFollowersBadRequestResponseBody

func NewFollowersBadRequestResponseBody(res *goa.ServiceError) *FollowersBadRequestResponseBody

NewFollowersBadRequestResponseBody builds the HTTP response body from the result of the "followers" endpoint of the "following" service.

type FollowersForbiddenResponseBody

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

FollowersForbiddenResponseBody is the type of the "following" service "followers" endpoint HTTP response body for the "forbidden" error.

func NewFollowersForbiddenResponseBody

func NewFollowersForbiddenResponseBody(res *goa.ServiceError) *FollowersForbiddenResponseBody

NewFollowersForbiddenResponseBody builds the HTTP response body from the result of the "followers" endpoint of the "following" service.

type FollowersNotFoundResponseBody

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

FollowersNotFoundResponseBody is the type of the "following" service "followers" endpoint HTTP response body for the "not-found" error.

func NewFollowersNotFoundResponseBody

func NewFollowersNotFoundResponseBody(res *goa.ServiceError) *FollowersNotFoundResponseBody

NewFollowersNotFoundResponseBody builds the HTTP response body from the result of the "followers" endpoint of the "following" service.

type FollowersResponseBody

type FollowersResponseBody struct {
	Followers FollowerResponseBodyCollection `form:"followers" json:"followers" xml:"followers"`
	Total     int32                          `form:"total" json:"total" xml:"total"`
	Page      int32                          `form:"page" json:"page" xml:"page"`
}

FollowersResponseBody is the type of the "following" service "followers" endpoint HTTP response body.

func NewFollowersResponseBody

func NewFollowersResponseBody(res *followingviews.FollowersPageView) *FollowersResponseBody

NewFollowersResponseBody builds the HTTP response body from the result of the "followers" endpoint of the "following" service.

type FollowersUnauthorizedResponseBody

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

FollowersUnauthorizedResponseBody is the type of the "following" service "followers" endpoint HTTP response body for the "unauthorized" error.

func NewFollowersUnauthorizedResponseBody

func NewFollowersUnauthorizedResponseBody(res *goa.ServiceError) *FollowersUnauthorizedResponseBody

NewFollowersUnauthorizedResponseBody builds the HTTP response body from the result of the "followers" endpoint of the "following" 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
	Follow    http.Handler
	Unfollow  http.Handler
	Followers http.Handler
	CORS      http.Handler
}

Server lists the following service endpoint HTTP handlers.

func New

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

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

UnfollowBadRequestResponseBody is the type of the "following" service "unfollow" endpoint HTTP response body for the "bad-request" error.

func NewUnfollowBadRequestResponseBody

func NewUnfollowBadRequestResponseBody(res *goa.ServiceError) *UnfollowBadRequestResponseBody

NewUnfollowBadRequestResponseBody builds the HTTP response body from the result of the "unfollow" endpoint of the "following" service.

type UnfollowForbiddenResponseBody

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

UnfollowForbiddenResponseBody is the type of the "following" service "unfollow" endpoint HTTP response body for the "forbidden" error.

func NewUnfollowForbiddenResponseBody

func NewUnfollowForbiddenResponseBody(res *goa.ServiceError) *UnfollowForbiddenResponseBody

NewUnfollowForbiddenResponseBody builds the HTTP response body from the result of the "unfollow" endpoint of the "following" service.

type UnfollowNotFoundResponseBody

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

UnfollowNotFoundResponseBody is the type of the "following" service "unfollow" endpoint HTTP response body for the "not-found" error.

func NewUnfollowNotFoundResponseBody

func NewUnfollowNotFoundResponseBody(res *goa.ServiceError) *UnfollowNotFoundResponseBody

NewUnfollowNotFoundResponseBody builds the HTTP response body from the result of the "unfollow" endpoint of the "following" service.

type UnfollowUnauthorizedResponseBody

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

UnfollowUnauthorizedResponseBody is the type of the "following" service "unfollow" endpoint HTTP response body for the "unauthorized" error.

func NewUnfollowUnauthorizedResponseBody

func NewUnfollowUnauthorizedResponseBody(res *goa.ServiceError) *UnfollowUnauthorizedResponseBody

NewUnfollowUnauthorizedResponseBody builds the HTTP response body from the result of the "unfollow" endpoint of the "following" service.

Jump to

Keyboard shortcuts

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