Documentation
¶
Overview ¶
Methods interacting with the AUR website.
Client creation elements ¶
Errors
Example ¶
Vote for a single package
package main import ( "context" "log" "github.com/Jguer/votar/pkg/vote" ) func main() { client, err := vote.NewClient() if err != nil { log.Println("Failed to create client") } client.SetCredentials("user", "password") if err = client.Vote(context.Background(), "package"); err != nil { log.Println("Failed to vote for", "package") } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoCredentials = fmt.Errorf("no credentials provided")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient creates a new AURWebClient.
func (*Client) SetCredentials ¶
SetCredentials sets the username and password for the 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 WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent allows overriding the default user agent of the client.
type ErrLoginFailed ¶
type ErrLoginFailed struct {
// contains filtered or unexported fields
}
func (*ErrLoginFailed) Error ¶
func (e *ErrLoginFailed) Error() string
type ErrVoteFailed ¶
type ErrVoteFailed struct {
// contains filtered or unexported fields
}
func (*ErrVoteFailed) Error ¶
func (e *ErrVoteFailed) Error() string
Click to show internal directories.
Click to hide internal directories.