use of com.ibm.watson.compare_comply.v1.model.FeedbackDeleted in project java-sdk by watson-developer-cloud.
the class CompareComplyTest method testDeleteFeedbackWOptions.
@Test
public void testDeleteFeedbackWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"status\": 6, \"message\": \"message\"}";
String deleteFeedbackPath = "/v1/feedback/testString";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the DeleteFeedbackOptions model
DeleteFeedbackOptions deleteFeedbackOptionsModel = new DeleteFeedbackOptions.Builder().feedbackId("testString").model("contracts").build();
// Invoke operation with valid options model (positive test)
Response<FeedbackDeleted> response = compareComplyService.deleteFeedback(deleteFeedbackOptionsModel).execute();
assertNotNull(response);
FeedbackDeleted responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "DELETE");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNotNull(query);
// Get query params
assertEquals(query.get("version"), "testString");
assertEquals(query.get("model"), "contracts");
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, deleteFeedbackPath);
}
use of com.ibm.watson.compare_comply.v1.model.FeedbackDeleted in project java-sdk by watson-developer-cloud.
the class CompareComply method deleteFeedback.
/**
* Delete a specified feedback entry.
*
* <p>Deletes a feedback entry with a specified `feedback_id`.
*
* @param deleteFeedbackOptions the {@link DeleteFeedbackOptions} containing the options for the
* call
* @return a {@link ServiceCall} with a result of type {@link FeedbackDeleted}
*/
public ServiceCall<FeedbackDeleted> deleteFeedback(DeleteFeedbackOptions deleteFeedbackOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(deleteFeedbackOptions, "deleteFeedbackOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("feedback_id", deleteFeedbackOptions.feedbackId());
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/feedback/{feedback_id}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("compare-comply", "v1", "deleteFeedback");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("version", String.valueOf(this.version));
if (deleteFeedbackOptions.model() != null) {
builder.query("model", String.valueOf(deleteFeedbackOptions.model()));
}
ResponseConverter<FeedbackDeleted> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<FeedbackDeleted>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations