Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrServiceUnavailable represents a error when AUR is unavailable.
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 HTTPRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client for AUR searching and querying.
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
type ClientInterface ¶
type ClientInterface interface {
// 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 By, reqEditors ...RequestEditorFn) ([]Pkg, error)
// Info gives detailed information on existing package.
Info(ctx context.Context, pkgs []string, reqEditors ...RequestEditorFn) ([]Pkg, error)
}
ClientInterface specification for the AUR client.
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 WithHTTPClient ¶
func WithHTTPClient(doer HTTPRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn 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.
type HTTPRequestDoer ¶
HTTPRequestDoer performs HTTP requests. The standard http.Client implements this interface.
type PayloadError ¶
func (*PayloadError) Error ¶
func (r *PayloadError) Error() string
type Pkg ¶
type Pkg struct {
ID int `json:"ID"`
Name string `json:"Name"`
PackageBaseID int `json:"PackageBaseID"`
PackageBase string `json:"PackageBase"`
Version string `json:"Version"`
Description string `json:"Description"`
URL string `json:"URL"`
NumVotes int `json:"NumVotes"`
Popularity float64 `json:"Popularity"`
OutOfDate int `json:"OutOfDate"`
Maintainer string `json:"Maintainer"`
FirstSubmitted int `json:"FirstSubmitted"`
LastModified int `json:"LastModified"`
URLPath string `json:"URLPath"`
Depends []string `json:"Depends"`
MakeDepends []string `json:"MakeDepends"`
CheckDepends []string `json:"CheckDepends"`
Conflicts []string `json:"Conflicts"`
Provides []string `json:"Provides"`
Replaces []string `json:"Replaces"`
OptDepends []string `json:"OptDepends"`
Groups []string `json:"Groups"`
License []string `json:"License"`
Keywords []string `json:"Keywords"`
}
Pkg holds package information.