listPackageVersions method

Future<ListPackageVersionsResult> listPackageVersions({
  1. required String domain,
  2. required PackageFormat format,
  3. required String package,
  4. required String repository,
  5. String? domainOwner,
  6. int? maxResults,
  7. String? namespace,
  8. String? nextToken,
  9. PackageVersionOriginType? originType,
  10. PackageVersionSortType? sortBy,
  11. PackageVersionStatus? status,
})

Returns a list of PackageVersionSummary objects for package versions in a repository that match the request parameters. Package versions of all statuses will be returned by default when calling list-package-versions with no --status parameter.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter domain : The name of the domain that contains the repository that contains the requested package versions.

Parameter format : The format of the package versions you want to list.

Parameter package : The name of the package for which you want to request package versions.

Parameter repository : The name of the repository that contains the requested package versions.

Parameter domainOwner : The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

Parameter maxResults : The maximum number of results to return per page.

Parameter namespace : The namespace of the package that contains the requested package versions. The package component that specifies its namespace depends on its type. For example:

  • Maven
  • Swift
  • generic
  • The namespace of a Maven package version is its groupId.
  • The namespace of an npm or Swift package version is its scope.
  • The namespace of a generic package is its namespace.
  • Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.

Parameter nextToken : The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Parameter originType : The originType used to filter package versions. Only package versions with the provided originType will be returned.

Parameter sortBy : How to sort the requested list of package versions.

Parameter status : A string that filters the requested package versions by status.

Implementation

Future<ListPackageVersionsResult> listPackageVersions({
  required String domain,
  required PackageFormat format,
  required String package,
  required String repository,
  String? domainOwner,
  int? maxResults,
  String? namespace,
  String? nextToken,
  PackageVersionOriginType? originType,
  PackageVersionSortType? sortBy,
  PackageVersionStatus? status,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $query = <String, List<String>>{
    'domain': [domain],
    'format': [format.value],
    'package': [package],
    'repository': [repository],
    if (domainOwner != null) 'domain-owner': [domainOwner],
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (namespace != null) 'namespace': [namespace],
    if (nextToken != null) 'next-token': [nextToken],
    if (originType != null) 'originType': [originType.value],
    if (sortBy != null) 'sortBy': [sortBy.value],
    if (status != null) 'status': [status.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'POST',
    requestUri: '/v1/package/versions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListPackageVersionsResult.fromJson(response);
}