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: 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 MakeLoginPEndpoint

func MakeLoginPEndpoint(s service.AuthService) endpoint.Endpoint

MakeLoginPEndpoint returns an endpoint that invokes LoginP on the service.

func MakeLoginUPEndpoint

func MakeLoginUPEndpoint(s service.AuthService) endpoint.Endpoint

MakeLoginUPEndpoint returns an endpoint that invokes LoginUP on the service.

func MakeRegisterEndpoint

func MakeRegisterEndpoint(s service.AuthService) endpoint.Endpoint

MakeRegisterEndpoint returns an endpoint that invokes Register on the service.

func MakeVerifyEndpoint

func MakeVerifyEndpoint(s service.AuthService) endpoint.Endpoint

MakeVerifyEndpoint returns an endpoint that invokes Verify on the service.

Types

type Endpoints

type Endpoints struct {
	RegisterEndpoint endpoint.Endpoint
	LoginUPEndpoint  endpoint.Endpoint
	LoginPEndpoint   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) LoginP

func (e Endpoints) LoginP(ctx context.Context, Phone string) (Response model.User, err error)

LoginP implements Service. Primarily useful in a client.

func (Endpoints) LoginUP

func (e Endpoints) LoginUP(ctx context.Context, Username string, Password string) (Response model.User, err error)

LoginUP implements Service. Primarily useful in a client.

func (Endpoints) Register

func (e Endpoints) Register(ctx context.Context, Username string, Password string, Name string, LastName string, Phone string, Email string) (Response model.User, err error)

Register implements Service. Primarily useful in a client.

func (Endpoints) Verify

func (e Endpoints) Verify(ctx context.Context, Token string, Type string, Code string) (Response model.User, 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 LoginPRequest

type LoginPRequest struct {
	Phone string `json:"phone"`
}

LoginPRequest collects the request parameters for the LoginP method.

type LoginPResponse

type LoginPResponse struct {
	Response model.User `json:"response"`
	Err      error      `json:"err"`
}

LoginPResponse collects the response parameters for the LoginP method.

func (LoginPResponse) Failed

func (r LoginPResponse) Failed() error

Failed implements Failer.

type LoginUPRequest

type LoginUPRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

LoginUPRequest collects the request parameters for the LoginUP method.

type LoginUPResponse

type LoginUPResponse struct {
	Response model.User `json:"response"`
	Err      error      `json:"err"`
}

LoginUPResponse collects the response parameters for the LoginUP method.

func (LoginUPResponse) Failed

func (r LoginUPResponse) Failed() error

Failed implements Failer.

type RegisterRequest

type RegisterRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Name     string `json:"name"`
	LastName string `json:"last_name"`
	Phone    string `json:"phone"`
	Email    string `json:"email"`
}

RegisterRequest collects the request parameters for the Register method.

type RegisterResponse

type RegisterResponse struct {
	Response model.User `json:"response"`
	Err      error      `json:"err"`
}

RegisterResponse collects the response parameters for the Register method.

func (RegisterResponse) Failed

func (r RegisterResponse) Failed() error

Failed implements Failer.

type VerifyRequest

type VerifyRequest struct {
	Token string `json:"token"`
	Type  string `json:"type"`
	Code  string `json:"code"`
}

VerifyRequest collects the request parameters for the Verify method.

type VerifyResponse

type VerifyResponse struct {
	Response model.User `json:"response"`
	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