Class PackagesApi

  • All Implemented Interfaces:
    Constants

    public class PackagesApi
    extends AbstractApi

    This class implements the client side API for the GitLab Packages API. See Packages API at GitLab for more information.

    NOTE: This API is not available in the Community edition of GitLab.
    • Constructor Detail

      • PackagesApi

        public PackagesApi​(GitLabApi gitLabApi)
    • Method Detail

      • getPackages

        public java.util.List<Package> getPackages​(java.lang.Object projectIdOrPath)
                                            throws GitLabApiException
        Get a list of project packages. Both Maven and NPM packages are included in results. When accessed without authentication, only packages of public projects are returned.
        GitLab Endpoint: GET /projects/:id/packages
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of pages in the project's packages
        Throws:
        GitLabApiException - if any exception occurs
      • getPackages

        public java.util.List<Package> getPackages​(java.lang.Object projectIdOrPath,
                                                   int page,
                                                   int perPage)
                                            throws GitLabApiException
        Get a list of project packages for the specified page. Both Maven and NPM packages are included in results. When accessed without authentication, only packages of public projects are returned.
        GitLab Endpoint: GET /projects/:id/packages
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        page - the page to get
        perPage - the number of Package instances per page
        Returns:
        a list of project packages for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPackages

        public Pager<Package> getPackages​(java.lang.Object projectIdOrPath,
                                          int itemsPerPage)
                                   throws GitLabApiException
        Get a Pager of project packages. Both Maven and NPM packages are included in results. When accessed without authentication, only packages of public projects are returned.
        GitLab Endpoint: GET /projects/:id/packages
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        itemsPerPage - the number of Package instances per page
        Returns:
        a Pager of project packages for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPackages

        public Pager<Package> getPackages​(java.lang.Object projectIdOrPath,
                                          PackageFilter filter,
                                          int itemsPerPage)
                                   throws GitLabApiException
        Get a Pager of project packages. Both Maven and NPM packages are included in results. When accessed without authentication, only packages of public projects are returned.
        GitLab Endpoint: GET /projects/:id/packages
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        filter - the PackageFilter instance holding the filter values for the query
        itemsPerPage - the number of Package instances per page
        Returns:
        a Pager of project packages for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPackagesStream

        public java.util.stream.Stream<Package> getPackagesStream​(java.lang.Object projectIdOrPath)
                                                           throws GitLabApiException
        Get a Stream of project packages. Both Maven and NPM packages are included in results. When accessed without authentication, only packages of public projects are returned.
        GitLab Endpoint: GET /projects/:id/packages
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a Stream of pages in the project's packages
        Throws:
        GitLabApiException - if any exception occurs
      • getPackagesStream

        public java.util.stream.Stream<Package> getPackagesStream​(java.lang.Object projectIdOrPath,
                                                                  PackageFilter filter)
                                                           throws GitLabApiException
        Get a Stream of project packages. Both Maven and NPM packages are included in results. When accessed without authentication, only packages of public projects are returned.
        GitLab Endpoint: GET /projects/:id/packages
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        filter - the PackageFilter instance holding the filter values for the query
        Returns:
        a Stream of pages in the project's packages
        Throws:
        GitLabApiException - if any exception occurs
      • getPackage

        public Package getPackage​(java.lang.Object projectIdOrPath,
                                  java.lang.Long packageId)
                           throws GitLabApiException
        Get a single project package.
        GitLab Endpoint: GET /projects/:id/packages/:package_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        packageId - the ID of the package to get
        Returns:
        a Package instance for the specified package ID
        Throws:
        GitLabApiException - if any exception occurs
      • getPackageFiles

        public java.util.List<PackageFile> getPackageFiles​(java.lang.Object projectIdOrPath,
                                                           java.lang.Long packageId)
                                                    throws GitLabApiException
        Get a list of package files of a single package.
        GitLab Endpoint: GET /projects/:id/packages/:package_id/package_files
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        packageId - the ID of the package to get the package files for
        Returns:
        a list of PackageFile instances for the specified package ID
        Throws:
        GitLabApiException - if any exception occurs
      • getPackageFiles

        public java.util.List<PackageFile> getPackageFiles​(java.lang.Object projectIdOrPath,
                                                           java.lang.Long packageId,
                                                           int page,
                                                           int perPage)
                                                    throws GitLabApiException
        Get a list of package files of a single package for the specified page.
        GitLab Endpoint: GET /projects/:id/packages/:package_id/package_files
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        packageId - the ID of the package to get the package files for
        page - the page to get
        perPage - the number of PackageFile instances per page
        Returns:
        a list of PackageFile instances for the specified package ID
        Throws:
        GitLabApiException - if any exception occurs
      • getPackageFiles

        public Pager<PackageFile> getPackageFiles​(java.lang.Object projectIdOrPath,
                                                  java.lang.Long packageId,
                                                  int itemsPerPage)
                                           throws GitLabApiException
        Get a Pager of project package files.
        GitLab Endpoint: GET /projects/:id/packages/:package_id/package_files
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        packageId - the ID of the package to get the package files for
        itemsPerPage - the number of PackageFile instances per page
        Returns:
        a Pager of PackageFile instances for the specified package ID
        Throws:
        GitLabApiException - if any exception occurs
      • getPackagesStream

        public java.util.stream.Stream<PackageFile> getPackagesStream​(java.lang.Object projectIdOrPath,
                                                                      java.lang.Long packageId)
                                                               throws GitLabApiException
        Get a Stream of project package files.
        GitLab Endpoint: GET /projects/:id/packages/:package_id/package_files
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        packageId - the ID of the package to get the package files for
        Returns:
        a Stream of PackageFile instances for the specified package ID
        Throws:
        GitLabApiException - if any exception occurs
      • deletePackage

        public void deletePackage​(java.lang.Object projectIdOrPath,
                                  java.lang.Long packageId)
                           throws GitLabApiException
        Deletes a project package.
        GitLab Endpoint: DELETE /projects/:id/packages/:package_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        packageId - the ID of the package to delete
        Throws:
        GitLabApiException - if any exception occurs