xrpc library

Classes

EmptyData
An object representing a state that is empty instead of null.
NSID
This is the Dart implementation of NSID in AT Protocol.
RateLimit
Represents the rate limit applied to an API or a service.
RateLimitPolicy
Represents a policy for rate limiting.
Serializable
Subscription<T>
XRPCError
XRPCRequest
A class that represents a Request sent during XRPC communication.
XRPCResponse<D>
The class represents the response from ATP server.

Functions

procedure<T>(NSID methodId, {Protocol protocol = Protocol.https, String? service, Map<String, String>? headers, Map<String, dynamic>? parameters, dynamic body, Duration timeout = const Duration(seconds: 10), ResponseDataBuilder<T>? to, PostClient? postClient}) Future<XRPCResponse<T>>
Performs POST communication to the ATP server.
query<T>(NSID methodId, {Protocol protocol = Protocol.https, String? service, Map<String, String>? headers, Map<String, dynamic>? parameters, Duration timeout = const Duration(seconds: 10), ResponseDataBuilder<T>? to, ResponseDataAdaptor? adaptor, GetClient? getClient}) Future<XRPCResponse<T>>
Performs GET communication to the ATP server.
subscribe<T>(NSID methodId, {String? service, Map<String, dynamic>? parameters, ResponseDataBuilder<T>? to, ResponseDataAdaptor? adaptor}) XRPCResponse<Subscription<T>>
Subscribes endpoints associated with methodId in WebSocket.

Typedefs

GetClient = Future<Response> Function(Uri url, {Map<String, String>? headers})
A function type abstracted from http.get, mainly for mocking at test time.
PostClient = Future<Response> Function(Uri url, {Object? body, Encoding? encoding, Map<String, String>? headers})
A function type abstracted from http.post, mainly for mocking at test time.
ResponseDataAdaptor = Map<String, dynamic> Function(dynamic data)
Function to convert response data to an specific structure.
ResponseDataBuilder<T> = T Function(Map<String, Object?> json)
A function type that expresses the function of converting response body to model objects.

Exceptions / Errors

InternalServerErrorException
InvalidRequestException
RateLimitExceededException
UnauthorizedException
XRPCException
This exception indicates that an unexpected error occurred when communicating with the ATP server.
XRPCNotSupportedException