uploadFiles method

Future<PlexApiResult> uploadFiles(
  1. String endpoint, {
  2. required Map<String, String> formData,
  3. required Map<String, File> files,
  4. Map<String, dynamic>? queryParams,
  5. Map<String, String>? headers,
  6. bool useFullUrl = false,
})

Makes a multipart POST request to the specified endpoint for uploading files

endpoint - The API endpoint (will be appended to the base URL) formData - Required form data for the multipart request files - Required map of file names to File objects to upload queryParams - Optional query parameters to append to the URL headers - Optional headers to include in the request useFullUrl - If true, endpoint is treated as a complete URL

Returns a Future<PlexApiResult> containing the response

Implementation

Future<PlexApiResult> uploadFiles(
  String endpoint, {
  required Map<String, String> formData,
  required Map<String, File> files,
  Map<String, dynamic>? queryParams,
  Map<String, String>? headers,
  bool useFullUrl = false,
}) async {
  final url = useFullUrl ? endpoint : endpoint;
  final response = await PlexNetworking.instance.postMultipart2(
    url,
    query: queryParams,
    headers: headers,
    formData: formData,
    files: files,
  );

  return _handleResponse(response);
}