This is the main class which wires converters, middlewares and request
executors together. To create an instance of ApexClient use the ApexClient.builder method
and provide a RestRequestExecutor's implementation, the "rest" library ships with a
default implementation DefaultRestRequestExecutor, you can use it or create your own
implementation of RestRequestExecutor.
After calling the ApexClient.builder provide request/response converters and
middlewares.
This class represents the response, get returned by RestClient.execute method.
It contains the original request,
the rowResponse instance of RowResponse, which contains all the response info, like
the response headers, code, body bytes, and more (see RowResponse).
The response parameter is converted response, which get created by provided RestResponseConverter,
as an example the JsonToMapResponseConverter get the RowResponse.bodyBytes and convert them
to Map.
This class is a default implementation of the RestRequestExecutor, and uses
Client from the "http" library (link:https://pub.dev/packages/http) for request execution.
DefaultRestRequestExecutor supports regular Rest method requests and as well as multipart
requests, see MultipartRestRequestBody for multipart request example.
The descendant of this class can be used as a request or response middleware.
For the request middleware specify the R generic type as aRestRowRequest,
for the response middleware specify the R generic type as a RestRowResponse
After extending from the Middleware override the onNext async method
and implement your custom logic, after call the next method
This class is used to make a multipart request. The instance of this class
need to be passed to RestRequest.body.
This class also provides progressListener which can be used to track the progress.
This class is a base request converter definition, derive from this class
and implement the toRow method, which responsibility is to convert the
ApexRequest to RowResponse. The library ships with pre defined
request converters such as MapToJsonRequestConverter, which converts the
body Map provided by ApexRequest.body to JSON String.
This class is a base response converter definition, derive from this class
and implement the fromRow method, which responsibility is to convert the
RowResponse to ApexResponse. The library ships with pre defined
response converters such as JsonToMapResponseConverter, which converts the
received body bytes from RowResponse.bodyBytes to Map representation of
JSON result.
This abstract class is the main handler for http calls.
Derive from this class and implement the execute method, which receives
the RowRequest as an argument and returns RowResponse as a result.
The actual http call should happen in the execute method's body.
To create a RestClient instance, first and foremost you will need to provide an implementation of
RestRequestExecutor to RestClient.builder as shown in the example below.
This class represents the rest row response, which contains
original request, the response code, response body bytes bodyBytes,
headers, contentLength, and more meta info related to response.
The instance of RowResponse get passed throughout to response middlewares
and then to provided to RestResponseConverter from the ApexRequest's instance.
This class is a helper for URL path manipulations. It provides a way to keep
the base url, then add a request path to it and apply some query and path
params to it.
Here is the example usage of it.