endpoint

package
v0.0.0-...-d11ffb8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 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 MakeGetEndpoint

func MakeGetEndpoint(s service.UsersService) endpoint.Endpoint

MakeGetEndpoint returns an endpoint that invokes Get on the service.

func MakeLoginEndpoint

func MakeLoginEndpoint(s service.UsersService) endpoint.Endpoint

MakeLoginEndpoint returns an endpoint that invokes Login on the service.

func MakeRegisterEndpoint

func MakeRegisterEndpoint(s service.UsersService) endpoint.Endpoint

MakeRegisterEndpoint returns an endpoint that invokes Register on the service.

Types

type Endpoints

type Endpoints struct {
	GetEndpoint      endpoint.Endpoint
	LoginEndpoint    endpoint.Endpoint
	RegisterEndpoint 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) Get

func (e Endpoints) Get(ctx context.Context, id string) (s0 string, s1 string, s2 string, e1 error)

Get implements Service. Primarily useful in a client.

func (Endpoints) Login

func (e Endpoints) Login(ctx context.Context, username string, password string) (s0 string, e1 error)

Login implements Service. Primarily useful in a client.

func (Endpoints) Register

func (e Endpoints) Register(ctx context.Context, username string, password string, email string, phone string) (s0 string, e1 error)

Register 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 {
	Id string `json:"id"`
}

GetRequest collects the request parameters for the Get method.

type GetResponse

type GetResponse struct {
	S0 string `json:"username"`
	S1 string `json:"email"`
	S2 string `json:"phone"`
	E1 error  `json:"error"`
}

GetResponse collects the response parameters for the Get method.

func (GetResponse) Failed

func (r GetResponse) Failed() error

Failed implements Failer.

type LoginRequest

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

LoginRequest collects the request parameters for the Login method.

type LoginResponse

type LoginResponse struct {
	S0 string `json:"s0"`
	E1 error  `json:"e1"`
}

LoginResponse collects the response parameters for the Login method.

func (LoginResponse) Failed

func (r LoginResponse) Failed() error

Failed implements Failer.

type RegisterRequest

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

RegisterRequest collects the request parameters for the Register method.

type RegisterResponse

type RegisterResponse struct {
	S0 string `json:"s0"`
	E1 error  `json:"e1"`
}

RegisterResponse collects the response parameters for the Register method.

func (RegisterResponse) Failed

func (r RegisterResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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