Class GitLabApiClient

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class GitLabApiClient
    extends java.lang.Object
    implements java.lang.AutoCloseable
    This class utilizes the Jersey client package to communicate with a GitLab API endpoint.
    • Constructor Summary

      Constructors 
      Constructor Description
      GitLabApiClient​(java.lang.String hostUrl, java.lang.String privateToken)
      Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
      GitLabApiClient​(java.lang.String hostUrl, java.lang.String privateToken, java.lang.String secretToken)
      Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
      GitLabApiClient​(java.lang.String hostUrl, java.lang.String privateToken, java.lang.String secretToken, java.util.Map<java.lang.String,​java.lang.Object> clientConfigProperties)
      Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL and private token.
      GitLabApiClient​(java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken)
      Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
      GitLabApiClient​(java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.String secretToken)
      Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
      GitLabApiClient​(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, java.lang.String privateToken)
      Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, private token, and secret token.
      GitLabApiClient​(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, java.lang.String privateToken, java.lang.String secretToken)
      Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, private token, and secret token.
      GitLabApiClient​(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, java.lang.String privateToken, java.lang.String secretToken, java.util.Map<java.lang.String,​java.lang.Object> clientConfigProperties)
      Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL and private token.
      GitLabApiClient​(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken)
      Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, auth token type, private or access token, and secret token.
      GitLabApiClient​(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.String secretToken)
      Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, private token, and secret token.
      GitLabApiClient​(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.String secretToken, java.util.Map<java.lang.String,​java.lang.Object> clientConfigProperties)
      Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL and private token.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the underlying Client and its associated resources.
      protected jakarta.ws.rs.client.Client createApiClient()  
      protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.Object... pathArgs)
      Perform an HTTP DELETE call with the specified form data and path objects, returning a Response instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url)
      Perform an HTTP DELETE call with the specified form data and URL, returning a Response instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.Object... pathArgs)
      Perform an HTTP GET call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url)
      Perform an HTTP GET call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected java.net.URL getApiUrl​(java.lang.Object... pathArgs)
      Construct a REST URL with the specified path arguments.
      boolean getIgnoreCertificateErrors()
      Returns true if the API is setup to ignore SSL certificate errors, otherwise returns false.
      protected java.net.URL getUrlWithBase​(java.lang.Object... pathArgs)
      Construct a REST URL with the specified path arguments using Gitlab base url.
      protected jakarta.ws.rs.core.Response getWithAccepts​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.String accepts, java.lang.Object... pathArgs)
      Perform an HTTP GET call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response getWithAccepts​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url, java.lang.String accepts)
      Perform an HTTP GET call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response head​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.Object... pathArgs)
      Perform an HTTP HEAD call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response head​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url)
      Perform an HTTP HEAD call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.client.Invocation.Builder invocation​(java.net.URL url, jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams)  
      protected jakarta.ws.rs.client.Invocation.Builder invocation​(java.net.URL url, jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.String accept)  
      protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.Object... pathArgs)
      Perform an HTTP PATCH call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url)
      Perform an HTTP PATCH call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Form formData, java.lang.Object... pathArgs)
      Perform an HTTP POST call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Form formData, java.net.URL url)
      Perform an HTTP POST call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.Object... pathArgs)
      Perform an HTTP POST call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url)
      Perform an HTTP POST call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.StreamingOutput stream, java.lang.String mediaType, java.lang.Object... pathArgs)
      Perform an HTTP POST call with the specified StreamingOutput, MediaType, and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response post​(java.lang.Object payload, java.lang.Object... pathArgs)
      Perform an HTTP POST call with the specified payload object and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Form formData, java.lang.Object... pathArgs)
      Perform an HTTP PUT call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Form formData, java.net.URL url)
      Perform an HTTP PUT call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.lang.Object... pathArgs)
      Perform an HTTP PUT call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams, java.net.URL url)
      Perform an HTTP PUT call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response put​(java.lang.Object payload, java.lang.Object... pathArgs)
      Perform an HTTP PUT call with the specified payload object and URL, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response putUpload​(java.lang.String name, java.io.File fileToUpload, java.lang.Object... pathArgs)
      Perform a file upload using multipart/form-data using the HTTP PUT method, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response putUpload​(java.lang.String name, java.io.File fileToUpload, java.net.URL url)
      Perform a file upload using multipart/form-data using the HTTP PUT method, returning a ClientResponse instance with the data returned from the endpoint.
      void setAuthTokenSupplier​(java.util.function.Supplier<java.lang.String> authTokenSupplier)
      Set auth token supplier for gitlab api client.
      void setIgnoreCertificateErrors​(boolean ignoreCertificateErrors)
      Sets up the Jersey system ignore SSL certificate errors or not.
      protected jakarta.ws.rs.core.Response upload​(java.lang.String name, java.io.File fileToUpload, java.lang.String mediaTypeString, jakarta.ws.rs.core.Form formData, java.lang.Object... pathArgs)
      Perform a file upload using the specified media type, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response upload​(java.lang.String name, java.io.File fileToUpload, java.lang.String mediaTypeString, jakarta.ws.rs.core.Form formData, java.net.URL url)
      Perform a file upload using multipart/form-data, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response upload​(java.lang.String name, java.io.File fileToUpload, java.lang.String mediaTypeString, java.lang.Object... pathArgs)
      Perform a file upload using the specified media type, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response upload​(java.lang.String name, java.io.InputStream inputStream, java.lang.String filename, java.lang.String mediaTypeString, jakarta.ws.rs.core.Form formData, java.net.URL url)  
      protected jakarta.ws.rs.core.Response upload​(java.lang.String name, java.io.InputStream inputStream, java.lang.String filename, java.lang.String mediaTypeString, java.lang.Object... pathArgs)  
      protected jakarta.ws.rs.core.Response upload​(org.glassfish.jersey.media.multipart.BodyPart bodyPart, jakarta.ws.rs.core.Form formData, java.net.URL url)  
      protected boolean validateSecretToken​(jakarta.ws.rs.core.Response response)
      Validates the secret token (X-GitLab-Token) header against the expected secret token, returns true if valid, otherwise returns false.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PRIVATE_TOKEN_HEADER

        protected static final java.lang.String PRIVATE_TOKEN_HEADER
        See Also:
        Constant Field Values
      • AUTHORIZATION_HEADER

        protected static final java.lang.String AUTHORIZATION_HEADER
        See Also:
        Constant Field Values
      • X_GITLAB_TOKEN_HEADER

        protected static final java.lang.String X_GITLAB_TOKEN_HEADER
        See Also:
        Constant Field Values
    • Constructor Detail

      • GitLabApiClient

        public GitLabApiClient​(GitLabApi.ApiVersion apiVersion,
                               java.lang.String hostUrl,
                               java.lang.String privateToken)
        Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, private token, and secret token.
        Parameters:
        apiVersion - the ApiVersion specifying which version of the API to use
        hostUrl - the URL to the GitLab API server
        privateToken - the private token to authenticate with
      • GitLabApiClient

        public GitLabApiClient​(GitLabApi.ApiVersion apiVersion,
                               java.lang.String hostUrl,
                               Constants.TokenType tokenType,
                               java.lang.String authToken)
        Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, auth token type, private or access token, and secret token.
        Parameters:
        apiVersion - the ApiVersion specifying which version of the API to use
        hostUrl - the URL to the GitLab API server
        tokenType - the type of auth the token is for, PRIVATE or ACCESS
        authToken - the token to authenticate with
      • GitLabApiClient

        public GitLabApiClient​(java.lang.String hostUrl,
                               java.lang.String privateToken)
        Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
        Parameters:
        hostUrl - the URL to the GitLab API server
        privateToken - the private token to authenticate with
      • GitLabApiClient

        public GitLabApiClient​(java.lang.String hostUrl,
                               Constants.TokenType tokenType,
                               java.lang.String authToken)
        Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
        Parameters:
        hostUrl - the URL to the GitLab API server
        tokenType - the type of auth the token is for, PRIVATE or ACCESS
        authToken - the token to authenticate with
      • GitLabApiClient

        public GitLabApiClient​(GitLabApi.ApiVersion apiVersion,
                               java.lang.String hostUrl,
                               java.lang.String privateToken,
                               java.lang.String secretToken)
        Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, private token, and secret token.
        Parameters:
        apiVersion - the ApiVersion specifying which version of the API to use
        hostUrl - the URL to the GitLab API server
        privateToken - the private token to authenticate with
        secretToken - use this token to validate received payloads
      • GitLabApiClient

        public GitLabApiClient​(GitLabApi.ApiVersion apiVersion,
                               java.lang.String hostUrl,
                               Constants.TokenType tokenType,
                               java.lang.String authToken,
                               java.lang.String secretToken)
        Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL, private token, and secret token.
        Parameters:
        apiVersion - the ApiVersion specifying which version of the API to use
        hostUrl - the URL to the GitLab API server
        tokenType - the type of auth the token is for, PRIVATE or ACCESS
        authToken - the token to authenticate with
        secretToken - use this token to validate received payloads
      • GitLabApiClient

        public GitLabApiClient​(java.lang.String hostUrl,
                               java.lang.String privateToken,
                               java.lang.String secretToken)
        Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
        Parameters:
        hostUrl - the URL to the GitLab API server
        privateToken - the private token to authenticate with
        secretToken - use this token to validate received payloads
      • GitLabApiClient

        public GitLabApiClient​(java.lang.String hostUrl,
                               Constants.TokenType tokenType,
                               java.lang.String authToken,
                               java.lang.String secretToken)
        Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL, private token, and secret token.
        Parameters:
        hostUrl - the URL to the GitLab API server
        tokenType - the type of auth the token is for, PRIVATE or ACCESS
        authToken - the token to authenticate with
        secretToken - use this token to validate received payloads
      • GitLabApiClient

        public GitLabApiClient​(java.lang.String hostUrl,
                               java.lang.String privateToken,
                               java.lang.String secretToken,
                               java.util.Map<java.lang.String,​java.lang.Object> clientConfigProperties)
        Construct an instance to communicate with a GitLab API server using GitLab API version 4, and the specified server URL and private token.
        Parameters:
        hostUrl - the URL to the GitLab API server
        privateToken - the private token to authenticate with
        secretToken - use this token to validate received payloads
        clientConfigProperties - the properties given to Jersey's clientconfig
      • GitLabApiClient

        public GitLabApiClient​(GitLabApi.ApiVersion apiVersion,
                               java.lang.String hostUrl,
                               java.lang.String privateToken,
                               java.lang.String secretToken,
                               java.util.Map<java.lang.String,​java.lang.Object> clientConfigProperties)
        Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL and private token.
        Parameters:
        apiVersion - the ApiVersion specifying which version of the API to use
        hostUrl - the URL to the GitLab API server
        privateToken - the private token to authenticate with
        secretToken - use this token to validate received payloads
        clientConfigProperties - the properties given to Jersey's clientconfig
      • GitLabApiClient

        public GitLabApiClient​(GitLabApi.ApiVersion apiVersion,
                               java.lang.String hostUrl,
                               Constants.TokenType tokenType,
                               java.lang.String authToken,
                               java.lang.String secretToken,
                               java.util.Map<java.lang.String,​java.lang.Object> clientConfigProperties)
        Construct an instance to communicate with a GitLab API server using the specified GitLab API version, server URL and private token.
        Parameters:
        apiVersion - the ApiVersion specifying which version of the API to use
        hostUrl - the URL to the GitLab API server
        tokenType - the type of auth the token is for, PRIVATE or ACCESS
        authToken - the private token to authenticate with
        secretToken - use this token to validate received payloads
        clientConfigProperties - the properties given to Jersey's clientconfig
    • Method Detail

      • close

        public void close()
        Close the underlying Client and its associated resources.
        Specified by:
        close in interface java.lang.AutoCloseable
      • getApiUrl

        protected java.net.URL getApiUrl​(java.lang.Object... pathArgs)
                                  throws java.io.IOException
        Construct a REST URL with the specified path arguments.
        Parameters:
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a REST URL with the specified path arguments
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • getUrlWithBase

        protected java.net.URL getUrlWithBase​(java.lang.Object... pathArgs)
                                       throws java.io.IOException
        Construct a REST URL with the specified path arguments using Gitlab base url.
        Parameters:
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a REST URL with the specified path arguments
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • validateSecretToken

        protected boolean validateSecretToken​(jakarta.ws.rs.core.Response response)
        Validates the secret token (X-GitLab-Token) header against the expected secret token, returns true if valid, otherwise returns false.
        Parameters:
        response - the Response instance sent from the GitLab server
        Returns:
        true if the response's secret token is valid, otherwise returns false
      • get

        protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.lang.Object... pathArgs)
                                           throws java.io.IOException
        Perform an HTTP GET call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • get

        protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.net.URL url)
        Perform an HTTP GET call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • getWithAccepts

        protected jakarta.ws.rs.core.Response getWithAccepts​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                             java.lang.String accepts,
                                                             java.lang.Object... pathArgs)
                                                      throws java.io.IOException
        Perform an HTTP GET call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        accepts - if non-empty will set the Accepts header to this value
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • getWithAccepts

        protected jakarta.ws.rs.core.Response getWithAccepts​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                             java.net.URL url,
                                                             java.lang.String accepts)
        Perform an HTTP GET call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        url - the fully formed path to the GitLab API endpoint
        accepts - if non-empty will set the Accepts header to this value
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • head

        protected jakarta.ws.rs.core.Response head​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                   java.lang.Object... pathArgs)
                                            throws java.io.IOException
        Perform an HTTP HEAD call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • head

        protected jakarta.ws.rs.core.Response head​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                   java.net.URL url)
        Perform an HTTP HEAD call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • patch

        protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                    java.lang.Object... pathArgs)
                                             throws java.io.IOException
        Perform an HTTP PATCH call with the specified query parameters and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • patch

        protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                    java.net.URL url)
        Perform an HTTP PATCH call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Form formData,
                                                   java.lang.Object... pathArgs)
                                            throws java.io.IOException
        Perform an HTTP POST call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        formData - the Form containing the name/value pairs
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                   java.lang.Object... pathArgs)
                                            throws java.io.IOException
        Perform an HTTP POST call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a Response instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Form formData,
                                                   java.net.URL url)
        Perform an HTTP POST call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        formData - the Form containing the name/value pairs
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                   java.net.URL url)
        Perform an HTTP POST call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parametersformData the Form containing the name/value pairs
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • post

        protected jakarta.ws.rs.core.Response post​(java.lang.Object payload,
                                                   java.lang.Object... pathArgs)
                                            throws java.io.IOException
        Perform an HTTP POST call with the specified payload object and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        payload - the object instance that will be serialized to JSON and used as the POST data
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.StreamingOutput stream,
                                                   java.lang.String mediaType,
                                                   java.lang.Object... pathArgs)
                                            throws java.io.IOException
        Perform an HTTP POST call with the specified StreamingOutput, MediaType, and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        stream - the StreamingOutput instance that contains the POST data
        mediaType - the content-type of the POST data
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • upload

        protected jakarta.ws.rs.core.Response upload​(java.lang.String name,
                                                     java.io.File fileToUpload,
                                                     java.lang.String mediaTypeString,
                                                     java.lang.Object... pathArgs)
                                              throws java.io.IOException
        Perform a file upload using the specified media type, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        mediaTypeString - unused; will be removed in the next major version
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • upload

        protected jakarta.ws.rs.core.Response upload​(java.lang.String name,
                                                     java.io.File fileToUpload,
                                                     java.lang.String mediaTypeString,
                                                     jakarta.ws.rs.core.Form formData,
                                                     java.lang.Object... pathArgs)
                                              throws java.io.IOException
        Perform a file upload using the specified media type, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        mediaTypeString - unused; will be removed in the next major version
        formData - the Form containing the name/value pairs
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • upload

        protected jakarta.ws.rs.core.Response upload​(java.lang.String name,
                                                     java.io.File fileToUpload,
                                                     java.lang.String mediaTypeString,
                                                     jakarta.ws.rs.core.Form formData,
                                                     java.net.URL url)
                                              throws java.io.IOException
        Perform a file upload using multipart/form-data, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        mediaTypeString - unused; will be removed in the next major version
        formData - the Form containing the name/value pairs
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • upload

        protected jakarta.ws.rs.core.Response upload​(java.lang.String name,
                                                     java.io.InputStream inputStream,
                                                     java.lang.String filename,
                                                     java.lang.String mediaTypeString,
                                                     java.lang.Object... pathArgs)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • upload

        protected jakarta.ws.rs.core.Response upload​(java.lang.String name,
                                                     java.io.InputStream inputStream,
                                                     java.lang.String filename,
                                                     java.lang.String mediaTypeString,
                                                     jakarta.ws.rs.core.Form formData,
                                                     java.net.URL url)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • upload

        protected jakarta.ws.rs.core.Response upload​(org.glassfish.jersey.media.multipart.BodyPart bodyPart,
                                                     jakarta.ws.rs.core.Form formData,
                                                     java.net.URL url)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • putUpload

        protected jakarta.ws.rs.core.Response putUpload​(java.lang.String name,
                                                        java.io.File fileToUpload,
                                                        java.lang.Object... pathArgs)
                                                 throws java.io.IOException
        Perform a file upload using multipart/form-data using the HTTP PUT method, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • putUpload

        protected jakarta.ws.rs.core.Response putUpload​(java.lang.String name,
                                                        java.io.File fileToUpload,
                                                        java.net.URL url)
                                                 throws java.io.IOException
        Perform a file upload using multipart/form-data using the HTTP PUT method, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.lang.Object... pathArgs)
                                           throws java.io.IOException
        Perform an HTTP PUT call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.net.URL url)
        Perform an HTTP PUT call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Form formData,
                                                  java.lang.Object... pathArgs)
                                           throws java.io.IOException
        Perform an HTTP PUT call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        formData - the Form containing the name/value pairs
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Form formData,
                                                  java.net.URL url)
        Perform an HTTP PUT call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        formData - the Form containing the name/value pairs
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
      • put

        protected jakarta.ws.rs.core.Response put​(java.lang.Object payload,
                                                  java.lang.Object... pathArgs)
                                           throws java.io.IOException
        Perform an HTTP PUT call with the specified payload object and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        payload - the object instance that will be serialized to JSON and used as the PUT data
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • delete

        protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                     java.lang.Object... pathArgs)
                                              throws java.io.IOException
        Perform an HTTP DELETE call with the specified form data and path objects, returning a Response instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a Response instance with the data returned from the endpoint
        Throws:
        java.io.IOException - if an error occurs while constructing the URL
      • delete

        protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                     java.net.URL url)
        Perform an HTTP DELETE call with the specified form data and URL, returning a Response instance with the data returned from the endpoint.
        Parameters:
        queryParams - multivalue map of request parameters
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a Response instance with the data returned from the endpoint
      • invocation

        protected jakarta.ws.rs.client.Invocation.Builder invocation​(java.net.URL url,
                                                                     jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams)
      • createApiClient

        protected jakarta.ws.rs.client.Client createApiClient()
      • invocation

        protected jakarta.ws.rs.client.Invocation.Builder invocation​(java.net.URL url,
                                                                     jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                                     java.lang.String accept)
      • getIgnoreCertificateErrors

        public boolean getIgnoreCertificateErrors()
        Returns true if the API is setup to ignore SSL certificate errors, otherwise returns false.
        Returns:
        true if the API is setup to ignore SSL certificate errors, otherwise returns false
      • setIgnoreCertificateErrors

        public void setIgnoreCertificateErrors​(boolean ignoreCertificateErrors)
        Sets up the Jersey system ignore SSL certificate errors or not.
        Parameters:
        ignoreCertificateErrors - if true will set up the Jersey system ignore SSL certificate errors
      • setAuthTokenSupplier

        public void setAuthTokenSupplier​(java.util.function.Supplier<java.lang.String> authTokenSupplier)
        Set auth token supplier for gitlab api client.
        Parameters:
        authTokenSupplier - - supplier which provide actual auth token