getAll method

Future<CloudflareHTTPResponse<List<CloudflareStreamVideo>?>> getAll({
  1. DateTime? after,
  2. DateTime? before,
  3. String? creator,
  4. bool? includeCounts,
  5. String? search,
  6. int? limit,
  7. bool? asc,
  8. List<MediaProcessingState>? status,
})

Up to 1000 videos can be listed with one request, use optional parameters to get a specific range of videos. Please note that Cloudflare Stream does not use pagination, instead it uses a cursor pattern to list more than 1000 videos. In order to list all videos, make multiple requests to the API using the created date-time of the last item in the previous request as the before or after parameter.

Documentation: https://api.cloudflare.com/#stream-videos-list-videos

Implementation

Future<CloudflareHTTPResponse<List<CloudflareStreamVideo>?>> getAll({
  /// Show videos created after this date-time
  /// Using  ISO 8601 ZonedDateTime
  ///
  /// e.g: "2014-01-02T02:20:00Z"
  DateTime? after,

  /// Show videos created before this date-time
  /// Using  ISO 8601 ZonedDateTime
  ///
  /// e.g: "2014-01-02T02:20:00Z"
  DateTime? before,

  /// Filter by user-defined identifier of the media creator
  ///
  /// Max length: 64
  /// e.g: "creator-id_abcde12345"
  String? creator,

  /// Include stats in the response about the number of videos in response
  /// range and total number of videos available
  ///
  /// default value: false
  bool? includeCounts,

  /// A string provided in this field will be used to search over the 'name'
  /// key in meta field, which can be set with the upload request of after.
  ///
  /// e.g: "puppy.mp4"
  String? search,

  /// Number of videos to include in the response
  ///
  /// min value:0
  /// max value:1000
  int? limit,

  /// List videos in ascending order of creation
  ///
  /// default value: false
  bool? asc,

  /// Filter by statuses
  ///
  /// e.g:
  /// [
  ///   MediaProcessingState.downloading,
  ///   MediaProcessingState.queued,
  ///   MediaProcessingState.inprogress,
  ///   MediaProcessingState.ready,
  ///   MediaProcessingState.error
  /// ]
  List<MediaProcessingState>? status,
}) async {
  assert(!isBasic, RestAPIService.authorizedRequestAssertMessage);
  final response = await parseResponseAsList(service.getAll(
    after: after?.toJson(),
    before: before?.toJson(),
    creator: creator,
    includeCounts: includeCounts,
    search: search,
    limit: limit,
    asc: asc,
    status: status?.map((e) => e.name).toList(),
  ));

  return response;
}