Documentation
¶
Index ¶
- Variables
- func DecodeResponse(resp *http.Response, target any) error
- type Authenticator
- type BearerAuth
- type Client
- func (c *Client) Do(req *http.Request, provider *catalogs.Provider) (*http.Response, error)
- func (c *Client) DoWithContext(ctx context.Context, req *http.Request, provider *catalogs.Provider) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, url string, provider *catalogs.Provider) (*http.Response, error)
- type HeaderAuth
- type NoAuth
- type ProviderAuth
- type QueryAuth
- type RequestBuilder
Constants ¶
This section is empty.
Variables ¶
var DefaultHTTPTimeout = constants.DefaultHTTPTimeout
DefaultHTTPTimeout is the default timeout for HTTP requests.
Functions ¶
Types ¶
type Authenticator ¶
Authenticator applies authentication to HTTP requests.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides HTTP client functionality with authentication.
func (*Client) DoWithContext ¶
func (c *Client) DoWithContext(ctx context.Context, req *http.Request, provider *catalogs.Provider) (*http.Response, error)
DoWithContext performs an HTTP request with authentication applied and context support. The provided context will be used for the request, overriding any existing context in req.
type HeaderAuth ¶
type HeaderAuth struct {
Header string
}
HeaderAuth implements custom header authentication.
type ProviderAuth ¶
ProviderAuth implements provider-specific authentication using catalog configuration.
type QueryAuth ¶
type QueryAuth struct {
Param string
}
QueryAuth implements API key as query parameter authentication.
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
RequestBuilder helps build HTTP requests with provider-specific configurations.
func NewRequestBuilder ¶
func NewRequestBuilder(provider *catalogs.Provider) *RequestBuilder
NewRequestBuilder creates a new request builder for a provider.
func (*RequestBuilder) AddProviderHeaders ¶
func (rb *RequestBuilder) AddProviderHeaders(req *http.Request)
AddProviderHeaders adds provider-specific headers to a request.
func (*RequestBuilder) GetBaseURL ¶
func (rb *RequestBuilder) GetBaseURL() string
GetBaseURL returns the base URL for API requests.
func (*RequestBuilder) GetModelsURL ¶
func (rb *RequestBuilder) GetModelsURL(defaultURL string) string
GetModelsURL returns the URL for listing models.