:doc:`CodeArtifact <../../codeartifact>` / Client / list_package_versions

*********************
list_package_versions
*********************



.. py:method:: CodeArtifact.Client.list_package_versions(**kwargs)

  

  Returns a list of `PackageVersionSummary <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html>`__ 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.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/codeartifact-2018-09-22/ListPackageVersions>`_  


  **Request Syntax**
  ::

    response = client.list_package_versions(
        domain='string',
        domainOwner='string',
        repository='string',
        format='npm'|'pypi'|'maven'|'nuget'|'generic'|'ruby'|'swift'|'cargo',
        namespace='string',
        package='string',
        status='Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted',
        sortBy='PUBLISHED_TIME',
        maxResults=123,
        nextToken='string',
        originType='INTERNAL'|'EXTERNAL'|'UNKNOWN'
    )
    
  :type domain: string
  :param domain: **[REQUIRED]** 

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

    

  
  :type domainOwner: string
  :param domainOwner: 

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

    

  
  :type repository: string
  :param repository: **[REQUIRED]** 

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

    

  
  :type format: string
  :param format: **[REQUIRED]** 

    The format of the package versions you want to list.

    

  
  :type namespace: string
  :param 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:

     

    .. note::

      

      The namespace is required when deleting package versions of the following formats:

       

      
      * 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.
    

    

  
  :type package: string
  :param package: **[REQUIRED]** 

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

    

  
  :type status: string
  :param status: 

    A string that filters the requested package versions by status.

    

  
  :type sortBy: string
  :param sortBy: 

    How to sort the requested list of package versions.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return per page.

    

  
  :type nextToken: string
  :param 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.

    

  
  :type originType: string
  :param originType: 

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

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'defaultDisplayVersion': 'string',
          'format': 'npm'|'pypi'|'maven'|'nuget'|'generic'|'ruby'|'swift'|'cargo',
          'namespace': 'string',
          'package': 'string',
          'versions': [
              {
                  'version': 'string',
                  'revision': 'string',
                  'status': 'Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted',
                  'origin': {
                      'domainEntryPoint': {
                          'repositoryName': 'string',
                          'externalConnectionName': 'string'
                      },
                      'originType': 'INTERNAL'|'EXTERNAL'|'UNKNOWN'
                  }
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **defaultDisplayVersion** *(string) --* 

        The default package version to display. This depends on the package format:

         

        
        * For Maven and PyPI packages, it's the most recently published package version.
         
        * For npm packages, it's the version referenced by the ``latest`` tag. If the ``latest`` tag is not set, it's the most recently published package version.
        

        
      

      - **format** *(string) --* 

        A format of the package.

        
      

      - **namespace** *(string) --* 

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

         

        
        * 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.
        

        
      

      - **package** *(string) --* 

        The name of the package.

        
      

      - **versions** *(list) --* 

        The returned list of `PackageVersionSummary <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html>`__ objects.

        
        

        - *(dict) --* 

          Details about a package version, including its status, version, and revision. The `ListPackageVersions <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListPackageVersions.html>`__ operation returns a list of ``PackageVersionSummary`` objects.

          
          

          - **version** *(string) --* 

            Information about a package version.

            
          

          - **revision** *(string) --* 

            The revision associated with a package version.

            
          

          - **status** *(string) --* 

            A string that contains the status of the package version. It can be one of the following:

            
          

          - **origin** *(dict) --* 

            A `PackageVersionOrigin <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionOrigin.html>`__ object that contains information about how the package version was added to the repository.

            
            

            - **domainEntryPoint** *(dict) --* 

              A `DomainEntryPoint <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DomainEntryPoint.html>`__ object that contains information about from which repository or external connection the package version was added to the domain.

              
              

              - **repositoryName** *(string) --* 

                The name of the repository that a package was originally published to.

                
              

              - **externalConnectionName** *(string) --* 

                The name of the external connection that a package was ingested from.

                
          
            

            - **originType** *(string) --* 

              Describes how the package version was originally added to the domain. An ``INTERNAL`` origin type means the package version was published directly to a repository in the domain. An ``EXTERNAL`` origin type means the package version was ingested from an external connection.

              
        
      
    
      

      - **nextToken** *(string) --* 

        If there are additional results, this is the token for the next set of results.

        
  
  **Exceptions**
  
  *   :py:class:`CodeArtifact.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.InternalServerException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.ThrottlingException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.ValidationException`

  