httpclient

package
v1.0.0-rc12 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpTransportAuthProvider

type HttpTransportAuthProvider interface {
	AddAuthHeaders(req *http.Request)
}

type HttpTransportClient

type HttpTransportClient struct {
	Client *http.Client
	Config *HttpTransportClientConfig
}

func (*HttpTransportClient) AddAuthHeaders

func (t *HttpTransportClient) AddAuthHeaders(req *http.Request)

func (*HttpTransportClient) AddCommonHeaders

func (t *HttpTransportClient) AddCommonHeaders(req *http.Request)

AddCommonHeaders adds common headers to the request

func (*HttpTransportClient) Delete added in v0.3.11

func (t *HttpTransportClient) Delete(path string, out any, params ...HttpTransportClientParams) error

func (*HttpTransportClient) GetJSON

func (t *HttpTransportClient) GetJSON(path string, out any, params ...HttpTransportClientParams) error

func (*HttpTransportClient) Head added in v0.3.11

Head makes a HEAD request with the given path and params. It returns only the header and status code from the result, as it expects no body in return.

func (*HttpTransportClient) OpenSSEStream added in v0.3.5

func (t *HttpTransportClient) OpenSSEStream(path string) (<-chan stream.RorEvent, error)

func (*HttpTransportClient) OpenSSEStreamWithCallback added in v0.3.5

func (t *HttpTransportClient) OpenSSEStreamWithCallback(callback func(stream.RorEvent), path string) (<-chan struct{}, error)

func (*HttpTransportClient) ParseParams added in v0.1.6

func (t *HttpTransportClient) ParseParams(req *http.Request, params ...HttpTransportClientParams)

func (*HttpTransportClient) PostJSON

func (t *HttpTransportClient) PostJSON(path string, in any, out any, params ...HttpTransportClientParams) error

func (*HttpTransportClient) PutJSON

func (t *HttpTransportClient) PutJSON(path string, in any, out any, params ...HttpTransportClientParams) error

type HttpTransportClientConfig

type HttpTransportClientConfig struct {
	// BaseURL is the base URL for the API
	// Example: https://api.example.com
	BaseURL string
	// AuthProvider is the provider for the authentication
	AuthProvider HttpTransportAuthProvider
	// Role is the role of the client
	Role string
	// Version is the version of the client
	Version rorversion.RorVersion
}

HttpTransportClientConfig is the configuration for the HTTP transport client

type HttpTransportClientOpts added in v0.1.6

type HttpTransportClientOpts string
const (
	HttpTransportClientOptsNoAuth  HttpTransportClientOpts = "NOAUTH"
	HttpTransportClientOptsHeaders HttpTransportClientOpts = "HEADERS"
	HttpTransportClientOptsQuery   HttpTransportClientOpts = "QUERY"
	HttpTransportClientTimeout     HttpTransportClientOpts = "TIMEOUT"
)

type HttpTransportClientParams

type HttpTransportClientParams struct {
	Key   HttpTransportClientOpts
	Value any
}

type SSEClient added in v0.3.5

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

func (*SSEClient) CheckRetry added in v0.3.5

func (s *SSEClient) CheckRetry() bool

func (*SSEClient) Listen added in v0.3.5

func (s *SSEClient) Listen() (<-chan stream.RorEvent, error)

func (*SSEClient) UnSetRetry added in v0.3.5

func (s *SSEClient) UnSetRetry()

Jump to

Keyboard shortcuts

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