VideoFilter constructor

  1. @Assert('limit <= 50', 'Limit cannot be greater than 50')
const VideoFilter({
  1. @JsonKey(name: 'channel_id', includeIfNull: false) String? channelId,
  2. @JsonKey(name: 'id', toJson: nullStringListIfEmpty, includeIfNull: false) @Default([]) List<String> ids,
  3. @JsonKey(toJson: concatIncludesList, name: 'include', includeIfNull: false) @Default([]) List<Includes> includes,
  4. @Default([]) @JsonKey(toJson: concatLanguageListWithDefault, name: 'lang') List<Language> languages,
  5. @JsonKey(toJson: intToString) @Default(25) int limit,
  6. @JsonKey(name: 'max_upcoming_hours', toJson: intToStringNullable, includeIfNull: false) int? maxUpcomingHours,
  7. @JsonKey(name: 'mentioned_channel_id', includeIfNull: false) String? mentionedChannelId,
  8. @JsonKey(toJson: intToString) @Default(0) int offset,
  9. @JsonKey(toJson: orderToString) @Default(Order.descending) Order order,
  10. @JsonKey(name: 'org', toJson: organizationToString, includeIfNull: false) Organization? organization,
  11. @JsonKey(toJson: paginatedToString) @Default(false) bool paginated,
  12. @JsonKey(toJson: concatVideoSortList, includeIfNull: false) @Default([VideoSort.availableAt]) List<VideoSort> sort,
  13. @JsonKey(toJson: concatVideoStatusList, includeIfNull: false) @Default([]) List<VideoStatus> status,
  14. @JsonKey(includeIfNull: false) String? topic,
  15. @JsonKey(toJson: videoTypeToString, includeIfNull: false) @JsonKey(includeIfNull: false) VideoType? type,
})

Filter the results returns by the Holodex API channel endpoints

Implementation

@Assert('limit <= 50', 'Limit cannot be greater than 50')
const factory VideoFilter({
  /// Filter by video uploader channel ID
  @JsonKey(name: 'channel_id', includeIfNull: false) String? channelId,

  /// Youtube Video IDs. If Specified, only this video can be returned (may be filtered out by other conditions though)
  @JsonKey(name: 'id', toJson: nullStringListIfEmpty, includeIfNull: false)
  @Default([])
  List<String> ids,

  /// Request extra data be included in the results. They are not guarenteed to be returned.
  @JsonKey(toJson: concatIncludesList, name: 'include', includeIfNull: false)
  @Default([])
  List<Includes> includes,

  /// Filter by the `Language`
  @Default([])
  @JsonKey(toJson: concatLanguageListWithDefault, name: 'lang')
  List<Language> languages,

  /// Limit the number of results returned. Maximum value of 50
  @JsonKey(toJson: intToString) @Default(25) int limit,

  /// Number of maximum hours upcoming to get upcoming videos by (for rejecting waiting rooms that are two years out)
  @JsonKey(
      name: 'max_upcoming_hours',
      toJson: intToStringNullable,
      includeIfNull: false)
  int? maxUpcomingHours,

  /// Filter by mentioned channel id, excludes itself. Generally used to find collabs/clips that include the requested channel
  @JsonKey(name: 'mentioned_channel_id', includeIfNull: false)
  String? mentionedChannelId,

  /// Receive results starting at this number in the array from the Holodex API
  @JsonKey(toJson: intToString) @Default(0) int offset,

  /// Order results by ascending or descending
  @JsonKey(toJson: orderToString) @Default(Order.descending) Order order,

  /// Filter by clips that feature the org's talent or videos posted by the org's talent.
  @JsonKey(name: 'org', toJson: organizationToString, includeIfNull: false)
  Organization? organization,

  /// If paginated is set to true, returns [PaginatedVideos] with total, otherwise returns [PaginatedVideos] without the total.
  @JsonKey(toJson: paginatedToString) @Default(false) bool paginated,

  /// Sort the returned data by this field
  @JsonKey(toJson: concatVideoSortList, includeIfNull: false)
  @Default([VideoSort.availableAt])
  List<VideoSort> sort,

  /// Filter by the video status
  @JsonKey(toJson: concatVideoStatusList, includeIfNull: false)
  @Default([])
  List<VideoStatus> status,

  /// Filter by video topic ID
  @JsonKey(includeIfNull: false) String? topic,

  /// Filter by type of video, either clips or streams
  @JsonKey(toJson: videoTypeToString, includeIfNull: false)
  @JsonKey(includeIfNull: false)
  VideoType? type,
}) = _VideoFilter;