endpoint

package
v0.0.0-...-618fe63 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 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 MakeEmailEndpoint

func MakeEmailEndpoint(s service.NotificationService) endpoint.Endpoint

MakeEmailEndpoint returns an endpoint that invokes Email on the service.

func MakeSMSEndpoint

func MakeSMSEndpoint(s service.NotificationService) endpoint.Endpoint

MakeSMSEndpoint returns an endpoint that invokes SMS on the service.

func MakeSMSTEndpoint

func MakeSMSTEndpoint(s service.NotificationService) endpoint.Endpoint

MakeSMSTEndpoint returns an endpoint that invokes SMST on the service.

func MakeVerifyEndpoint

func MakeVerifyEndpoint(s service.NotificationService) endpoint.Endpoint

MakeVerifyEndpoint returns an endpoint that invokes Verify on the service.

Types

type EmailRequest

type EmailRequest struct {
	To   string      `json:"to"`
	Body string      `json:"body"`
	Data interface{} `json:"data"`
}

EmailRequest collects the request parameters for the Email method.

type EmailResponse

type EmailResponse struct {
	Message string `json:"message"`
	Status  string `json:"status"`
	Err     error  `json:"err"`
}

EmailResponse collects the response parameters for the Email method.

func (EmailResponse) Failed

func (r EmailResponse) Failed() error

Failed implements Failer.

type Endpoints

type Endpoints struct {
	SMSEndpoint    endpoint.Endpoint
	SMSTEndpoint   endpoint.Endpoint
	EmailEndpoint  endpoint.Endpoint
	VerifyEndpoint 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) Email

func (e Endpoints) Email(ctx context.Context, to string, body string, data interface{}) (message string, status string, err error)

Email implements Service. Primarily useful in a client.

func (Endpoints) SMS

func (e Endpoints) SMS(ctx context.Context, to string, body string, data interface{}) (message string, status string, err error)

SMS implements Service. Primarily useful in a client.

func (Endpoints) SMST

func (e Endpoints) SMST(ctx context.Context, to string, params map[string]string, template string, data interface{}) (message string, status string, err error)

SMST implements Service. Primarily useful in a client.

func (Endpoints) Verify

func (e Endpoints) Verify(ctx context.Context, phone string, code string) (message string, status string, data interface{}, err error)

Verify 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 SMSRequest

type SMSRequest struct {
	To   string `json:"to"`
	Body string `json:"body"`
}

SMSRequest collects the request parameters for the SMS method.

type SMSResponse

type SMSResponse struct {
	Message string `json:"message"`
	Status  string `json:"status"`
	Err     error  `json:"err"`
}

SMSResponse collects the response parameters for the SMS method.

func (SMSResponse) Failed

func (r SMSResponse) Failed() error

Failed implements Failer.

type SMSTRequest

type SMSTRequest struct {
	To       string            `json:"to"`
	Params   map[string]string `json:"params"`
	Template string            `json:"template"`
}

SMSTRequest collects the request parameters for the SMST method.

type SMSTResponse

type SMSTResponse struct {
	Message string `json:"message"`
	Status  string `json:"status"`
	Err     error  `json:"err"`
}

SMSTResponse collects the response parameters for the SMST method.

func (SMSTResponse) Failed

func (r SMSTResponse) Failed() error

Failed implements Failer.

type VerifyRequest

type VerifyRequest struct {
	Phone string `json:"phone"`
	Code  string `json:"code"`
}

VerifyRequest collects the request parameters for the Verify method.

type VerifyResponse

type VerifyResponse struct {
	Message string      `json:"message"`
	Status  string      `json:"status"`
	Data    interface{} `json:"data"`
	Err     error       `json:"err"`
}

VerifyResponse collects the response parameters for the Verify method.

func (VerifyResponse) Failed

func (r VerifyResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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