makeRequest<TResponse extends ResponseBase, TRequest extends RequestBase> method
Future<TResponse?>
makeRequest<TResponse extends ResponseBase, TRequest extends RequestBase>({
- required String url,
- required TRequest request,
- required TConfig config,
- required JsonDeserializer<
TResponse> fromJson, - ApiTimeoutHandler<
TResponse> ? onTimeout,
The underlying concrete implementation for making requests.
This method uses ApiRequest to execute the request and get a
TResponse from the url according to the config. The response will
is created by the fromJson deserializer. The authentication token is
injected by this API instance when the login and logout methods are
used for authenticating.
Implementation
Future<TResponse?> makeRequest<TResponse extends ResponseBase,
TRequest extends RequestBase>({
required String url,
required TRequest request,
required TConfig config,
required JsonDeserializer<TResponse> fromJson,
ApiTimeoutHandler<TResponse> onTimeout,
}) {
return ApiRequest<TRequest, TResponse>(
request: request,
httpClient: httpClient,
resolveUrl: config.resolveUrl,
requestConfig: ApiRequestConfig(
url: config.resolveUrl(url),
authCode: _authCode,
authToken: _authToken,
fromJson: fromJson,
)).getResponse().timeout(timeout, onTimeout: onTimeout);
}