delete method

Future<DeleteContainerFileResponse> delete(
  1. String containerId,
  2. String fileId
)

Deletes a file from a container.

Parameters

  • containerId - The ID of the container.
  • fileId - The ID of the file.

Returns

A DeleteContainerFileResponse confirming the deletion.

Example

final result = await client.containers.files.delete(
  'container-abc123',
  'file-xyz789',
);
print('Deleted: ${result.deleted}');

Implementation

Future<DeleteContainerFileResponse> delete(
  String containerId,
  String fileId,
) async {
  ensureNotClosed?.call();
  final url = requestBuilder.buildUrl(
    '/containers/$containerId/files/$fileId',
  );
  final headers = requestBuilder.buildHeaders();
  final httpRequest = http.Request('DELETE', url)..headers.addAll(headers);
  final response = await interceptorChain.execute(httpRequest);
  return DeleteContainerFileResponse.fromJson(
    jsonDecode(response.body) as Map<String, dynamic>,
  );
}