api
library
Classes
ApiRequest
Container for information needed to submit a network request.
ApiResult
Success/failure-aware container for the response from an ApiRequest .
ApiResultBody
Typed-container for the response payload for an ApiResult .
ApiUrl
ApiUrl with an "api/v1" leading namespace.
ApiV1Url
ApiUrl with an "api/v1" leading namespace.
AuthenticatedReadApiRequest
Read requests that require user authentication to complete successfully.
AuthenticatedWriteApiRequest
Read requests that require user authentication to complete successfully.
ErrorMessage
Utility to unpack error strings from either a plain string (which is
straightforward), or from a map where we assume that the value is the error.
ReadApiRequest
Subtype of ApiRequest for read, or GET requests. Along with having that
HTTP verb, these requests also have querystrings and not request bodies.
RequestDelegate
Utility which can read and write data via the network.
RestApi
Handler for RESTful external communications. Applications will need a unique
RestApi instane for every different API with which they communicate.
StubUrl
Useful for tests.
WriteApiRequest
Subtype of ApiRequest for write, or POST/PATCH/PUT requests. Along with
having one of those HTTP verbs, these requests also have request bodies and
not querystrings.
Typedefs
Function to return the necessary headers for a given request. The
"Content-Type" and authorization headers are handled automatically, so this
function should only build any other headers.
ReadHandler
= Future <Response > Function(Uri url , { })
GET typedef
Represents all requests that lack a body component.
ResponseProcessor
= ApiResult Function(DateTime , Response )
Category of function which can convert an actual http.Response object
into a domain-logic equivalent, ApiResult .
WriteRequestHandler
= Future <Response > Function(Uri url , {Object ? body , Encoding ? encoding , })
POST/PUT/PATCH/DELETE typedef
Represents all requests that have a body component.