fromJson static method
Returns a new FederatedSearchRequest instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static FederatedSearchRequest? 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(() {
assert(json.containsKey(r'query'), 'Required key "FederatedSearchRequest[query]" is missing from JSON.');
assert(json[r'query'] != null, 'Required key "FederatedSearchRequest[query]" has a null value in JSON.');
return true;
}());
return FederatedSearchRequest(
query: mapValueOfType<String>(json, r'query')!,
platforms: FederatedSearchRequestPlatformsEnum.listFromJson(json[r'platforms']),
limit: mapValueOfType<int>(json, r'limit') ?? 25,
pageTokens: mapCastOfType<String, String>(json, r'page_tokens') ?? const {},
workspaceId: mapValueOfType<String>(json, r'workspace_id'),
organizationId: mapValueOfType<String>(json, r'organization_id'),
includeShared: mapValueOfType<bool>(json, r'include_shared'),
includeArchived: mapValueOfType<bool>(json, r'include_archived'),
);
}
return null;
}