toJson method

JsonMap toJson()

Implementation

JsonMap toJson() {
  final body = <String, Object?>{
    'model': model,
    if (mode != null && mode!.isNotEmpty) 'mode': mode,
    if (prompt != null && prompt!.isNotEmpty) 'prompt': prompt,
    if (imageUrls.isNotEmpty) 'image_urls': imageUrls,
    if (startFrame != null && startFrame!.isNotEmpty)
      'start_frame': startFrame,
    if (endFrame != null && endFrame!.isNotEmpty) 'end_frame': endFrame,
    if (videoUrls.isNotEmpty) 'video_urls': videoUrls,
    if (audioUrls.isNotEmpty) 'audio_urls': audioUrls,
    if (isPublic != null) 'is_public': isPublic,
    if (copyProtected != null) 'copy_protected': copyProtected,
    ...parameters,
  };
  for (final key in body.keys) {
    assertSupportedGenerationField(key);
  }
  return body;
}