Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveOptions ¶
func ResolveOptions(opts ...RequestOption) []httpx.RequestOption
ResolveOptions resolves one or more RequestOption to httpx.RequestOption.
Types ¶
type RequestOption ¶
type RequestOption func(*Options)
RequestOption configures a single request.
func WithQuery ¶
func WithQuery(q url.Values) RequestOption
WithQuery adds the given query values to a request.
func WithReader ¶
func WithReader(r io.Reader) RequestOption
WithReader sets the body of a request with the given io.Reader.
func WithReason ¶
func WithReason(reason string) RequestOption
WithReason sets the X-Audit-Log-Reason on a request.
func WithToken ¶
func WithToken(t string) RequestOption
WithToken overrides the default token for a request.
type RestClient ¶
type RestClient interface { // Do should create a request from the given options, perform it, check for errors, then // finally return the response. Do(ctx context.Context, method, uri string, opts ...RequestOption) (*http.Response, error) // DoFromRequest should perform the same as Do, except with a given Request object. DoFromRequest(context.Context, *http.Request) (*http.Response, error) // NewRequest should create a Request object given the parameters to use with DoFromRequest. NewRequest(ctx context.Context, method, uri string, opt ...RequestOption) (*http.Request, error) }
RestClient represents a REST Client that is responsible for performing requests against Discord's API.
Click to show internal directories.
Click to hide internal directories.