Class LicenseApi

java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.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:
  • Constructor Details

    • LicenseApi

      public LicenseApi(GitLabApi gitLabApi)
  • Method Details

    • 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 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 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 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(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(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