listTrainingPlans method

Future<ListTrainingPlansResponse> listTrainingPlans({
  1. List<TrainingPlanFilter>? filters,
  2. int? maxResults,
  3. String? nextToken,
  4. TrainingPlanSortBy? sortBy,
  5. TrainingPlanSortOrder? sortOrder,
  6. DateTime? startTimeAfter,
  7. DateTime? startTimeBefore,
})

Retrieves a list of training plans for the current account.

Parameter filters : Additional filters to apply to the list of training plans.

Parameter maxResults : The maximum number of results to return in the response.

Parameter nextToken : A token to continue pagination if more results are available.

Parameter sortBy : The training plan field to sort the results by (e.g., StartTime, Status).

Parameter sortOrder : The order to sort the results (Ascending or Descending).

Parameter startTimeAfter : Filter to list only training plans with an actual start time after this date.

Parameter startTimeBefore : Filter to list only training plans with an actual start time before this date.

Implementation

Future<ListTrainingPlansResponse> listTrainingPlans({
  List<TrainingPlanFilter>? filters,
  int? maxResults,
  String? nextToken,
  TrainingPlanSortBy? sortBy,
  TrainingPlanSortOrder? sortOrder,
  DateTime? startTimeAfter,
  DateTime? startTimeBefore,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListTrainingPlans'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
      if (startTimeAfter != null)
        'StartTimeAfter': unixTimestampToJson(startTimeAfter),
      if (startTimeBefore != null)
        'StartTimeBefore': unixTimestampToJson(startTimeBefore),
    },
  );

  return ListTrainingPlansResponse.fromJson(jsonResponse.body);
}