toQueryParameters method
Converts these parameters to a map for use in query parameters.
Implementation
@override
Map<String, dynamic> toQueryParameters() {
final params = super.toQueryParameters();
if (id != null) params['id'] = id.toString();
if (username != null) params['username'] = username;
if (nsfw != null) params['nsfw'] = nsfw!.toString();
if (primaryFileOnly != null) {
params['primaryFileOnly'] = primaryFileOnly.toString();
}
if (favorites != null) params['favorites'] = favorites.toString();
if (hidden != null) params['hidden'] = hidden.toString();
if (types != null && types!.isNotEmpty) {
params['types'] = types!.map((t) => t.toJson()).join(',');
}
if (baseModels != null && baseModels!.isNotEmpty) {
params['baseModels'] = baseModels!.map((bm) => bm.toJson()).join(',');
}
if (sort != null) params['sort'] = sort!.toJson();
if (period != null) params['period'] = period!.toJson();
if (tags != null && tags!.isNotEmpty) {
params['tags'] = tags!.map((id) => id.toString()).join(',');
}
if (browsingLevel != null) {
params['browsingLevel'] = browsingLevel.toString();
}
if (earlyAccess != null) params['earlyAccess'] = earlyAccess.toString();
if (query != null) params['query'] = query;
if (supportsGeneration != null) {
params['supportsGeneration'] = supportsGeneration.toString();
}
if (archived != null) params['archived'] = archived.toString();
return params;
}