FileObject.fromAnthropic constructor

FileObject.fromAnthropic(
  1. Map<String, dynamic> json
)

Create from Anthropic file format

Implementation

factory FileObject.fromAnthropic(Map<String, dynamic> json) {
  return FileObject(
    id: json['id'] as String,
    sizeBytes: json['size_bytes'] as int,
    createdAt: DateTime.parse(json['created_at'] as String),
    filename: json['filename'] as String,
    object: json['type'] as String? ?? 'file',
    mimeType: json['mime_type'] as String?,
    downloadable: json['downloadable'] as bool?,
    metadata: {'provider': 'anthropic'},
  );
}