Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
BaseURL string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
HTTPClient aur.HTTPRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []aur.RequestEditorFn
// contains filtered or unexported fields
}
Client for AUR searching and querying.
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
type ClientInterface ¶
type ClientInterface interface {
aur.QueryClient
// Search queries the AUR DB with an optional By filter.
// Use By.None for default query param (name-desc)
Search(ctx context.Context, query string, by aur.By) ([]aur.Pkg, error)
// Info gives detailed information on existing package.
Info(ctx context.Context, pkgs []string) ([]aur.Pkg, error)
}
type ClientOption ¶
ClientOption allows setting custom parameters during construction.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL allows overriding the default base URL of the client.
func WithBatchSize ¶
func WithBatchSize(batchSize int) ClientOption
WithBatchSize allows overriding the default value for batch size.
func WithHTTPClient ¶
func WithHTTPClient(doer aur.HTTPRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithLogFn ¶
func WithLogFn(fn LogFn) ClientOption
WithLogFn allows overriding the default log function.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn aur.RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
Click to show internal directories.
Click to hide internal directories.