deleteMultiple method

Future<List<CloudflareHTTPResponse>> deleteMultiple({
  1. List<String>? ids,
  2. List<CloudflareImage>? images,
})

Deletes a list of images on Cloudflare Images. On success, all copies of the images are deleted and purged from Cache.

Implementation

Future<List<CloudflareHTTPResponse>> deleteMultiple({
  /// List of image identifiers
  List<String>? ids,

  /// List of images with their required identifiers
  List<CloudflareImage>? images,
}) async {
  assert(!isBasic, RestAPIService.authorizedRequestAssertMessage);
  assert((ids?.isNotEmpty ?? false) || (images?.isNotEmpty ?? false),
      'One of ids or images must not be empty.');

  ids ??= images?.map((image) => image.id).toList();

  List<CloudflareHTTPResponse> responses = [];
  for (final id in ids!) {
    final response = await delete(
      id: id,
    );
    responses.add(response);
  }
  return responses;
}