createJobUploadWithHttpInfo method

Future<Response> createJobUploadWithHttpInfo(
  1. MultipartFile file, {
  2. bool? dedup,
  3. String? metadata,
})

Create bulk validation job (file upload)

Create a new bulk validation job by uploading a CSV, Excel, or TXT file.

Note: This method returns the HTTP Response.

Parameters:

  • MultipartFile file (required): CSV, Excel (.xlsx, .xls), ODS, or TXT file

  • bool dedup: Remove duplicate emails

  • String metadata: JSON metadata for the job

Implementation

Future<Response> createJobUploadWithHttpInfo(MultipartFile file, { bool? dedup, String? metadata, }) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/jobs/upload';

  // ignore: prefer_final_locals
  Object? postBody;

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

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

  bool hasFields = false;
  final mp = MultipartRequest('POST', Uri.parse(path));
  if (file != null) {
    hasFields = true;
    mp.fields[r'file'] = file.field;
    mp.files.add(file);
  }
  if (dedup != null) {
    hasFields = true;
    mp.fields[r'dedup'] = parameterToString(dedup);
  }
  if (metadata != null) {
    hasFields = true;
    mp.fields[r'metadata'] = parameterToString(metadata);
  }
  if (hasFields) {
    postBody = mp;
  }

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