endpoint

package
v0.0.0-...-e06aa91 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstrumentingMiddleware

func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware

InstrumentingMiddleware returns an endpoint middleware that records the duration of each invocation to the passed histogram. The middleware adds a single field: "success", which is "true" if no error is returned, and "false" otherwise.

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) endpoint.Middleware

LoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.

func MakeAuthenticateEndpoint

func MakeAuthenticateEndpoint(s service.AuthenticationService) endpoint.Endpoint

MakeAuthenticateEndpoint returns an endpoint that invokes Authenticate on the service.

func MakeCreateEndpoint

func MakeCreateEndpoint(s service.AuthenticationService) endpoint.Endpoint

MakeCreateEndpoint returns an endpoint that invokes Create on the service.

func MakeGetEndpoint

MakeGetEndpoint returns an endpoint that invokes Get on the service.

Types

type AuthenticateRequest

type AuthenticateRequest struct{}

AuthenticateRequest collects the request parameters for the Authenticate method.

type AuthenticateResponse

type AuthenticateResponse struct {
	Error error `json:"error"`
}

AuthenticateResponse collects the response parameters for the Authenticate method.

func (AuthenticateResponse) Failed

func (r AuthenticateResponse) Failed() error

Failed implements Failer.

type CreateRequest

type CreateRequest struct {
	User io.User `json:"user"`
}

CreateRequest collects the request parameters for the Create method.

type CreateResponse

type CreateResponse struct {
	T     io.User `json:"t"`
	Error error   `json:"error"`
}

CreateResponse collects the response parameters for the Create method.

func (CreateResponse) Failed

func (r CreateResponse) Failed() error

Failed implements Failer.

type Endpoints

type Endpoints struct {
	GetEndpoint          endpoint.Endpoint
	CreateEndpoint       endpoint.Endpoint
	AuthenticateEndpoint endpoint.Endpoint
}

Endpoints collects all of the endpoints that compose a profile service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.

func New

New returns a Endpoints struct that wraps the provided service, and wires in all of the expected endpoint middlewares

func (Endpoints) Authenticate

func (e Endpoints) Authenticate(ctx context.Context) (error error)

Authenticate implements Service. Primarily useful in a client.

func (Endpoints) Create

func (e Endpoints) Create(ctx context.Context, user io.User) (t io.User, error error)

Create implements Service. Primarily useful in a client.

func (Endpoints) Get

func (e Endpoints) Get(ctx context.Context) (t []io.User, error error)

Get implements Service. Primarily useful in a client.

type Failure

type Failure interface {
	Failed() error
}

Failure is an interface that should be implemented by response types. Response encoders can check if responses are Failer, and if so they've failed, and if so encode them using a separate write path based on the error.

type GetRequest

type GetRequest struct{}

GetRequest collects the request parameters for the Get method.

type GetResponse

type GetResponse struct {
	T     []io.User `json:"t"`
	Error error     `json:"error"`
}

GetResponse collects the response parameters for the Get method.

func (GetResponse) Failed

func (r GetResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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