deliveryBatchZip static method

ChartExportFile deliveryBatchZip(
  1. ChartExportDeliveryBatchResult batch, {
  2. String filename = defaultDeliveryFilename,
  3. bool includeManifest = true,
  4. String manifestFilename = defaultManifestFilename,
  5. DateTime? createdAt,
})

Bundle successfully delivered files into a ZIP file.

Failed delivery results are not written as payload files, but they remain visible in the optional manifest so callers can inspect partial failures.

Implementation

static ChartExportFile deliveryBatchZip(
  ChartExportDeliveryBatchResult batch, {
  String filename = defaultDeliveryFilename,
  bool includeManifest = true,
  String manifestFilename = defaultManifestFilename,
  DateTime? createdAt,
}) {
  final files = <ChartExportFile>[...batch.files];

  if (includeManifest) {
    files.add(
      ChartExportManifest.deliveryBatchFile(
        batch,
        filename: manifestFilename,
        createdAt: createdAt,
      ),
    );
  }

  return filesZip(
    files,
    filename: filename,
    metadata: {
      'source': 'deliveryBatch',
      'sourceSuccess': batch.success,
      'sourceCount': batch.results.length,
      'sourceSuccessCount': batch.successCount,
      'sourceFailureCount': batch.failureCount,
      'includedManifest': includeManifest,
    },
  );
}