Class LicenseTemplatesApi

java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.LicenseTemplatesApi
All Implemented Interfaces:
Constants

public class LicenseTemplatesApi extends AbstractApi
This class provides an entry point to all the GitLab API licenses calls.
See Also:
  • Constructor Details

    • LicenseTemplatesApi

      public LicenseTemplatesApi(GitLabApi gitLabApi)
  • Method Details

    • getLicenseTemplates

      public List<LicenseTemplate> getLicenseTemplates() throws GitLabApiException
      Get a List of all license templates.
      GitLab Endpoint: GET /templates/licenses
      Returns:
      a List of LicenseTemplate instances
      Throws:
      GitLabApiException - if any exception occurs
    • getLicenseTemplatesStream

      public Stream<LicenseTemplate> getLicenseTemplatesStream() throws GitLabApiException
      Get a Stream of all license templates.
      GitLab Endpoint: GET /templates/licenses
      Returns:
      a Stream of LicenseTemplate instances
      Throws:
      GitLabApiException - if any exception occurs
    • getLicenseTemplates

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

      public List<LicenseTemplate> getPopularLicenseTemplates() throws GitLabApiException
      Get a List of popular license templates.
      GitLab Endpoint: GET /templates/licenses?popular=true
      Returns:
      a List of popular LicenseTemplate instances
      Throws:
      GitLabApiException - if any exception occurs
    • getPopularLicenseTemplatesStream

      public Stream<LicenseTemplate> getPopularLicenseTemplatesStream() throws GitLabApiException
      Get a Stream of popular license templates.
      GitLab Endpoint: GET /templates/licenses?popular=true
      Returns:
      a Stream of popular LicenseTemplate instances
      Throws:
      GitLabApiException - if any exception occurs
    • getLicenseTemplates

      public Pager<LicenseTemplate> getLicenseTemplates(Boolean popular, int itemsPerPage) throws GitLabApiException
      Get a Pager of license templates.
      GitLab Endpoint: GET /templates/licenses
      Parameters:
      popular - if true, returns only popular licenses.
      itemsPerPage - the number of LicenseTemplate instances that will be fetched per page
      Returns:
      a Pager of LicenseTemplate instances
      Throws:
      GitLabApiException - if any exception occurs
    • getLicenseTemplate

      public LicenseTemplate getLicenseTemplate(String key) throws GitLabApiException
      Get a single license template.
      GitLab Endpoint: GET /templates/licenses/:key
      Parameters:
      key - The key of the license template
      Returns:
      a LicenseTemplate instance
      Throws:
      GitLabApiException - if any exception occurs
    • getOptionalLicenseTemplate

      public Optional<LicenseTemplate> getOptionalLicenseTemplate(String key)
      Get a single license template as the value of an Optional.
      GitLab Endpoint: GET /templates/licenses/:key
      Parameters:
      key - The key of the license template
      Returns:
      a single license template as the value of an Optional.