Documentation
¶
Overview ¶
THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!!
Index ¶
- func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func LoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeEmailEndpoint(s service.NotificationService) endpoint.Endpoint
- func MakeSMSEndpoint(s service.NotificationService) endpoint.Endpoint
- func MakeSMSTEndpoint(s service.NotificationService) endpoint.Endpoint
- func MakeVerifyEndpoint(s service.NotificationService) endpoint.Endpoint
- type EmailRequest
- type EmailResponse
- type Endpoints
- func (e Endpoints) Email(ctx context.Context, to string, body string, data interface{}) (message string, status string, err error)
- func (e Endpoints) SMS(ctx context.Context, to string, body string, data interface{}) (message string, status string, err error)
- func (e Endpoints) SMST(ctx context.Context, to string, params map[string]string, template string, ...) (message string, status string, err error)
- func (e Endpoints) Verify(ctx context.Context, phone string, code string) (message string, status string, data interface{}, err error)
- type Failure
- type SMSRequest
- type SMSResponse
- type SMSTRequest
- type SMSTResponse
- type VerifyRequest
- type VerifyResponse
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.
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 ¶
func New(s service.NotificationService, mdw map[string][]endpoint.Middleware) Endpoints
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.
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 ¶
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.
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.
type VerifyRequest ¶
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.