Package org.gitlab4j.api
Class AbstractApi
java.lang.Object
org.gitlab4j.api.AbstractApi
- All Implemented Interfaces:
Constants
- Direct Known Subclasses:
ApplicationsApi
,ApplicationSettingsApi
,AuditEventApi
,AwardEmojiApi
,BoardsApi
,CommitsApi
,ContainerRegistryApi
,DeployKeysApi
,DeploymentsApi
,DeployTokensApi
,DiscussionsApi
,EnvironmentsApi
,EpicsApi
,EventsApi
,ExternalStatusCheckApi
,GroupApi
,HealthCheckApi
,ImportExportApi
,IssuesApi
,JobApi
,KeysApi
,LabelsApi
,LicenseApi
,LicenseTemplatesApi
,MarkdownApi
,MergeRequestApi
,MilestonesApi
,NamespaceApi
,NotesApi
,NotificationSettingsApi
,PackagesApi
,PipelineApi
,ProjectApi
,ProtectedBranchesApi
,ReleaseLinksApi
,ReleasesApi
,RepositoryApi
,RepositoryFileApi
,RepositorySubmodulesApi
,ResourceLabelEventsApi
,ResourceStateEventsApi
,RunnersApi
,SearchApi
,ServicesApi
,SnippetsApi
,SystemHooksApi
,TagsApi
,TodosApi
,UserApi
,WikisApi
This class is the base class for all the sub API classes. It provides implementations of
delete(), get(), post() and put() that are re-used by all the sub-classes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gitlab4j.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
FieldsFields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addFormParam
(jakarta.ws.rs.core.Form formData, String name, 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, String name, 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<String, String> queryParams, 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<String, String> queryParams, 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<String, String> queryParams, 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<String, String> queryParams, 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
protected GitLabApi.ApiVersion
protected int
Creates a MultivaluedMap instance containing the "per_page" param with the default value.getDefaultPerPageParam
(boolean customAttributesEnabled) Creates a MultivaluedMap instance containing the "per_page" param with the default value.getGroupIdOrPath
(Object obj) Returns the group ID or path from the provided Integer, String, or Group instance.getLabelIdOrName
(Object obj) Returns the label ID or name from the provided Integer, String, or Label instance.getPageQueryParams
(int page, int perPage) Creates a MultivaluedMap instance containing "page" and "per_page" params.getPageQueryParams
(int page, int perPage, boolean customAttributesEnabled) Creates a MultivaluedMap instance containing "page" and "per_page" params.getPerPageQueryParam
(int perPage) Creates a MultivaluedMap instance containing the "per_page" param.getProjectIdOrPath
(Object obj) Returns the project ID or path from the provided Integer, String, or Project instance.Returns the user ID or path from the provided Integer, String, or User instance.protected jakarta.ws.rs.core.Response
getWithAccepts
(jakarta.ws.rs.core.Response.Status expectedStatus, jakarta.ws.rs.core.MultivaluedMap<String, String> queryParams, String accepts, 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
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<String, String> queryParams, 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<String, String> queryParams, 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<String, String> queryParams, 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, 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
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<String, String> queryParams, 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, String mediaType, 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
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<String, String> queryParams, 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<String, String> queryParams, 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
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, String name, File fileToUpload, 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, String name, File fileToUpload, 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, 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, String name, File fileToUpload, String mediaType, jakarta.ws.rs.core.Form formData, 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, String name, File fileToUpload, String mediaType, 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, String name, File fileToUpload, String mediaType, 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, String name, InputStream inputStream, String filename, String mediaType, Object... pathArgs) protected String
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.
-
Field Details
-
gitLabApi
-
-
Constructor Details
-
AbstractApi
-
-
Method Details
-
getProjectIdOrPath
Returns the project ID or path from the provided Integer, 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
Returns the group ID or path from the provided Integer, 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
Returns the user ID or path from the provided Integer, String, or User instance.- Parameters:
obj
- the object to determine the ID or username from- Returns:
- the user ID or username from the provided Integer, String, or User instance
- Throws:
GitLabApiException
- if any exception occurs during execution
-
getLabelIdOrName
Returns the label ID or name from the provided Integer, String, or Label instance.- Parameters:
obj
- the object to determine the ID or name from- Returns:
- the user ID or name from the provided Integer, String, or Label instance
- Throws:
GitLabApiException
- if any exception occurs during execution
-
getApiVersion
-
isApiVersion
-
getDefaultPerPage
protected int getDefaultPerPage() -
getApiClient
-
urlEncode
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<String, String> queryParams, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parameterspathArgs
- 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<String, String> queryParams, String accepts, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parametersaccepts
- if non-empty will set the Accepts header to this valuepathArgs
- 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<String, String> queryParams, URL url) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parametersurl
- 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<String, String> queryParams, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parameterspathArgs
- 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<String, String> queryParams, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parameterspathArgs
- 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<String, String> queryParams, URL url) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parametersurl
- 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, 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 serverformData
- the Form containing the name/value pairs for the POST datapathArgs
- 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, Object payload, 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 serverpayload
- the object instance that will be serialized to JSON and used as the POST datapathArgs
- 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, String mediaType, 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 serverstream
- the StreamingOutput that will be used for the POST datamediaType
- the content-type for the streamed datapathArgs
- 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<String, String> queryParams, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parameterspathArgs
- 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, 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 serverformData
- the Form containing the name/value pairs for the POST dataurl
- 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, String name, File fileToUpload, String mediaType, 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 servername
- the name for the form field that contains the file namefileToUpload
- a File instance pointing to the file to uploadmediaType
- unused; will be removed in the next major versionpathArgs
- 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, String name, InputStream inputStream, String filename, String mediaType, Object... pathArgs) throws GitLabApiException - Throws:
GitLabApiException
-
upload
protected jakarta.ws.rs.core.Response upload(jakarta.ws.rs.core.Response.Status expectedStatus, String name, File fileToUpload, String mediaType, 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 servername
- the name for the form field that contains the file namefileToUpload
- a File instance pointing to the file to uploadmediaType
- unused; will be removed in the next major versionurl
- 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, String name, File fileToUpload, String mediaType, jakarta.ws.rs.core.Form formData, 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 servername
- the name for the form field that contains the file namefileToUpload
- a File instance pointing to the file to uploadmediaType
- unused; will be removed in the next major versionformData
- the Form containing the name/value pairsurl
- 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<String, String> queryParams, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parameterspathArgs
- 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<String, String> queryParams, URL url) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parametersurl
- 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, Object payload, 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 serverpayload
- the object instance that will be serialized to JSON and used as the PUT datapathArgs
- 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, 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 serverformData
- the Form containing the name/value pairs for the POST datapathArgs
- 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, String name, File fileToUpload, 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 servername
- the name for the form field that contains the file namefileToUpload
- a File instance pointing to the file to uploadpathArgs
- 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, String name, File fileToUpload, 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 servername
- the name for the form field that contains the file namefileToUpload
- a File instance pointing to the file to uploadurl
- 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<String, String> queryParams, Object... pathArgs) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parameterspathArgs
- 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<String, String> queryParams, URL url) throws GitLabApiExceptionPerform 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 serverqueryParams
- multivalue map of request parametersurl
- 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, String name, Object value) throws IllegalArgumentException Convenience method for adding query and form parameters to a get() or post() call.- Parameters:
formData
- the Form containing the name/value pairsname
- the name of the field/attribute to addvalue
- the value of the field/attribute to add- Throws:
IllegalArgumentException
-
addFormParam
protected void addFormParam(jakarta.ws.rs.core.Form formData, String name, Object value, boolean required) throws 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 pairsname
- the name of the field/attribute to addvalue
- the value of the field/attribute to addrequired
- the field is required flag- Throws:
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
- responseexpected
- 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
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
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<String,String> getPageQueryParams(int page, int perPage) Creates a MultivaluedMap instance containing "page" and "per_page" params.- Parameters:
page
- the page to getperPage
- the number of projects per page- Returns:
- a MultivaluedMap instance containing "page" and "per_page" params
-
getPageQueryParams
protected jakarta.ws.rs.core.MultivaluedMap<String,String> getPageQueryParams(int page, int perPage, boolean customAttributesEnabled) Creates a MultivaluedMap instance containing "page" and "per_page" params.- Parameters:
page
- the page to getperPage
- the number of projects per pagecustomAttributesEnabled
- enables customAttributes for this query- Returns:
- a MultivaluedMap instance containing "page" and "per_page" params
-
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<String,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
-