Commit d80e4b15 authored by Greg Messner's avatar Greg Messner
Browse files

Added put() methods.

parent b3843101
......@@ -89,6 +89,41 @@ public abstract class AbstractApi {
}
/**
* Perform an HTTP PUT call with the specified form data and path objects, returning
* a ClientResponse instance with the data returned from the endpoint.
*
* @param queryParams
* @param pathArgs
* @return a ClientResponse instance with the data returned from the endpoint
* @throws UniformInterfaceException
* @throws ClientHandlerException
* @throws IOException
*/
protected ClientResponse put (MultivaluedMap<String, String> queryParams, Object ... pathArgs)
throws UniformInterfaceException, ClientHandlerException, IOException {
return (getApiClient().put(queryParams, pathArgs));
}
/**
* Perform an HTTP PUT call with the specified form data and URL, returning
* a ClientResponse instance with the data returned from the endpoint.
*
* @param queryParams
* @param url
* @return a ClientResponse instance with the data returned from the endpoint
* @throws UniformInterfaceException
* @throws ClientHandlerException
*/
protected ClientResponse put (MultivaluedMap<String, String> queryParams, URL url)
throws UniformInterfaceException, ClientHandlerException {
return (getApiClient().put(queryParams, url));
}
/**
* Perform an HTTP DELETE call with the specified form data and path objects, returning
* a ClientResponse instance with the data returned from the endpoint.
......@@ -117,8 +152,7 @@ public abstract class AbstractApi {
* @throws ClientHandlerException
*/
protected ClientResponse delete (MultivaluedMap<String, String> queryParams, URL url)
throws UniformInterfaceException, ClientHandlerException {
throws UniformInterfaceException, ClientHandlerException {
return (getApiClient().delete(queryParams, url));
}
......
......@@ -279,6 +279,52 @@ public class GitLabApiClient {
}
/**
* Perform an HTTP PUT call with the specified form data and path objects, returning
* a ClientResponse instance with the data returned from the endpoint.
*
* @param queryParams
* @param pathArgs
* @return a ClientResponse instance with the data returned from the endpoint
* @throws UniformInterfaceException
* @throws ClientHandlerException
* @throws IOException
*/
protected ClientResponse put (MultivaluedMap<String, String> queryParams, Object ... pathArgs)
throws UniformInterfaceException, ClientHandlerException, IOException {
URL url = getApiUrl(pathArgs);
return (put(queryParams, url));
}
/**
* Perform an HTTP PUT call with the specified form data and URL, returning
* a ClientResponse instance with the data returned from the endpoint.
*
* @param queryParams
* @param url
* @return a ClientResponse instance with the data returned from the endpoint
* @throws UniformInterfaceException
* @throws ClientHandlerException
*/
protected ClientResponse put (MultivaluedMap<String, String> queryParams, URL url)
throws UniformInterfaceException, ClientHandlerException {
if (apiClient == null) {
apiClient = Client.create(clientConfig);
}
WebResource resource = apiClient.resource(url.toString());
if (queryParams != null) {
resource.queryParams(queryParams);
}
return (resource.header(PRIVATE_TOKEN_HEADER, privateToken)
.accept(MediaType.APPLICATION_JSON)
.put(ClientResponse.class));
}
/**
* Perform an HTTP DELETE call with the specified form data and path objects, returning
* a ClientResponse instance with the data returned from the endpoint.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment