use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class Assistant method getValue.
/**
* Get entity value.
*
* Get information about an entity value. This operation is limited to 6000 requests per 5 minutes. For more
* information, see **Rate limiting**.
*
* @param getValueOptions the {@link GetValueOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link ValueExport}
*/
public ServiceCall<ValueExport> getValue(GetValueOptions getValueOptions) {
Validator.notNull(getValueOptions, "getValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { getValueOptions.workspaceId(), getValueOptions.entity(), getValueOptions.value() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
if (getValueOptions.export() != null) {
builder.query("export", String.valueOf(getValueOptions.export()));
}
if (getValueOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getValueOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ValueExport.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class Assistant method listSynonyms.
/**
* List entity value synonyms.
*
* List the synonyms for an entity value. This operation is limited to 2500 requests per 30 minutes. For more
* information, see **Rate limiting**.
*
* @param listSynonymsOptions the {@link ListSynonymsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link SynonymCollection}
*/
public ServiceCall<SynonymCollection> listSynonyms(ListSynonymsOptions listSynonymsOptions) {
Validator.notNull(listSynonymsOptions, "listSynonymsOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" };
String[] pathParameters = { listSynonymsOptions.workspaceId(), listSynonymsOptions.entity(), listSynonymsOptions.value() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
if (listSynonymsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listSynonymsOptions.pageLimit()));
}
if (listSynonymsOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listSynonymsOptions.includeCount()));
}
if (listSynonymsOptions.sort() != null) {
builder.query("sort", listSynonymsOptions.sort());
}
if (listSynonymsOptions.cursor() != null) {
builder.query("cursor", listSynonymsOptions.cursor());
}
if (listSynonymsOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listSynonymsOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SynonymCollection.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class Assistant method updateValue.
/**
* Update entity value.
*
* Update an existing entity value with new or modified data. You must provide component objects defining the content
* of the updated entity value. This operation is limited to 1000 requests per 30 minutes. For more information, see
* **Rate limiting**.
*
* @param updateValueOptions the {@link UpdateValueOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Value}
*/
public ServiceCall<Value> updateValue(UpdateValueOptions updateValueOptions) {
Validator.notNull(updateValueOptions, "updateValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { updateValueOptions.workspaceId(), updateValueOptions.entity(), updateValueOptions.value() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
final JsonObject contentJson = new JsonObject();
if (updateValueOptions.newSynonyms() != null) {
contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(updateValueOptions.newSynonyms()));
}
if (updateValueOptions.valueType() != null) {
contentJson.addProperty("type", updateValueOptions.valueType());
}
if (updateValueOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateValueOptions.newMetadata()));
}
if (updateValueOptions.newPatterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(updateValueOptions.newPatterns()));
}
if (updateValueOptions.newValue() != null) {
contentJson.addProperty("value", updateValueOptions.newValue());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class Assistant method listAllLogs.
/**
* List log events in all workspaces.
*
* List the events from the logs of all workspaces in the service instance. If **cursor** is not specified, this
* operation is limited to 40 requests per 30 minutes. If **cursor** is specified, the limit is 120 requests per
* minute. For more information, see **Rate limiting**.
*
* @param listAllLogsOptions the {@link ListAllLogsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link LogCollection}
*/
public ServiceCall<LogCollection> listAllLogs(ListAllLogsOptions listAllLogsOptions) {
Validator.notNull(listAllLogsOptions, "listAllLogsOptions cannot be null");
String[] pathSegments = { "v1/logs" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query(VERSION, versionDate);
builder.query("filter", listAllLogsOptions.filter());
if (listAllLogsOptions.sort() != null) {
builder.query("sort", listAllLogsOptions.sort());
}
if (listAllLogsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listAllLogsOptions.pageLimit()));
}
if (listAllLogsOptions.cursor() != null) {
builder.query("cursor", listAllLogsOptions.cursor());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogCollection.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class Assistant method getCounterexample.
/**
* Get counterexample.
*
* Get information about a counterexample. Counterexamples are examples that have been marked as irrelevant input.
* This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**.
*
* @param getCounterexampleOptions the {@link GetCounterexampleOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Counterexample}
*/
public ServiceCall<Counterexample> getCounterexample(GetCounterexampleOptions getCounterexampleOptions) {
Validator.notNull(getCounterexampleOptions, "getCounterexampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "counterexamples" };
String[] pathParameters = { getCounterexampleOptions.workspaceId(), getCounterexampleOptions.text() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
if (getCounterexampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getCounterexampleOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class));
}
Aggregations