fromJson static method
Returns a new PostsUpdate instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static PostsUpdate? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
return true;
}());
return PostsUpdate(
userId: mapValueOfType<String>(json, r'user_id'),
companyId: mapValueOfType<String>(json, r'company_id'),
title: mapValueOfType<String>(json, r'title'),
category: mapValueOfType<String>(json, r'category'),
teaser: mapValueOfType<String>(json, r'teaser'),
contentHtml: mapValueOfType<String>(json, r'content_html'),
insightsUsed: mapValueOfType<Object>(json, r'insights_used'),
generationCreativity: mapValueOfType<int>(json, r'generation_creativity'),
generationTargetWordCount: mapValueOfType<int>(json, r'generation_target_word_count'),
generationTone: mapValueOfType<String>(json, r'generation_tone'),
generationIncludeCitations: mapValueOfType<bool>(json, r'generation_include_citations'),
generationSubheadingCount: mapValueOfType<int>(json, r'generation_subheading_count'),
generationTemperature: mapValueOfType<double>(json, r'generation_temperature'),
dataCostCredits: mapValueOfType<int>(json, r'data_cost_credits'),
serviceCostCredits: mapValueOfType<int>(json, r'service_cost_credits'),
totalCostCredits: mapValueOfType<int>(json, r'total_cost_credits'),
successfulInsightsCount: mapValueOfType<int>(json, r'successful_insights_count'),
failedInsightsCount: mapValueOfType<int>(json, r'failed_insights_count'),
generationTimeMs: mapValueOfType<int>(json, r'generation_time_ms'),
isPublished: mapValueOfType<bool>(json, r'is_published'),
publishedAt: mapDateTime(json, r'published_at', r''),
viewCount: mapValueOfType<int>(json, r'view_count'),
lastEditedAt: mapDateTime(json, r'last_edited_at', r''),
);
}
return null;
}