A handler for making HTTP requests to the Discord API.
HTTP requests can be made using the execute method. Rate limiting is anticipated and requests will not be sent if their bucket is out of remaining requests or if the global rate limit was exceeded.
- Implementers
Constructors
- HttpHandler(Uhxx client)
- Create a new HttpHandler.
Properties
-
buckets
→ Map<
String, HttpBucket> -
A mapping of HttpRequest.rateLimitId to HttpBucket for rate limiting.
no setter
- client → Uhxx
-
The client this handler is attached to.
final
-
done
→ Future<
void> -
A future that completes when this HTTP handler closes.
no setter
- globalReset → DateTime?
-
The time at which the global rate limit resets.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClient → Client
-
The HTTP client used to make requests.
final
- latency → Duration
-
The average time taken by the last 10 requests to get a response.
no setter
- logger → Logger
-
no setter
-
onRateLimit
→ Stream<
RateLimitInfo> -
A stream that emits an event when a request is delayed because of a rate limit.
no setter
-
onRequest
→ Stream<
HttpRequest> -
A stream of requests executed by this handler.
no setter
-
onResponse
→ Stream<
HttpResponse> -
A stream of responses received by this handler.
no setter
- realLatency → Duration
-
The average network and API latency of the last 10 requests.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Close this HTTP handler.
-
execute(
HttpRequest request) → Future< HttpResponse> -
Send
requestto the API and return the response. -
executeSafe(
HttpRequest request) → Future< HttpResponseSuccess> -
Execute
requestand throw the response if it is not a HttpResponseSuccess. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited