v1

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 14 Imported by: 1 module, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package v1 is a generated GoMock package.

Index

Constants

View Source
const (
	// HTTPMethodPost is the HTTP POST method.
	HTTPMethodPost = "POST"
	// HTTPMethodGet is the HTTP GET method.
	HTTPMethodGet = "GET"
	// HTTPMethodPut is the HTTP PUT method.
	HTTPMethodPut = "PUT"
	// HTTPMethodDelete is the HTTP DELETE method.
	HTTPMethodDelete = "DELETE"
)

Variables

This section is empty.

Functions

func DecodeResponse

func DecodeResponse[RESP any](ctx context.Context, response *http.Response) (interface{}, error)

func EncodeRequest

func EncodeRequest[REQ any](ctx context.Context, request *http.Request, req HTTPRequest[REQ]) error

Types

type Client

type Client[REQ any, RESP any] interface {
	Endpoint() Endpoint[REQ, RESP]
}

Client interface provides a standard endpoint with request/response conversion capabilities

func NewHTTPClient

func NewHTTPClient[REQ any, RESP any](method, path string, options ...http_transport.ClientOption) Client[REQ, RESP]

NewHTTPClient creates a new HTTP client with optional http_transport.ClientOption

type ClientBuilder added in v1.0.8

type ClientBuilder[REQ any, RESP any] interface {
	Use(middleware Middleware[REQ, RESP]) ClientBuilder[REQ, RESP]
	UseMany(middlewares ...Middleware[REQ, RESP]) ClientBuilder[REQ, RESP]
	WithOptions(options ...http_transport.ClientOption) ClientBuilder[REQ, RESP]
	Build() Client[REQ, RESP]
}

func NewClientBuilder added in v1.0.8

func NewClientBuilder[REQ any, RESP any](method, path string) ClientBuilder[REQ, RESP]

NewClientBuilder creates a new clientBuilder for the specified HTTP method and path

type Endpoint

type Endpoint[REQ any, RESP any] func(ctx context.Context, request HTTPRequest[REQ]) (response RESP, err error)

func NewEndpoint

func NewEndpoint[REQ any, RESP any](ep endpoint.Endpoint) Endpoint[REQ, RESP]

type HTTPRequest

type HTTPRequest[REQ any] struct {
	PathVars    map[string]string
	QueryParams map[string][]string
	Body        REQ
}

type Middleware added in v1.0.8

type Middleware[REQ any, RESP any] func(Endpoint[REQ, RESP]) Endpoint[REQ, RESP]

Middleware wraps an Endpoint and returns a new Endpoint

func Chain added in v1.0.8

func Chain[REQ any, RESP any](middlewares ...Middleware[REQ, RESP]) Middleware[REQ, RESP]

Chain applies multiple middlewares in order (first middleware wraps outermost)

type MockClient

type MockClient[REQ any, RESP any] struct {
	// contains filtered or unexported fields
}

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient[REQ any, RESP any](ctrl *gomock.Controller) *MockClient[REQ, RESP]

NewMockClient creates a new mock instance.

func (*MockClient[REQ, RESP]) EXPECT

func (m *MockClient[REQ, RESP]) EXPECT() *MockClientMockRecorder[REQ, RESP]

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient[REQ, RESP]) Endpoint

func (m *MockClient[REQ, RESP]) Endpoint() Endpoint[REQ, RESP]

Endpoint mocks base method.

type MockClientBuilder added in v1.0.9

type MockClientBuilder[REQ any, RESP any] struct {
	// contains filtered or unexported fields
}

MockClientBuilder is a mock of ClientBuilder interface.

func NewMockClientBuilder added in v1.0.9

func NewMockClientBuilder[REQ any, RESP any](ctrl *gomock.Controller) *MockClientBuilder[REQ, RESP]

NewMockClientBuilder creates a new mock instance.

func (*MockClientBuilder[REQ, RESP]) Build added in v1.0.9

func (m *MockClientBuilder[REQ, RESP]) Build() Client[REQ, RESP]

Build mocks base method.

func (*MockClientBuilder[REQ, RESP]) EXPECT added in v1.0.9

func (m *MockClientBuilder[REQ, RESP]) EXPECT() *MockClientBuilderMockRecorder[REQ, RESP]

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClientBuilder[REQ, RESP]) Use added in v1.0.9

func (m *MockClientBuilder[REQ, RESP]) Use(middleware Middleware[REQ, RESP]) ClientBuilder[REQ, RESP]

Use mocks base method.

func (*MockClientBuilder[REQ, RESP]) UseMany added in v1.0.9

func (m *MockClientBuilder[REQ, RESP]) UseMany(middlewares ...Middleware[REQ, RESP]) ClientBuilder[REQ, RESP]

UseMany mocks base method.

func (*MockClientBuilder[REQ, RESP]) WithOptions added in v1.0.9

func (m *MockClientBuilder[REQ, RESP]) WithOptions(options ...http.ClientOption) ClientBuilder[REQ, RESP]

WithOptions mocks base method.

type MockClientBuilderMockRecorder added in v1.0.9

type MockClientBuilderMockRecorder[REQ any, RESP any] struct {
	// contains filtered or unexported fields
}

MockClientBuilderMockRecorder is the mock recorder for MockClientBuilder.

func (*MockClientBuilderMockRecorder[REQ, RESP]) Build added in v1.0.9

func (mr *MockClientBuilderMockRecorder[REQ, RESP]) Build() *gomock.Call

Build indicates an expected call of Build.

func (*MockClientBuilderMockRecorder[REQ, RESP]) Use added in v1.0.9

func (mr *MockClientBuilderMockRecorder[REQ, RESP]) Use(middleware any) *gomock.Call

Use indicates an expected call of Use.

func (*MockClientBuilderMockRecorder[REQ, RESP]) UseMany added in v1.0.9

func (mr *MockClientBuilderMockRecorder[REQ, RESP]) UseMany(middlewares ...any) *gomock.Call

UseMany indicates an expected call of UseMany.

func (*MockClientBuilderMockRecorder[REQ, RESP]) WithOptions added in v1.0.9

func (mr *MockClientBuilderMockRecorder[REQ, RESP]) WithOptions(options ...any) *gomock.Call

WithOptions indicates an expected call of WithOptions.

type MockClientMockRecorder

type MockClientMockRecorder[REQ any, RESP any] struct {
	// contains filtered or unexported fields
}

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder[REQ, RESP]) Endpoint

func (mr *MockClientMockRecorder[REQ, RESP]) Endpoint() *gomock.Call

Endpoint indicates an expected call of Endpoint.

type NilBody

type NilBody struct{}

NilBody is a type used as a placeholder when no request or response body is needed

Jump to

Keyboard shortcuts

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