Class LicenseApi

  • All Implemented Interfaces:
    Constants

    public class LicenseApi
    extends AbstractApi
    This class provides an entry point to all the GitLab API license calls.
    See Also:
    License API
    • Constructor Detail

      • LicenseApi

        public LicenseApi​(GitLabApi gitLabApi)
    • Method Detail

      • getLicense

        public License getLicense()
                           throws GitLabApiException
        Retrieve information about the current license.
        GitLab Endpoint: GET /license
        Returns:
        a License instance holding info about the current license
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalLicense

        public java.util.Optional<License> getOptionalLicense()
        Retrieve information about the current license as the value of an Optional.
        GitLab Endpoint: GET /license
        Returns:
        the current license as the value of an Optional.
      • getAllLicenses

        public java.util.List<License> getAllLicenses()
                                               throws GitLabApiException
        Retrieve information about all licenses.
        GitLab Endpoint: GET /licenses
        Returns:
        a List of License instances
        Throws:
        GitLabApiException - if any exception occurs
      • getAllLicensesStream

        public java.util.stream.Stream<License> getAllLicensesStream()
                                                              throws GitLabApiException
        Get a Stream of all licenses.
        GitLab Endpoint: GET /licenses
        Returns:
        a Stream of License instances
        Throws:
        GitLabApiException - if any exception occurs
      • getAllLicenses

        public Pager<License> getAllLicenses​(int itemsPerPage)
                                      throws GitLabApiException
        Get a Pager of all licenses.
        GitLab Endpoint: GET /licenses
        Parameters:
        itemsPerPage - the number of LicenseTemplate instances that will be fetched per page
        Returns:
        a Pager of license template
        Throws:
        GitLabApiException - if any exception occurs
      • addLicense

        public License addLicense​(java.lang.String licenseString)
                           throws GitLabApiException
        Add a new license.
        GitLab Endpoint: POST /license
        Parameters:
        licenseString - the license string for the license
        Returns:
        a License instance for the added license
        Throws:
        GitLabApiException - if any exception occurs
      • deleteLicense

        public License deleteLicense​(java.lang.Long licenseId)
                              throws GitLabApiException
        Deletes a license.
        GitLab Endpoint: DELETE /license/:id
        Parameters:
        licenseId - the ID of the license to delete
        Returns:
        a License instance for the delete license
        Throws:
        GitLabApiException - if any exception occurs