public abstract class AbstractApi extends Object
Constructor and Description |
---|
AbstractApi(GitLabApi gitLabApi) |
Modifier and Type | Method and Description |
---|---|
protected void |
addFormParam(javax.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(javax.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 javax.ws.rs.core.Response |
delete(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
delete(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
get(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
get(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 |
getApiClient() |
protected GitLabApiException |
handle(Exception thrown)
Wraps an exception in a GitLabApiException if needed.
|
protected javax.ws.rs.core.Response |
post(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
post(javax.ws.rs.core.Response.Status expectedStatus,
javax.ws.rs.core.Form formData,
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 javax.ws.rs.core.Response |
post(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
put(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
put(javax.ws.rs.core.Response.Status expectedStatus,
javax.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 javax.ws.rs.core.Response |
validate(javax.ws.rs.core.Response response,
javax.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.
|
public AbstractApi(GitLabApi gitLabApi)
protected GitLabApiClient getApiClient()
protected javax.ws.rs.core.Response get(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Object... pathArgs) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parameterspathArgs
- variable list of arguments used to build the URIGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response get(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, URL url) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parametersurl
- the fully formed path to the GitLab API endpointGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response post(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.Form formData, Object... pathArgs) throws GitLabApiException
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 URIGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response post(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Object... pathArgs) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parameterspathArgs
- variable list of arguments used to build the URIGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response post(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.Form formData, URL url) throws GitLabApiException
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 endpointGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response put(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Object... pathArgs) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parameterspathArgs
- variable list of arguments used to build the URIGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response put(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, URL url) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parametersurl
- the fully formed path to the GitLab API endpointGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response delete(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Object... pathArgs) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parameterspathArgs
- variable list of arguments used to build the URIGitLabApiException
- if any exception occurs during executionprotected javax.ws.rs.core.Response delete(javax.ws.rs.core.Response.Status expectedStatus, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, URL url) throws GitLabApiException
expectedStatus
- the HTTP status that should be returned from the serverqueryParams
- multivalue map of request parametersurl
- the fully formed path to the GitLab API endpointGitLabApiException
- if any exception occurs during executionprotected void addFormParam(javax.ws.rs.core.Form formData, String name, Object value) throws IllegalArgumentException
formData
- the Form containing the name/value pairsname
- the name of the field/attribute to addvalue
- the value of the field/attribute to addIllegalArgumentException
protected void addFormParam(javax.ws.rs.core.Form formData, String name, Object value, boolean required) throws IllegalArgumentException
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 flagIllegalArgumentException
- if a required parameter is null or emptyprotected javax.ws.rs.core.Response validate(javax.ws.rs.core.Response response, javax.ws.rs.core.Response.Status expected) throws GitLabApiException
response
- responseexpected
- expected respone statusGitLabApiException
- if HTTP status is not as expected, or the secret token doesn't matchprotected GitLabApiException handle(Exception thrown)
thrown
- the exception that should be wrappedCopyright © 2017. All rights reserved.