GiphyContentRequest.fromJson constructor
Creates a GiphyContentRequest instance from a JSON object.
Implementation
factory GiphyContentRequest.fromJson(Map<Object?, Object?> json) {
return GiphyContentRequest(
mediaType:
GiphyMediaTypeExtension.fromStringValue(json['mediaType'] as String),
rating: json['rating'] != null
? GiphyRatingExtension.fromStringValue(json['rating'] as String)
: null,
requestType: GiphyContentRequestType.values.firstWhere(
(e) => e.toString().split('.').last == json['requestType'] as String?,
orElse: () => GiphyContentRequestType.trending,
),
searchQuery: json['searchQuery'] as String? ?? '',
);
}