endpoint

package
v0.0.0-...-b73353b Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2018 License: MIT Imports: 7 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 MakeSendEmailEndpoint

func MakeSendEmailEndpoint(s service.NotificatorService) endpoint.Endpoint

MakeSendEmailEndpoint returns an endpoint that invokes SendEmail on the service.

Types

type Endpoints

type Endpoints struct {
	SendEmailEndpoint 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) SendEmail

func (e Endpoints) SendEmail(ctx context.Context, email string, content string) (err error)

SendEmail implements Service. Primarily useful in a client.

type Failure

type Failure interface {
	Failed() error
}

Failer 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 SendEmailRequest

type SendEmailRequest struct {
	Email   string `json:"email"`
	Content string `json:"content"`
}

SendEmailRequest collects the request parameters for the SendEmail method.

type SendEmailResponse

type SendEmailResponse struct {
	ID  string `json:"id"`
	Err error  `json:"err"`
}

SendEmailResponse collects the response parameters for the SendEmail method.

func (SendEmailResponse) Failed

func (r SendEmailResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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