SearchFilter constructor

  1. @Assert('limit <= 50', 'The limit cannot be greater than 50')
const SearchFilter({
  1. @JsonKey(name: 'sort', toJson: searchSortToString) @Default(SearchSort.newest) SearchSort sort,
  2. @JsonKey(toJson: languageListToStringList, name: 'lang') @Default([]) List<Language> languages,
  3. @Default([SearchTarget.clip, SearchTarget.stream]) @JsonKey(name: 'target', toJson: searchTargetToStringList) List<SearchTarget> targets,
  4. @JsonKey(name: 'topic') @Default([]) List<String> topics,
  5. @JsonKey(name: 'vch') @Default([]) List<String> videoChannels,
  6. @JsonKey(name: 'org', toJson: organizationListToStringList) @Default([]) List<Organization> organizations,
  7. @Default(true) bool paginated,
  8. @JsonKey(toJson: intToString) @Default(0) int offset,
  9. @JsonKey(toJson: intToString) @Default(25) int limit,
})

Filter the results returns by the Holodex API channel endpoints

Implementation

@Assert('limit <= 50', 'The limit cannot be greater than 50')
const factory SearchFilter({
  /// Sort by newest or oldest
  @JsonKey(name: 'sort', toJson: searchSortToString)
  @Default(SearchSort.newest)
  SearchSort sort,

  /// If set, will filter clips to only show clips with these languages + all vtuber streams
  /// (provided searchTargets is not set to filter out streams)
  @JsonKey(toJson: languageListToStringList, name: 'lang')
  @Default([])
  List<Language> languages,

  /// Target types of videos
  @Default([SearchTarget.clip, SearchTarget.stream])
  @JsonKey(name: 'target', toJson: searchTargetToStringList)
  List<SearchTarget> targets,

  /// Return videos that match one of the provided topics
  @JsonKey(name: 'topic') @Default([]) List<String> topics,

  /// Videos with all of the specified channel ids. If two or more channel IDs are specified,
  /// will only return their collabs, or if one channel is a clipper, it will only show clips
  /// of the other vtubers made by this clipper.
  @JsonKey(name: 'vch') @Default([]) List<String> videoChannels,

  /// Videos of channels in any of the specified organizations, or clips that involve a channel
  /// in the specified organization.
  @JsonKey(name: 'org', toJson: organizationListToStringList)
  @Default([])
  List<Organization> organizations,

  /// If paginated is set to true, returns [List]<[VideoFull]> with total, otherwise returns [List]<[VideoFull]> without the total.
  @Default(true) bool paginated,

  /// Offset results
  @JsonKey(toJson: intToString) @Default(0) int offset,

  /// Result limit
  @JsonKey(toJson: intToString) @Default(25) int limit,
}) = _SearchFilter;