Class AbstractApi

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.gitlab4j.models.Constants

        org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoCancelPendingPipelines, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectFeatureVisibilityAccessLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected GitLabApi gitLabApi  
      • Fields inherited from interface org.gitlab4j.models.Constants

        NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addFormParam​(jakarta.ws.rs.core.Form formData, java.lang.String name, java.lang.Object value)
      Convenience method for adding query and form parameters to a get() or post() call.
      protected void addFormParam​(jakarta.ws.rs.core.Form formData, java.lang.String name, java.lang.Object value, boolean required)
      Convenience method for adding query and form parameters to a get() or post() call.
      protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.Response.Status expectedStatus, 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 ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.Response.Status expectedStatus, 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 ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.Response.Status expectedStatus, 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.Response.Status expectedStatus, 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 GitLabApiClient getApiClient()  
      protected GitLabApi.ApiVersion getApiVersion()  
      protected int getDefaultPerPage()  
      protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getDefaultPerPageParam()
      Creates a MultivaluedMap instance containing the "per_page" param with the default value.
      protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getDefaultPerPageParam​(boolean customAttributesEnabled)
      Creates a MultivaluedMap instance containing the "per_page" param with the default value.
      java.lang.Object getGroupIdOrPath​(java.lang.Object obj)
      Returns the group ID or path from the provided Long, String, or Group instance.
      java.lang.Object getLabelIdOrName​(java.lang.Object obj)
      Returns the label ID or name from the provided Long, String, or Label instance.
      java.lang.Object getNamespaceIdOrPath​(java.lang.Object obj)  
      protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getPageQueryParams​(int page, int perPage)
      Creates a MultivaluedMap instance containing "page" and "per_page" params.
      protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getPageQueryParams​(int page, int perPage, boolean customAttributesEnabled)
      Creates a MultivaluedMap instance containing "page" and "per_page" params.
      protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getPerPageQueryParam​(int perPage)
      Creates a MultivaluedMap instance containing the "per_page" param.
      java.lang.Object getProjectIdOrPath​(java.lang.Object obj)
      Returns the project ID or path from the provided Long, String, or Project instance.
      java.lang.Object getUserIdOrUsername​(java.lang.Object obj)
      Returns the user ID or path from the provided Long, String, or User instance.
      protected jakarta.ws.rs.core.Response getWithAccepts​(jakarta.ws.rs.core.Response.Status expectedStatus, 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 GitLabApiException handle​(java.lang.Exception thrown)
      Wraps an exception in a GitLabApiException if needed.
      protected jakarta.ws.rs.core.Response head​(jakarta.ws.rs.core.Response.Status expectedStatus, 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 boolean isApiVersion​(GitLabApi.ApiVersion apiVersion)  
      protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.Response.Status expectedStatus, 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.Response.Status expectedStatus, 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.Response.Status expectedStatus, 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.Response.Status expectedStatus, 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.Response.Status expectedStatus, 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.Response.Status expectedStatus, jakarta.ws.rs.core.StreamingOutput stream, java.lang.String mediaType, java.lang.Object... pathArgs)
      Perform an HTTP POST call with the specified payload object 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.Response.Status expectedStatus, java.lang.Object payload, java.lang.Object... pathArgs)
      Perform an HTTP POST call with the specified payload object 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.Response.Status expectedStatus, 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.Response.Status expectedStatus, 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​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.Object payload, java.lang.Object... pathArgs)
      Perform an HTTP PUT call with the specified payload object and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response putUpload​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.String name, java.io.File fileToUpload, java.lang.Object... pathArgs)
      Perform a file upload using the HTTP PUT method with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response putUpload​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.String name, java.io.File fileToUpload, java.net.URL url)
      Perform a file upload using the HTTP PUT method with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response putWithFormData​(jakarta.ws.rs.core.Response.Status expectedStatus, 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 putWithFormData​(jakarta.ws.rs.core.Response.Status expectedStatus, org.gitlab4j.models.GitLabForm form, 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 upload​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.String name, java.io.File fileToUpload, java.lang.String mediaType, jakarta.ws.rs.core.Form formData, java.net.URL url)
      Perform a file upload with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response upload​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.String name, java.io.File fileToUpload, java.lang.String mediaType, java.lang.Object... pathArgs)
      Perform a file upload with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response upload​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.String name, java.io.File fileToUpload, java.lang.String mediaType, java.net.URL url)
      Perform a file upload with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
      protected jakarta.ws.rs.core.Response upload​(jakarta.ws.rs.core.Response.Status expectedStatus, java.lang.String name, java.io.InputStream inputStream, java.lang.String filename, java.lang.String mediaType, java.lang.Object... pathArgs)  
      protected java.lang.String urlEncode​(java.lang.String s)
      Encode a string to be used as in-path argument for a gitlab api request.
      protected jakarta.ws.rs.core.Response validate​(jakarta.ws.rs.core.Response response, jakarta.ws.rs.core.Response.Status expected)
      Validates response the response from the server against the expected HTTP status and the returned secret token, if either is not correct will throw a GitLabApiException.
      • Methods inherited from class java.lang.Object

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

      • gitLabApi

        protected final GitLabApi gitLabApi
    • Constructor Detail

      • AbstractApi

        public AbstractApi​(GitLabApi gitLabApi)
    • Method Detail

      • getProjectIdOrPath

        public java.lang.Object getProjectIdOrPath​(java.lang.Object obj)
                                            throws GitLabApiException
        Returns the project ID or path from the provided Long, String, or Project instance.
        Parameters:
        obj - the object to determine the ID or path from
        Returns:
        the project ID or path from the provided Long, String, or Project instance
        Throws:
        GitLabApiException - if any exception occurs during execution
      • getGroupIdOrPath

        public java.lang.Object getGroupIdOrPath​(java.lang.Object obj)
                                          throws GitLabApiException
        Returns the group ID or path from the provided Long, String, or Group instance.
        Parameters:
        obj - the object to determine the ID or path from
        Returns:
        the group ID or path from the provided Long, String, or Group instance
        Throws:
        GitLabApiException - if any exception occurs during execution
      • getUserIdOrUsername

        public java.lang.Object getUserIdOrUsername​(java.lang.Object obj)
                                             throws GitLabApiException
        Returns the user ID or path from the provided Long, String, or User instance.
        Parameters:
        obj - the object to determine the ID or username from
        Returns:
        the user ID or username from the provided Long, String, or User instance
        Throws:
        GitLabApiException - if any exception occurs during execution
      • getLabelIdOrName

        public java.lang.Object getLabelIdOrName​(java.lang.Object obj)
                                          throws GitLabApiException
        Returns the label ID or name from the provided Long, String, or Label instance.
        Parameters:
        obj - the object to determine the ID or name from
        Returns:
        the user ID or name from the provided Long, String, or Label instance
        Throws:
        GitLabApiException - if any exception occurs during execution
      • getDefaultPerPage

        protected int getDefaultPerPage()
      • urlEncode

        protected java.lang.String urlEncode​(java.lang.String s)
                                      throws GitLabApiException
        Encode a string to be used as in-path argument for a gitlab api request. Standard URL encoding changes spaces to plus signs, but for arguments that are part of the path, like the :file_path in a "Get raw file" request, gitlab expects spaces to be encoded with %20.
        Parameters:
        s - the string to encode
        Returns:
        encoded version of s with spaces encoded as %2F
        Throws:
        GitLabApiException - if encoding throws an exception
      • get

        protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                  jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.lang.Object... pathArgs)
                                           throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • getWithAccepts

        protected jakarta.ws.rs.core.Response getWithAccepts​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                             jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                             java.lang.String accepts,
                                                             java.lang.Object... pathArgs)
                                                      throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • get

        protected jakarta.ws.rs.core.Response get​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                  jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.net.URL url)
                                           throws GitLabApiException
        Perform an HTTP GET call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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
        Throws:
        GitLabApiException - if any exception occurs during execution
      • head

        protected jakarta.ws.rs.core.Response head​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                   jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                   java.lang.Object... pathArgs)
                                            throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • patch

        protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                    jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                    java.lang.Object... pathArgs)
                                             throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • patch

        protected jakarta.ws.rs.core.Response patch​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                    jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                    java.net.URL url)
                                             throws GitLabApiException
        Perform an HTTP PATCH call with the specified query parameters and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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
        Throws:
        GitLabApiException - if any exception occurs during execution
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                   jakarta.ws.rs.core.Form formData,
                                                   java.lang.Object... pathArgs)
                                            throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        formData - the Form containing the name/value pairs for 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:
        GitLabApiException - if any exception occurs during execution
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                   java.lang.Object payload,
                                                   java.lang.Object... pathArgs)
                                            throws GitLabApiException
        Perform an HTTP POST call with the specified payload object and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                   jakarta.ws.rs.core.StreamingOutput stream,
                                                   java.lang.String mediaType,
                                                   java.lang.Object... pathArgs)
                                            throws GitLabApiException
        Perform an HTTP POST call with the specified payload object and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        stream - the StreamingOutput that will be used for the POST data
        mediaType - the content-type for the streamed data
        pathArgs - variable list of arguments used to build the URI
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        GitLabApiException - if any exception occurs during execution
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                   jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                   java.lang.Object... pathArgs)
                                            throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • post

        protected jakarta.ws.rs.core.Response post​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                   jakarta.ws.rs.core.Form formData,
                                                   java.net.URL url)
                                            throws GitLabApiException
        Perform an HTTP POST call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        formData - the Form containing the name/value pairs for the POST data
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        GitLabApiException - if any exception occurs during execution
      • upload

        protected jakarta.ws.rs.core.Response upload​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                     java.lang.String name,
                                                     java.io.File fileToUpload,
                                                     java.lang.String mediaType,
                                                     java.lang.Object... pathArgs)
                                              throws GitLabApiException
        Perform a file upload with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        mediaType - 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:
        GitLabApiException - if any exception occurs during execution
      • upload

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

        protected jakarta.ws.rs.core.Response upload​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                     java.lang.String name,
                                                     java.io.File fileToUpload,
                                                     java.lang.String mediaType,
                                                     java.net.URL url)
                                              throws GitLabApiException
        Perform a file upload with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        mediaType - unused; will be removed in the next major version
        url - the fully formed path to the GitLab API endpoint
        Returns:
        a ClientResponse instance with the data returned from the endpoint
        Throws:
        GitLabApiException - if any exception occurs during execution
      • upload

        protected jakarta.ws.rs.core.Response upload​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                     java.lang.String name,
                                                     java.io.File fileToUpload,
                                                     java.lang.String mediaType,
                                                     jakarta.ws.rs.core.Form formData,
                                                     java.net.URL url)
                                              throws GitLabApiException
        Perform a file upload with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        name - the name for the form field that contains the file name
        fileToUpload - a File instance pointing to the file to upload
        mediaType - 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:
        GitLabApiException - if any exception occurs during execution
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                  jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.lang.Object... pathArgs)
                                           throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                  jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                  java.net.URL url)
                                           throws GitLabApiException
        Perform an HTTP PUT call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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
        Throws:
        GitLabApiException - if any exception occurs during execution
      • put

        protected jakarta.ws.rs.core.Response put​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                  java.lang.Object payload,
                                                  java.lang.Object... pathArgs)
                                           throws GitLabApiException
        Perform an HTTP PUT call with the specified payload object and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • putWithFormData

        protected jakarta.ws.rs.core.Response putWithFormData​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                              jakarta.ws.rs.core.Form formData,
                                                              java.lang.Object... pathArgs)
                                                       throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        formData - the Form containing the name/value pairs for 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:
        GitLabApiException - if any exception occurs during execution
      • putWithFormData

        protected jakarta.ws.rs.core.Response putWithFormData​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                              org.gitlab4j.models.GitLabForm form,
                                                              java.lang.Object... pathArgs)
                                                       throws GitLabApiException
        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:
        expectedStatus - the HTTP status that should be returned from the server
        form - the Form containing the name/value pairs for 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:
        GitLabApiException - if any exception occurs during execution
      • putUpload

        protected jakarta.ws.rs.core.Response putUpload​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                        java.lang.String name,
                                                        java.io.File fileToUpload,
                                                        java.lang.Object... pathArgs)
                                                 throws GitLabApiException
        Perform a file upload using the HTTP PUT method with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • putUpload

        protected jakarta.ws.rs.core.Response putUpload​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                        java.lang.String name,
                                                        java.io.File fileToUpload,
                                                        java.net.URL url)
                                                 throws GitLabApiException
        Perform a file upload using the HTTP PUT method with the specified File instance and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • delete

        protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                     jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                     java.lang.Object... pathArgs)
                                              throws GitLabApiException
        Perform an HTTP DELETE call with the specified form data and path objects, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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:
        GitLabApiException - if any exception occurs during execution
      • delete

        protected jakarta.ws.rs.core.Response delete​(jakarta.ws.rs.core.Response.Status expectedStatus,
                                                     jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> queryParams,
                                                     java.net.URL url)
                                              throws GitLabApiException
        Perform an HTTP DELETE call with the specified form data and URL, returning a ClientResponse instance with the data returned from the endpoint.
        Parameters:
        expectedStatus - the HTTP status that should be returned from the server
        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
        Throws:
        GitLabApiException - if any exception occurs during execution
      • addFormParam

        protected void addFormParam​(jakarta.ws.rs.core.Form formData,
                                    java.lang.String name,
                                    java.lang.Object value)
                             throws java.lang.IllegalArgumentException
        Convenience method for adding query and form parameters to a get() or post() call.
        Parameters:
        formData - the Form containing the name/value pairs
        name - the name of the field/attribute to add
        value - the value of the field/attribute to add
        Throws:
        java.lang.IllegalArgumentException
      • addFormParam

        protected void addFormParam​(jakarta.ws.rs.core.Form formData,
                                    java.lang.String name,
                                    java.lang.Object value,
                                    boolean required)
                             throws java.lang.IllegalArgumentException
        Convenience method for adding query and form parameters to a get() or post() call. If required is true and value is null, will throw an IllegalArgumentException.
        Parameters:
        formData - the Form containing the name/value pairs
        name - the name of the field/attribute to add
        value - the value of the field/attribute to add
        required - the field is required flag
        Throws:
        java.lang.IllegalArgumentException - if a required parameter is null or empty
      • validate

        protected jakarta.ws.rs.core.Response validate​(jakarta.ws.rs.core.Response response,
                                                       jakarta.ws.rs.core.Response.Status expected)
                                                throws GitLabApiException
        Validates response the response from the server against the expected HTTP status and the returned secret token, if either is not correct will throw a GitLabApiException.
        Parameters:
        response - response
        expected - expected response status
        Returns:
        original response if the response status is expected
        Throws:
        GitLabApiException - if HTTP status is not as expected, or the secret token doesn't match
      • handle

        protected GitLabApiException handle​(java.lang.Exception thrown)
        Wraps an exception in a GitLabApiException if needed.
        Parameters:
        thrown - the exception that should be wrapped
        Returns:
        either the untouched GitLabApiException or a new GitLabApiExceptin wrapping a non-GitLabApiException
      • getPerPageQueryParam

        protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getPerPageQueryParam​(int perPage)
        Creates a MultivaluedMap instance containing the "per_page" param.
        Parameters:
        perPage - the number of projects per page
        Returns:
        a MultivaluedMap instance containing the "per_page" param
      • getPageQueryParams

        protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getPageQueryParams​(int page,
                                                                                                                int perPage)
        Creates a MultivaluedMap instance containing "page" and "per_page" params.
        Parameters:
        page - the page to get
        perPage - the number of projects per page
        Returns:
        a MultivaluedMap instance containing "page" and "per_page" params
      • getPageQueryParams

        protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getPageQueryParams​(int page,
                                                                                                                int perPage,
                                                                                                                boolean customAttributesEnabled)
        Creates a MultivaluedMap instance containing "page" and "per_page" params.
        Parameters:
        page - the page to get
        perPage - the number of projects per page
        customAttributesEnabled - enables customAttributes for this query
        Returns:
        a MultivaluedMap instance containing "page" and "per_page" params
      • getDefaultPerPageParam

        protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getDefaultPerPageParam()
        Creates a MultivaluedMap instance containing the "per_page" param with the default value.
        Returns:
        a MultivaluedMap instance containing the "per_page" param with the default value
      • getDefaultPerPageParam

        protected jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getDefaultPerPageParam​(boolean customAttributesEnabled)
        Creates a MultivaluedMap instance containing the "per_page" param with the default value.
        Parameters:
        customAttributesEnabled - enables customAttributes for this query
        Returns:
        a MultivaluedMap instance containing the "per_page" param with the default value