importBankStatementsWithHttpInfo method

Future<Response> importBankStatementsWithHttpInfo({
  1. required Object authorization,
  2. required File file,
})

Performs an HTTP 'POST /api/v1/BankStatements/import' operation and returns the Response. Parameters:

Implementation

Future<Response> importBankStatementsWithHttpInfo({
  required Object authorization,
  required File file,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/api/v1/BankStatements/import';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  headerParams[r'authorization'] = parameterToString(authorization);

  const contentTypes = <String>['multipart/form-data'];

  final mp = MultipartRequest('POST', Uri.parse(path));

  mp.files.add(
    MultipartFile(
      'file',
      file.readAsBytes().asStream(),
      file.lengthSync(),
      filename: basename(file.path),
    ),
  );

  postBody = mp;

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
    [],
  );
}