searchFixtures method

Future<SearchFixturesResponse> searchFixtures({
  1. required DataSourceSport sport,
  2. required String startDate,
  3. String? endDate,
  4. List<SearchFilter>? filters,
  5. int? maxResults,
  6. String? nextToken,
})

Searches for the fixtures (sports events, such as a specific basketball game) that are available for a sport in a date window. Each fixture in the response includes a fixtureId that you specify in the clipping output of a feed, so that Elemental Inference maps the event data for that fixture onto the clipping metadata. This operation is paginated: if there are more fixtures than fit in one page, the response includes a nextToken that you pass in a subsequent request.

May throw AccessDeniedException. May throw GatewayTimedOutException. May throw InternalServerErrorException. May throw ServiceUnavailableException. May throw TooManyRequestException. May throw ValidationException.

Parameter sport : The sport to search for fixtures. Valid values: basketball (search for basketball fixtures), american-football (search for american-football fixtures).

Parameter startDate : The first day of the search window, in UTC. The search includes fixtures that are scheduled on this day.

Specify the date in ISO 8601 format, as YYYY-MM-DD. For example, 2026-03-14.

Parameter endDate : The last day of the search window, in UTC. The search includes fixtures that are scheduled on this day. Specify the date in ISO 8601 format, as YYYY-MM-DD.

If you omit this parameter, Elemental Inference searches only the day that you specified in startDate. The window from startDate through endDate must not exceed seven days.

Parameter filters : An array of filters that narrow the results. Each filter applies to one dimension of a fixture, such as the competitor. You can specify up to 10 filters.

A fixture must satisfy every filter in the array in order to appear in the results. Within one filter, a fixture must match at least one of the values.

Parameter maxResults : The maximum number of fixtures to return for each API request.

The service might return fewer fixtures than the maxResults value. When more fixtures match the search, the response also includes a nextToken value that you can use to fetch the next batch of results.

Parameter nextToken : The token that identifies the batch of results that you want to see.

For example, you submit a SearchFixtures request with maxResults set at 5. The service returns the first batch of results (up to 5) and a nextToken value. To see the next batch of results, you submit the SearchFixtures request a second time, with the same search criteria, and specify the nextToken value.

Implementation

Future<SearchFixturesResponse> searchFixtures({
  required DataSourceSport sport,
  required String startDate,
  String? endDate,
  List<SearchFilter>? filters,
  int? maxResults,
  String? nextToken,
}) async {
  final $payload = <String, dynamic>{
    'sport': sport.value,
    'startDate': startDate,
    if (endDate != null) 'endDate': endDate,
    if (filters != null) 'filters': filters,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/fixtures',
    exceptionFnMap: _exceptionFns,
  );
  return SearchFixturesResponse.fromJson(response);
}