connectclient

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 2 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Make

func Make[T any](cfg *Config, address string, factory StubFactory[T]) T

Make uses the given generated factory function to create a new connect client.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config holds configuration for creating Connect RPC clients.

func NewConfig

func NewConfig(httpClient connect.HTTPClient, options ...ConfigOption) *Config

NewConfig creates a new client configuration with the given HTTP client and options.

type ConfigOption

type ConfigOption func(*Config)

ConfigOption is an option for customizing a new Config.

func WithAddressMapper

func WithAddressMapper(addressMapper func(string) string) ConfigOption

WithAddressMapper maps the address with the given function.

func WithAuthInterceptorProvider

func WithAuthInterceptorProvider(authInterceptorProvider func(string) connect.UnaryInterceptorFunc) ConfigOption

WithAuthInterceptorProvider configures a provider that, when invoked, returns an interceptor that can be added to a client for setting the auth token

func WithInterceptors

func WithInterceptors(interceptors []connect.Interceptor) ConfigOption

WithInterceptors adds the slice of interceptors to all clients returned from this provider.

type StubFactory

type StubFactory[T any] func(connect.HTTPClient, string, ...connect.ClientOption) T

StubFactory is the type of a generated factory function, for creating Connect client stubs.

Jump to

Keyboard shortcuts

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