listBotVersions method

Future<ListBotVersionsResponse> listBotVersions({
  1. required String botId,
  2. int? maxResults,
  3. String? nextToken,
  4. BotVersionSortBy? sortBy,
})

Gets information about all of the versions of a bot.

The ListBotVersions operation returns a summary of each version of a bot. For example, if a bot has three numbered versions, the ListBotVersions operation returns for summaries, one for each numbered version and one for the DRAFT version.

The ListBotVersions operation always returns at least one version, the DRAFT version.

May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter botId : The identifier of the bot to list versions for.

Parameter maxResults : The maximum number of versions to return in each page of results. If there are fewer results than the max page size, only the actual number of results are returned.

Parameter nextToken : If the response to the ListBotVersion operation contains more results than specified in the maxResults parameter, a token is returned in the response. Use that token in the nextToken parameter to return the next page of results.

Parameter sortBy : Specifies sorting parameters for the list of versions. You can specify that the list be sorted by version name in either ascending or descending order.

Implementation

Future<ListBotVersionsResponse> listBotVersions({
  required String botId,
  int? maxResults,
  String? nextToken,
  BotVersionSortBy? sortBy,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $payload = <String, dynamic>{
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
    if (sortBy != null) 'sortBy': sortBy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/bots/${Uri.encodeComponent(botId)}/botversions',
    exceptionFnMap: _exceptionFns,
  );
  return ListBotVersionsResponse.fromJson(response);
}