importBankConnection method
- required ImportBankConnectionRequestModel importBankConnectionRequestModel,
- CancelToken? cancelToken,
- Map<
String, dynamic> ? headers, - Map<
String, dynamic> ? extra, - ValidateStatus? validateStatus,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
Import a Bank connection. The given <code>bankId</code> will be imported to the server. This endpoint returns a link that the user can use to log in. This allows the user to import the accounts.
Parameters:
importBankConnectionRequestModel
- Import Bank parameterscancelToken
- A CancelToken that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- A ValidateStatus callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- A ProgressCallback that can be used to get the send progressonReceiveProgress
- A ProgressCallback that can be used to get the receive progress
Returns a Future containing a Response with a ImportBankConnectionResponseModel as data Throws DioException if API call or serialization fails
Implementation
Future<Response<ImportBankConnectionResponseModel>> importBankConnection({
required ImportBankConnectionRequestModel importBankConnectionRequestModel,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/bankmanagement/importBankConnection';
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'oauth2',
'name': 'ApiOAuth2',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
const _type = FullType(ImportBankConnectionRequestModel);
_bodyData = _serializers.serialize(importBankConnectionRequestModel, specifiedType: _type);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
ImportBankConnectionResponseModel? _responseData;
try {
final rawResponse = _response.data;
_responseData = rawResponse == null ? null : _serializers.deserialize(
rawResponse,
specifiedType: const FullType(ImportBankConnectionResponseModel),
) as ImportBankConnectionResponseModel;
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<ImportBankConnectionResponseModel>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}