request

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeDuration   = 10 * time.Minute
	DefaultTickerDuration = time.Minute
)
View Source
var ErrClientIDNotFound = errors.New("client id not found")

Functions

This section is empty.

Types

type Auth

type Auth struct {
	RoundTripper func(_ context.Context, transport http.RoundTripper) (http.RoundTripper, error)
	Cancel       context.CancelFunc
}

type AuthConfig

type AuthConfig struct {
	Enabled      bool     `json:"enabled"`
	ClientID     string   `json:"client_id"`
	ClientSecret string   `json:"client_secret"`
	TokenURL     string   `json:"token_url"`
	Scopes       []string `json:"scopes"`
}

type Client

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

func NewClient

func NewClient(cfg Config) (*Client, error)

func (*Client) Call

func (c *Client) Call(
	ctx context.Context,
	url, method string,
	headers map[string]interface{},
	payload []byte,
) (*ClientResponse, error)

type ClientResponse

type ClientResponse struct {
	Header     http.Header
	Body       []byte
	StatusCode int
}

type Config

type Config struct {
	SkipVerify bool
	Proxy      string
	Log        *zerolog.Logger
	Retry      Retry
	Auth       AuthConfig
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}
var GlobalRegistry *Registry

func InitGlobalRegistry

func InitGlobalRegistry(ctx context.Context) *Registry

func (*Registry) AddService

func (r *Registry) AddService(cfg AuthConfig) (func(_ context.Context, transport http.RoundTripper) (http.RoundTripper, error), error)

func (*Registry) Start

func (r *Registry) Start(wg *sync.WaitGroup)

type Retry

type Retry struct {
	Enabled             bool
	DisabledStatusCodes []int
	EnabledStatusCodes  []int
}

type Timer

type Timer struct {
	Timer    *time.Timer
	ClientID string
}

Jump to

Keyboard shortcuts

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