client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client handles HTTP requests to backend services

func New

func New(cfg Config) *Client

New creates a new client instance

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, url, encoding string, headers map[string]string) (interface{}, error)

Delete makes a DELETE request

func (*Client) Get

func (c *Client) Get(ctx context.Context, url, encoding string, headers map[string]string) (interface{}, error)

Get makes a GET request

func (*Client) Post

func (c *Client) Post(ctx context.Context, url, encoding string, headers map[string]string,
	body io.Reader) (interface{}, error)

Post makes a POST request

func (*Client) Put

func (c *Client) Put(ctx context.Context, url, encoding string, headers map[string]string,
	body io.Reader) (interface{}, error)

Put makes a PUT request

func (*Client) Request

func (c *Client) Request(ctx context.Context, cfg RequestConfig) (interface{}, error)

Request makes an HTTP request and returns the parsed response

type Config

type Config struct {
	HTTPClient *http.Client
	Tracer     trace.Tracer
	Logger     zerolog.Logger
}

Config holds client configuration

type RequestConfig

type RequestConfig struct {
	Method   string
	URL      string
	Encoding string
	Headers  map[string]string
	Body     io.Reader
}

RequestConfig holds configuration for a single request

Jump to

Keyboard shortcuts

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