use of com.ibm.cloud.cloudant.v1.model.Document in project cloudant-java-sdk by IBM.
the class Cloudant method postRevsDiff.
/**
* Query the document revisions and possible ancestors missing from the database.
*
* The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source
* database, the replicator sends this set to the destination database's `_revs_diff` to find out which of them
* already exists there. It can then avoid fetching and sending already-known document bodies.
*
* @param postRevsDiffOptions the {@link PostRevsDiffOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Map}
*/
public ServiceCall<Map<String, RevsDiff>> postRevsDiff(PostRevsDiffOptions postRevsDiffOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(postRevsDiffOptions, "postRevsDiffOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("db", postRevsDiffOptions.db());
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{db}/_revs_diff", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "postRevsDiff");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(postRevsDiffOptions.documentRevisions()), "application/json");
ResponseConverter<Map<String, RevsDiff>> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Map<String, RevsDiff>>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations