toJson method
Converts to JSON.
Implementation
Map<String, dynamic> toJson() => {
'id': id,
'object': object,
'created_at': createdAt,
'thread_id': threadId,
if (status != null) 'status': status!.toJson(),
if (incompleteDetails != null)
'incomplete_details': incompleteDetails!.toJson(),
if (completedAt != null) 'completed_at': completedAt,
if (incompleteAt != null) 'incomplete_at': incompleteAt,
'role': role,
'content': content.map((c) => c.toJson()).toList(),
if (assistantId != null) 'assistant_id': assistantId,
if (runId != null) 'run_id': runId,
'attachments': attachments.map((a) => a.toJson()).toList(),
'metadata': metadata,
};