Documentation
¶
Overview ¶
Package service provides common types used by services.
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
}
A Client is a struct used by services to make HTTP requests.
func (*Client) Do ¶
Do performs an HTTP request.
If v is nil, the response body is not closed, and the caller must close it.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, url string, body any, opts ...RequestOpt) (*http.Request, error)
NewRequest creates a new HTTP request.
type ErrUnexpectedStatusCode ¶
An ErrUnexpectedStatusCode is an error returned when the HTTP response has an unexpected status code.
In includes the expected and actual codes, as well as the response.
func (ErrUnexpectedStatusCode) Error ¶
func (e ErrUnexpectedStatusCode) Error() string
Error implements the error interface.
type RequestOpt ¶
A RequestOpt is a functional option for configuring a Request.
func WithAPIKey ¶
func WithAPIKey(key string) RequestOpt
WithAPIKey sets the API key for the request.
The default service key is used if this option is not provided or the value is empty.