repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.listTrainingData | public ServiceCall<TrainingDataSet> listTrainingData(ListTrainingDataOptions listTrainingDataOptions) {
Validator.notNull(listTrainingDataOptions, "listTrainingDataOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data" };
String[] pathParameters = { listTrainingDataOptions.environmentId(), listTrainingDataOptions.collectionId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listTrainingData");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingDataSet.class));
} | java | public ServiceCall<TrainingDataSet> listTrainingData(ListTrainingDataOptions listTrainingDataOptions) {
Validator.notNull(listTrainingDataOptions, "listTrainingDataOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data" };
String[] pathParameters = { listTrainingDataOptions.environmentId(), listTrainingDataOptions.collectionId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listTrainingData");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingDataSet.class));
} | [
"public",
"ServiceCall",
"<",
"TrainingDataSet",
">",
"listTrainingData",
"(",
"ListTrainingDataOptions",
"listTrainingDataOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listTrainingDataOptions",
",",
"\"listTrainingDataOptions cannot be null\"",
")",
";",
"String",
... | List training data.
Lists the training data for the specified collection.
@param listTrainingDataOptions the {@link ListTrainingDataOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link TrainingDataSet} | [
"List",
"training",
"data",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L1724-L1737 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.listTrainingExamples | public ServiceCall<TrainingExampleList> listTrainingExamples(
ListTrainingExamplesOptions listTrainingExamplesOptions) {
Validator.notNull(listTrainingExamplesOptions, "listTrainingExamplesOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" };
String[] pathParameters = { listTrainingExamplesOptions.environmentId(), listTrainingExamplesOptions.collectionId(),
listTrainingExamplesOptions.queryId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listTrainingExamples");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingExampleList.class));
} | java | public ServiceCall<TrainingExampleList> listTrainingExamples(
ListTrainingExamplesOptions listTrainingExamplesOptions) {
Validator.notNull(listTrainingExamplesOptions, "listTrainingExamplesOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" };
String[] pathParameters = { listTrainingExamplesOptions.environmentId(), listTrainingExamplesOptions.collectionId(),
listTrainingExamplesOptions.queryId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listTrainingExamples");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingExampleList.class));
} | [
"public",
"ServiceCall",
"<",
"TrainingExampleList",
">",
"listTrainingExamples",
"(",
"ListTrainingExamplesOptions",
"listTrainingExamplesOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listTrainingExamplesOptions",
",",
"\"listTrainingExamplesOptions cannot be null\"",
"... | List examples for a training data query.
List all examples for this training data query.
@param listTrainingExamplesOptions the {@link ListTrainingExamplesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link TrainingExampleList} | [
"List",
"examples",
"for",
"a",
"training",
"data",
"query",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L1747-L1762 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.updateTrainingExample | public ServiceCall<TrainingExample> updateTrainingExample(UpdateTrainingExampleOptions updateTrainingExampleOptions) {
Validator.notNull(updateTrainingExampleOptions, "updateTrainingExampleOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" };
String[] pathParameters = { updateTrainingExampleOptions.environmentId(), updateTrainingExampleOptions
.collectionId(), updateTrainingExampleOptions.queryId(), updateTrainingExampleOptions.exampleId() };
RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateTrainingExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateTrainingExampleOptions.crossReference() != null) {
contentJson.addProperty("cross_reference", updateTrainingExampleOptions.crossReference());
}
if (updateTrainingExampleOptions.relevance() != null) {
contentJson.addProperty("relevance", updateTrainingExampleOptions.relevance());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingExample.class));
} | java | public ServiceCall<TrainingExample> updateTrainingExample(UpdateTrainingExampleOptions updateTrainingExampleOptions) {
Validator.notNull(updateTrainingExampleOptions, "updateTrainingExampleOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" };
String[] pathParameters = { updateTrainingExampleOptions.environmentId(), updateTrainingExampleOptions
.collectionId(), updateTrainingExampleOptions.queryId(), updateTrainingExampleOptions.exampleId() };
RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateTrainingExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateTrainingExampleOptions.crossReference() != null) {
contentJson.addProperty("cross_reference", updateTrainingExampleOptions.crossReference());
}
if (updateTrainingExampleOptions.relevance() != null) {
contentJson.addProperty("relevance", updateTrainingExampleOptions.relevance());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingExample.class));
} | [
"public",
"ServiceCall",
"<",
"TrainingExample",
">",
"updateTrainingExample",
"(",
"UpdateTrainingExampleOptions",
"updateTrainingExampleOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateTrainingExampleOptions",
",",
"\"updateTrainingExampleOptions cannot be null\"",
... | Change label or cross reference for example.
Changes the label or cross reference query for this training data example.
@param updateTrainingExampleOptions the {@link UpdateTrainingExampleOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link TrainingExample} | [
"Change",
"label",
"or",
"cross",
"reference",
"for",
"example",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L1772-L1794 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.createEvent | public ServiceCall<CreateEventResponse> createEvent(CreateEventOptions createEventOptions) {
Validator.notNull(createEventOptions, "createEventOptions cannot be null");
String[] pathSegments = { "v1/events" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createEvent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("type", createEventOptions.type());
contentJson.add("data", GsonSingleton.getGson().toJsonTree(createEventOptions.data()));
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CreateEventResponse.class));
} | java | public ServiceCall<CreateEventResponse> createEvent(CreateEventOptions createEventOptions) {
Validator.notNull(createEventOptions, "createEventOptions cannot be null");
String[] pathSegments = { "v1/events" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createEvent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("type", createEventOptions.type());
contentJson.add("data", GsonSingleton.getGson().toJsonTree(createEventOptions.data()));
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CreateEventResponse.class));
} | [
"public",
"ServiceCall",
"<",
"CreateEventResponse",
">",
"createEvent",
"(",
"CreateEventOptions",
"createEventOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createEventOptions",
",",
"\"createEventOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathS... | Create event.
The **Events** API can be used to create log entries that are associated with specific queries. For example, you
can record which documents in the results set were \"clicked\" by a user and when that click occured.
@param createEventOptions the {@link CreateEventOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link CreateEventResponse} | [
"Create",
"event",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L1831-L1846 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.getMetricsEventRate | public ServiceCall<MetricResponse> getMetricsEventRate(GetMetricsEventRateOptions getMetricsEventRateOptions) {
String[] pathSegments = { "v1/metrics/event_rate" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsEventRate");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getMetricsEventRateOptions != null) {
if (getMetricsEventRateOptions.startTime() != null) {
builder.query("start_time", String.valueOf(getMetricsEventRateOptions.startTime()));
}
if (getMetricsEventRateOptions.endTime() != null) {
builder.query("end_time", String.valueOf(getMetricsEventRateOptions.endTime()));
}
if (getMetricsEventRateOptions.resultType() != null) {
builder.query("result_type", getMetricsEventRateOptions.resultType());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MetricResponse.class));
} | java | public ServiceCall<MetricResponse> getMetricsEventRate(GetMetricsEventRateOptions getMetricsEventRateOptions) {
String[] pathSegments = { "v1/metrics/event_rate" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsEventRate");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getMetricsEventRateOptions != null) {
if (getMetricsEventRateOptions.startTime() != null) {
builder.query("start_time", String.valueOf(getMetricsEventRateOptions.startTime()));
}
if (getMetricsEventRateOptions.endTime() != null) {
builder.query("end_time", String.valueOf(getMetricsEventRateOptions.endTime()));
}
if (getMetricsEventRateOptions.resultType() != null) {
builder.query("result_type", getMetricsEventRateOptions.resultType());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MetricResponse.class));
} | [
"public",
"ServiceCall",
"<",
"MetricResponse",
">",
"getMetricsEventRate",
"(",
"GetMetricsEventRateOptions",
"getMetricsEventRateOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/metrics/event_rate\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
... | Percentage of queries with an associated event.
The percentage of queries using the **natural_language_query** parameter that have a corresponding \"click\" event
over a specified time window. This metric requires having integrated event tracking in your application using the
**Events** API.
@param getMetricsEventRateOptions the {@link GetMetricsEventRateOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link MetricResponse} | [
"Percentage",
"of",
"queries",
"with",
"an",
"associated",
"event",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L1858-L1879 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.getMetricsQueryTokenEvent | public ServiceCall<MetricTokenResponse> getMetricsQueryTokenEvent(
GetMetricsQueryTokenEventOptions getMetricsQueryTokenEventOptions) {
String[] pathSegments = { "v1/metrics/top_query_tokens_with_event_rate" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQueryTokenEvent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getMetricsQueryTokenEventOptions != null) {
if (getMetricsQueryTokenEventOptions.count() != null) {
builder.query("count", String.valueOf(getMetricsQueryTokenEventOptions.count()));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MetricTokenResponse.class));
} | java | public ServiceCall<MetricTokenResponse> getMetricsQueryTokenEvent(
GetMetricsQueryTokenEventOptions getMetricsQueryTokenEventOptions) {
String[] pathSegments = { "v1/metrics/top_query_tokens_with_event_rate" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQueryTokenEvent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getMetricsQueryTokenEventOptions != null) {
if (getMetricsQueryTokenEventOptions.count() != null) {
builder.query("count", String.valueOf(getMetricsQueryTokenEventOptions.count()));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MetricTokenResponse.class));
} | [
"public",
"ServiceCall",
"<",
"MetricTokenResponse",
">",
"getMetricsQueryTokenEvent",
"(",
"GetMetricsQueryTokenEventOptions",
"getMetricsQueryTokenEventOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/metrics/top_query_tokens_with_event_rate\"",
"}",
";... | Most frequent query tokens with an event.
The most frequent query tokens parsed from the **natural_language_query** parameter and their corresponding
\"click\" event rate within the recording period (queries and events are stored for 30 days). A query token is an
individual word or unigram within the query string.
@param getMetricsQueryTokenEventOptions the {@link GetMetricsQueryTokenEventOptions} containing the options for the
call
@return a {@link ServiceCall} with a response type of {@link MetricTokenResponse} | [
"Most",
"frequent",
"query",
"tokens",
"with",
"an",
"event",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2039-L2055 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.queryLog | public ServiceCall<LogQueryResponse> queryLog(QueryLogOptions queryLogOptions) {
String[] pathSegments = { "v1/logs" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "queryLog");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (queryLogOptions != null) {
if (queryLogOptions.filter() != null) {
builder.query("filter", queryLogOptions.filter());
}
if (queryLogOptions.query() != null) {
builder.query("query", queryLogOptions.query());
}
if (queryLogOptions.count() != null) {
builder.query("count", String.valueOf(queryLogOptions.count()));
}
if (queryLogOptions.offset() != null) {
builder.query("offset", String.valueOf(queryLogOptions.offset()));
}
if (queryLogOptions.sort() != null) {
builder.query("sort", RequestUtils.join(queryLogOptions.sort(), ","));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogQueryResponse.class));
} | java | public ServiceCall<LogQueryResponse> queryLog(QueryLogOptions queryLogOptions) {
String[] pathSegments = { "v1/logs" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "queryLog");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (queryLogOptions != null) {
if (queryLogOptions.filter() != null) {
builder.query("filter", queryLogOptions.filter());
}
if (queryLogOptions.query() != null) {
builder.query("query", queryLogOptions.query());
}
if (queryLogOptions.count() != null) {
builder.query("count", String.valueOf(queryLogOptions.count()));
}
if (queryLogOptions.offset() != null) {
builder.query("offset", String.valueOf(queryLogOptions.offset()));
}
if (queryLogOptions.sort() != null) {
builder.query("sort", RequestUtils.join(queryLogOptions.sort(), ","));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogQueryResponse.class));
} | [
"public",
"ServiceCall",
"<",
"LogQueryResponse",
">",
"queryLog",
"(",
"QueryLogOptions",
"queryLogOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/logs\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
"RequestBuilder",
".",
"get",
"(",
"R... | Search the query and event log.
Searches the query and event log to find query sessions that match the specified criteria. Searching the **logs**
endpoint uses the standard Discovery query syntax for the parameters that are supported.
@param queryLogOptions the {@link QueryLogOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link LogQueryResponse} | [
"Search",
"the",
"query",
"and",
"event",
"log",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2079-L2106 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.getCredentials | public ServiceCall<Credentials> getCredentials(GetCredentialsOptions getCredentialsOptions) {
Validator.notNull(getCredentialsOptions, "getCredentialsOptions cannot be null");
String[] pathSegments = { "v1/environments", "credentials" };
String[] pathParameters = { getCredentialsOptions.environmentId(), getCredentialsOptions.credentialId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Credentials.class));
} | java | public ServiceCall<Credentials> getCredentials(GetCredentialsOptions getCredentialsOptions) {
Validator.notNull(getCredentialsOptions, "getCredentialsOptions cannot be null");
String[] pathSegments = { "v1/environments", "credentials" };
String[] pathParameters = { getCredentialsOptions.environmentId(), getCredentialsOptions.credentialId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Credentials.class));
} | [
"public",
"ServiceCall",
"<",
"Credentials",
">",
"getCredentials",
"(",
"GetCredentialsOptions",
"getCredentialsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getCredentialsOptions",
",",
"\"getCredentialsOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
... | View Credentials.
Returns details about the specified credentials.
**Note:** Secure credential information such as a password or SSH key is never returned and must be obtained from
the source system.
@param getCredentialsOptions the {@link GetCredentialsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Credentials} | [
"View",
"Credentials",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2189-L2202 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.listCredentials | public ServiceCall<CredentialsList> listCredentials(ListCredentialsOptions listCredentialsOptions) {
Validator.notNull(listCredentialsOptions, "listCredentialsOptions cannot be null");
String[] pathSegments = { "v1/environments", "credentials" };
String[] pathParameters = { listCredentialsOptions.environmentId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CredentialsList.class));
} | java | public ServiceCall<CredentialsList> listCredentials(ListCredentialsOptions listCredentialsOptions) {
Validator.notNull(listCredentialsOptions, "listCredentialsOptions cannot be null");
String[] pathSegments = { "v1/environments", "credentials" };
String[] pathParameters = { listCredentialsOptions.environmentId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CredentialsList.class));
} | [
"public",
"ServiceCall",
"<",
"CredentialsList",
">",
"listCredentials",
"(",
"ListCredentialsOptions",
"listCredentialsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listCredentialsOptions",
",",
"\"listCredentialsOptions cannot be null\"",
")",
";",
"String",
"[",... | List credentials.
List all the source credentials that have been created for this service instance.
**Note:** All credentials are sent over an encrypted connection and encrypted at rest.
@param listCredentialsOptions the {@link ListCredentialsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link CredentialsList} | [
"List",
"credentials",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2214-L2227 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.updateCredentials | public ServiceCall<Credentials> updateCredentials(UpdateCredentialsOptions updateCredentialsOptions) {
Validator.notNull(updateCredentialsOptions, "updateCredentialsOptions cannot be null");
String[] pathSegments = { "v1/environments", "credentials" };
String[] pathParameters = { updateCredentialsOptions.environmentId(), updateCredentialsOptions.credentialId() };
RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateCredentialsOptions.sourceType() != null) {
contentJson.addProperty("source_type", updateCredentialsOptions.sourceType());
}
if (updateCredentialsOptions.credentialDetails() != null) {
contentJson.add("credential_details", GsonSingleton.getGson().toJsonTree(updateCredentialsOptions
.credentialDetails()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Credentials.class));
} | java | public ServiceCall<Credentials> updateCredentials(UpdateCredentialsOptions updateCredentialsOptions) {
Validator.notNull(updateCredentialsOptions, "updateCredentialsOptions cannot be null");
String[] pathSegments = { "v1/environments", "credentials" };
String[] pathParameters = { updateCredentialsOptions.environmentId(), updateCredentialsOptions.credentialId() };
RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateCredentialsOptions.sourceType() != null) {
contentJson.addProperty("source_type", updateCredentialsOptions.sourceType());
}
if (updateCredentialsOptions.credentialDetails() != null) {
contentJson.add("credential_details", GsonSingleton.getGson().toJsonTree(updateCredentialsOptions
.credentialDetails()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Credentials.class));
} | [
"public",
"ServiceCall",
"<",
"Credentials",
">",
"updateCredentials",
"(",
"UpdateCredentialsOptions",
"updateCredentialsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateCredentialsOptions",
",",
"\"updateCredentialsOptions cannot be null\"",
")",
";",
"String",
... | Update credentials.
Updates an existing set of source credentials.
**Note:** All credentials are sent over an encrypted connection and encrypted at rest.
@param updateCredentialsOptions the {@link UpdateCredentialsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Credentials} | [
"Update",
"credentials",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2239-L2261 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.createGateway | public ServiceCall<Gateway> createGateway(CreateGatewayOptions createGatewayOptions) {
Validator.notNull(createGatewayOptions, "createGatewayOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { createGatewayOptions.environmentId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createGateway");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (createGatewayOptions.name() != null) {
contentJson.addProperty("name", createGatewayOptions.name());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class));
} | java | public ServiceCall<Gateway> createGateway(CreateGatewayOptions createGatewayOptions) {
Validator.notNull(createGatewayOptions, "createGatewayOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { createGatewayOptions.environmentId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createGateway");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (createGatewayOptions.name() != null) {
contentJson.addProperty("name", createGatewayOptions.name());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class));
} | [
"public",
"ServiceCall",
"<",
"Gateway",
">",
"createGateway",
"(",
"CreateGatewayOptions",
"createGatewayOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createGatewayOptions",
",",
"\"createGatewayOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSeg... | Create Gateway.
Create a gateway configuration to use with a remotely installed gateway.
@param createGatewayOptions the {@link CreateGatewayOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Gateway} | [
"Create",
"Gateway",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2271-L2289 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.getGateway | public ServiceCall<Gateway> getGateway(GetGatewayOptions getGatewayOptions) {
Validator.notNull(getGatewayOptions, "getGatewayOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { getGatewayOptions.environmentId(), getGatewayOptions.gatewayId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getGateway");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class));
} | java | public ServiceCall<Gateway> getGateway(GetGatewayOptions getGatewayOptions) {
Validator.notNull(getGatewayOptions, "getGatewayOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { getGatewayOptions.environmentId(), getGatewayOptions.gatewayId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getGateway");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class));
} | [
"public",
"ServiceCall",
"<",
"Gateway",
">",
"getGateway",
"(",
"GetGatewayOptions",
"getGatewayOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getGatewayOptions",
",",
"\"getGatewayOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
... | List Gateway Details.
List information about the specified gateway.
@param getGatewayOptions the {@link GetGatewayOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Gateway} | [
"List",
"Gateway",
"Details",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2322-L2335 | train |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java | Discovery.listGateways | public ServiceCall<GatewayList> listGateways(ListGatewaysOptions listGatewaysOptions) {
Validator.notNull(listGatewaysOptions, "listGatewaysOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { listGatewaysOptions.environmentId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listGateways");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(GatewayList.class));
} | java | public ServiceCall<GatewayList> listGateways(ListGatewaysOptions listGatewaysOptions) {
Validator.notNull(listGatewaysOptions, "listGatewaysOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { listGatewaysOptions.environmentId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listGateways");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(GatewayList.class));
} | [
"public",
"ServiceCall",
"<",
"GatewayList",
">",
"listGateways",
"(",
"ListGatewaysOptions",
"listGatewaysOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listGatewaysOptions",
",",
"\"listGatewaysOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegm... | List Gateways.
List the currently configured gateways.
@param listGatewaysOptions the {@link ListGatewaysOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link GatewayList} | [
"List",
"Gateways",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java#L2345-L2358 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.getModel | public ServiceCall<SpeechModel> getModel(GetModelOptions getModelOptions) {
Validator.notNull(getModelOptions, "getModelOptions cannot be null");
String[] pathSegments = { "v1/models" };
String[] pathParameters = { getModelOptions.modelId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SpeechModel.class));
} | java | public ServiceCall<SpeechModel> getModel(GetModelOptions getModelOptions) {
Validator.notNull(getModelOptions, "getModelOptions cannot be null");
String[] pathSegments = { "v1/models" };
String[] pathParameters = { getModelOptions.modelId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SpeechModel.class));
} | [
"public",
"ServiceCall",
"<",
"SpeechModel",
">",
"getModel",
"(",
"GetModelOptions",
"getModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getModelOptions",
",",
"\"getModelOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",... | Get a model.
Gets information for a single specified language model that is available for use with the service. The information
includes the name of the model and its minimum sampling rate in Hertz, among other things.
**See also:** [Languages and models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
@param getModelOptions the {@link GetModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link SpeechModel} | [
"Get",
"a",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L168-L180 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.recognizeUsingWebSocket | public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback) {
Validator.notNull(recognizeOptions, "recognizeOptions cannot be null");
Validator.notNull(recognizeOptions.audio(), "audio cannot be null");
Validator.notNull(callback, "callback cannot be null");
HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/recognize").newBuilder();
if (recognizeOptions.model() != null) {
urlBuilder.addQueryParameter("model", recognizeOptions.model());
}
if (recognizeOptions.customizationId() != null) {
urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId());
}
if (recognizeOptions.languageCustomizationId() != null) {
urlBuilder.addQueryParameter("language_customization_id", recognizeOptions.languageCustomizationId());
}
if (recognizeOptions.acousticCustomizationId() != null) {
urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId());
}
if (recognizeOptions.baseModelVersion() != null) {
urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion());
}
String url = urlBuilder.toString().replace("https://", "wss://");
Request.Builder builder = new Request.Builder().url(url);
setAuthentication(builder);
setDefaultHeaders(builder);
OkHttpClient client = configureHttpClient();
return client.newWebSocket(builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback));
} | java | public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback) {
Validator.notNull(recognizeOptions, "recognizeOptions cannot be null");
Validator.notNull(recognizeOptions.audio(), "audio cannot be null");
Validator.notNull(callback, "callback cannot be null");
HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/recognize").newBuilder();
if (recognizeOptions.model() != null) {
urlBuilder.addQueryParameter("model", recognizeOptions.model());
}
if (recognizeOptions.customizationId() != null) {
urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId());
}
if (recognizeOptions.languageCustomizationId() != null) {
urlBuilder.addQueryParameter("language_customization_id", recognizeOptions.languageCustomizationId());
}
if (recognizeOptions.acousticCustomizationId() != null) {
urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId());
}
if (recognizeOptions.baseModelVersion() != null) {
urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion());
}
String url = urlBuilder.toString().replace("https://", "wss://");
Request.Builder builder = new Request.Builder().url(url);
setAuthentication(builder);
setDefaultHeaders(builder);
OkHttpClient client = configureHttpClient();
return client.newWebSocket(builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback));
} | [
"public",
"WebSocket",
"recognizeUsingWebSocket",
"(",
"RecognizeOptions",
"recognizeOptions",
",",
"RecognizeCallback",
"callback",
")",
"{",
"Validator",
".",
"notNull",
"(",
"recognizeOptions",
",",
"\"recognizeOptions cannot be null\"",
")",
";",
"Validator",
".",
"no... | Sends audio and returns transcription results for recognition requests over a WebSocket connection. Requests and
responses are enabled over a single TCP connection that abstracts much of the complexity of the request to offer
efficient implementation, low latency, high throughput, and an asynchronous response. By default, only final
results are returned for any request; to enable interim results, set the interimResults parameter to true.
The service imposes a data size limit of 100 MB per utterance (per recognition request). You can send multiple
utterances over a single WebSocket connection. The service automatically detects the endianness of the incoming
audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding.
(For the audio/l16 format, you can specify the endianness.)
@param recognizeOptions the recognize options
@param callback the {@link RecognizeCallback} instance where results will be sent
@return the {@link WebSocket} | [
"Sends",
"audio",
"and",
"returns",
"transcription",
"results",
"for",
"recognition",
"requests",
"over",
"a",
"WebSocket",
"connection",
".",
"Requests",
"and",
"responses",
"are",
"enabled",
"over",
"a",
"single",
"TCP",
"connection",
"that",
"abstracts",
"much"... | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L381-L412 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.checkJob | public ServiceCall<RecognitionJob> checkJob(CheckJobOptions checkJobOptions) {
Validator.notNull(checkJobOptions, "checkJobOptions cannot be null");
String[] pathSegments = { "v1/recognitions" };
String[] pathParameters = { checkJobOptions.id() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "checkJob");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RecognitionJob.class));
} | java | public ServiceCall<RecognitionJob> checkJob(CheckJobOptions checkJobOptions) {
Validator.notNull(checkJobOptions, "checkJobOptions cannot be null");
String[] pathSegments = { "v1/recognitions" };
String[] pathParameters = { checkJobOptions.id() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "checkJob");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RecognitionJob.class));
} | [
"public",
"ServiceCall",
"<",
"RecognitionJob",
">",
"checkJob",
"(",
"CheckJobOptions",
"checkJobOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"checkJobOptions",
",",
"\"checkJobOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"... | Check a job.
Returns information about the specified job. The response always includes the status of the job and its creation
and update times. If the status is `completed`, the response includes the results of the recognition request. You
must use credentials for the instance of the service that owns a job to list information about it.
You can use the method to retrieve the results of any job, regardless of whether it was submitted with a callback
URL and the `recognitions.completed_with_results` event, and you can retrieve the results multiple times for as
long as they remain available. Use the **Check jobs** method to request information about the most recent jobs
associated with the calling credentials.
**See also:** [Checking the status and retrieving the results of a
job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#job).
@param checkJobOptions the {@link CheckJobOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link RecognitionJob} | [
"Check",
"a",
"job",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L432-L444 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.checkJobs | public ServiceCall<RecognitionJobs> checkJobs(CheckJobsOptions checkJobsOptions) {
String[] pathSegments = { "v1/recognitions" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "checkJobs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (checkJobsOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RecognitionJobs.class));
} | java | public ServiceCall<RecognitionJobs> checkJobs(CheckJobsOptions checkJobsOptions) {
String[] pathSegments = { "v1/recognitions" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "checkJobs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (checkJobsOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RecognitionJobs.class));
} | [
"public",
"ServiceCall",
"<",
"RecognitionJobs",
">",
"checkJobs",
"(",
"CheckJobsOptions",
"checkJobsOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/recognitions\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
"RequestBuilder",
".",
"get",
... | Check jobs.
Returns the ID and status of the latest 100 outstanding jobs associated with the credentials with which it is
called. The method also returns the creation and update times of each job, and, if a job was created with a
callback URL and a user token, the user token for the job. To obtain the results for a job whose status is
`completed` or not one of the latest 100 outstanding jobs, use the **Check a job** method. A job and its results
remain available until you delete them with the **Delete a job** method or until the job's time to live expires,
whichever comes first.
**See also:** [Checking the status of the latest
jobs](https://cloud.ibm.com/docs/services/speech-to-text/async.html#jobs).
@param checkJobsOptions the {@link CheckJobsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link RecognitionJobs} | [
"Check",
"jobs",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L462-L473 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.deleteJob | public ServiceCall<Void> deleteJob(DeleteJobOptions deleteJobOptions) {
Validator.notNull(deleteJobOptions, "deleteJobOptions cannot be null");
String[] pathSegments = { "v1/recognitions" };
String[] pathParameters = { deleteJobOptions.id() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteJob");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> deleteJob(DeleteJobOptions deleteJobOptions) {
Validator.notNull(deleteJobOptions, "deleteJobOptions cannot be null");
String[] pathSegments = { "v1/recognitions" };
String[] pathParameters = { deleteJobOptions.id() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteJob");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"deleteJob",
"(",
"DeleteJobOptions",
"deleteJobOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"deleteJobOptions",
",",
"\"deleteJobOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
... | Delete a job.
Deletes the specified job. You cannot delete a job that the service is actively processing. Once you delete a job,
its results are no longer available. The service automatically deletes a job and its results when the time to live
for the results expires. You must use credentials for the instance of the service that owns a job to delete it.
**See also:** [Deleting a job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#delete-async).
@param deleteJobOptions the {@link DeleteJobOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Delete",
"a",
"job",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L672-L683 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.registerCallback | public ServiceCall<RegisterStatus> registerCallback(RegisterCallbackOptions registerCallbackOptions) {
Validator.notNull(registerCallbackOptions, "registerCallbackOptions cannot be null");
String[] pathSegments = { "v1/register_callback" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "registerCallback");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("callback_url", registerCallbackOptions.callbackUrl());
if (registerCallbackOptions.userSecret() != null) {
builder.query("user_secret", registerCallbackOptions.userSecret());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RegisterStatus.class));
} | java | public ServiceCall<RegisterStatus> registerCallback(RegisterCallbackOptions registerCallbackOptions) {
Validator.notNull(registerCallbackOptions, "registerCallbackOptions cannot be null");
String[] pathSegments = { "v1/register_callback" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "registerCallback");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("callback_url", registerCallbackOptions.callbackUrl());
if (registerCallbackOptions.userSecret() != null) {
builder.query("user_secret", registerCallbackOptions.userSecret());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RegisterStatus.class));
} | [
"public",
"ServiceCall",
"<",
"RegisterStatus",
">",
"registerCallback",
"(",
"RegisterCallbackOptions",
"registerCallbackOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"registerCallbackOptions",
",",
"\"registerCallbackOptions cannot be null\"",
")",
";",
"String",
... | Register a callback.
Registers a callback URL with the service for use with subsequent asynchronous recognition requests. The service
attempts to register, or white-list, the callback URL if it is not already registered by sending a `GET` request to
the callback URL. The service passes a random alphanumeric challenge string via the `challenge_string` parameter of
the request. The request includes an `Accept` header that specifies `text/plain` as the required response type.
To be registered successfully, the callback URL must respond to the `GET` request from the service. The response
must send status code 200 and must include the challenge string in its body. Set the `Content-Type` response header
to `text/plain`. Upon receiving this response, the service responds to the original registration request with
response code 201.
The service sends only a single `GET` request to the callback URL. If the service does not receive a reply with a
response code of 200 and a body that echoes the challenge string sent by the service within five seconds, it does
not white-list the URL; it instead sends status code 400 in response to the **Register a callback** request. If the
requested callback URL is already white-listed, the service responds to the initial registration request with
response code 200.
If you specify a user secret with the request, the service uses it as a key to calculate an HMAC-SHA1 signature of
the challenge string in its response to the `POST` request. It sends this signature in the `X-Callback-Signature`
header of its `GET` request to the URL during registration. It also uses the secret to calculate a signature over
the payload of every callback notification that uses the URL. The signature provides authentication and data
integrity for HTTP communications.
After you successfully register a callback URL, you can use it with an indefinite number of recognition requests.
You can register a maximum of 20 callback URLS in a one-hour span of time.
**See also:** [Registering a callback URL](https://cloud.ibm.com/docs/services/speech-to-text/async.html#register).
@param registerCallbackOptions the {@link RegisterCallbackOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link RegisterStatus} | [
"Register",
"a",
"callback",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L718-L732 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.unregisterCallback | public ServiceCall<Void> unregisterCallback(UnregisterCallbackOptions unregisterCallbackOptions) {
Validator.notNull(unregisterCallbackOptions, "unregisterCallbackOptions cannot be null");
String[] pathSegments = { "v1/unregister_callback" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "unregisterCallback");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.query("callback_url", unregisterCallbackOptions.callbackUrl());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> unregisterCallback(UnregisterCallbackOptions unregisterCallbackOptions) {
Validator.notNull(unregisterCallbackOptions, "unregisterCallbackOptions cannot be null");
String[] pathSegments = { "v1/unregister_callback" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "unregisterCallback");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.query("callback_url", unregisterCallbackOptions.callbackUrl());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"unregisterCallback",
"(",
"UnregisterCallbackOptions",
"unregisterCallbackOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"unregisterCallbackOptions",
",",
"\"unregisterCallbackOptions cannot be null\"",
")",
";",
"String",
... | Unregister a callback.
Unregisters a callback URL that was previously white-listed with a **Register a callback** request for use with the
asynchronous interface. Once unregistered, the URL can no longer be used with asynchronous recognition requests.
**See also:** [Unregistering a callback
URL](https://cloud.ibm.com/docs/services/speech-to-text/async.html#unregister).
@param unregisterCallbackOptions the {@link UnregisterCallbackOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Unregister",
"a",
"callback",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L746-L756 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.createLanguageModel | public ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) {
Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createLanguageModelOptions.name());
contentJson.addProperty("base_model_name", createLanguageModelOptions.baseModelName());
if (createLanguageModelOptions.dialect() != null) {
contentJson.addProperty("dialect", createLanguageModelOptions.dialect());
}
if (createLanguageModelOptions.description() != null) {
contentJson.addProperty("description", createLanguageModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
} | java | public ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) {
Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createLanguageModelOptions.name());
contentJson.addProperty("base_model_name", createLanguageModelOptions.baseModelName());
if (createLanguageModelOptions.dialect() != null) {
contentJson.addProperty("dialect", createLanguageModelOptions.dialect());
}
if (createLanguageModelOptions.description() != null) {
contentJson.addProperty("description", createLanguageModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
} | [
"public",
"ServiceCall",
"<",
"LanguageModel",
">",
"createLanguageModel",
"(",
"CreateLanguageModelOptions",
"createLanguageModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createLanguageModelOptions",
",",
"\"createLanguageModelOptions cannot be null\"",
")",
";",
... | Create a custom language model.
Creates a new custom language model for a specified base model. The custom language model can be used only with the
base model for which it is created. The model is owned by the instance of the service whose credentials are used to
create it.
**See also:** [Create a custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#createModel-language).
@param createLanguageModelOptions the {@link CreateLanguageModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link LanguageModel} | [
"Create",
"a",
"custom",
"language",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L771-L791 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.deleteLanguageModel | public ServiceCall<Void> deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions) {
Validator.notNull(deleteLanguageModelOptions, "deleteLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { deleteLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions) {
Validator.notNull(deleteLanguageModelOptions, "deleteLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { deleteLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"deleteLanguageModel",
"(",
"DeleteLanguageModelOptions",
"deleteLanguageModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"deleteLanguageModelOptions",
",",
"\"deleteLanguageModelOptions cannot be null\"",
")",
";",
"String... | Delete a custom language model.
Deletes an existing custom language model. The custom model cannot be deleted if another request, such as adding a
corpus or grammar to the model, is currently being processed. You must use credentials for the instance of the
service that owns a model to delete it.
**See also:** [Deleting a custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#deleteModel-language).
@param deleteLanguageModelOptions the {@link DeleteLanguageModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Delete",
"a",
"custom",
"language",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L806-L818 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.getLanguageModel | public ServiceCall<LanguageModel> getLanguageModel(GetLanguageModelOptions getLanguageModelOptions) {
Validator.notNull(getLanguageModelOptions, "getLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { getLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
} | java | public ServiceCall<LanguageModel> getLanguageModel(GetLanguageModelOptions getLanguageModelOptions) {
Validator.notNull(getLanguageModelOptions, "getLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { getLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
} | [
"public",
"ServiceCall",
"<",
"LanguageModel",
">",
"getLanguageModel",
"(",
"GetLanguageModelOptions",
"getLanguageModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getLanguageModelOptions",
",",
"\"getLanguageModelOptions cannot be null\"",
")",
";",
"String",
"... | Get a custom language model.
Gets information about a specified custom language model. You must use credentials for the instance of the service
that owns a model to list information about it.
**See also:** [Listing custom language
models](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#listModels-language).
@param getLanguageModelOptions the {@link GetLanguageModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link LanguageModel} | [
"Get",
"a",
"custom",
"language",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L832-L844 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.listLanguageModels | public ServiceCall<LanguageModels> listLanguageModels(ListLanguageModelsOptions listLanguageModelsOptions) {
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listLanguageModels");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listLanguageModelsOptions != null) {
if (listLanguageModelsOptions.language() != null) {
builder.query("language", listLanguageModelsOptions.language());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModels.class));
} | java | public ServiceCall<LanguageModels> listLanguageModels(ListLanguageModelsOptions listLanguageModelsOptions) {
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listLanguageModels");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listLanguageModelsOptions != null) {
if (listLanguageModelsOptions.language() != null) {
builder.query("language", listLanguageModelsOptions.language());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModels.class));
} | [
"public",
"ServiceCall",
"<",
"LanguageModels",
">",
"listLanguageModels",
"(",
"ListLanguageModelsOptions",
"listLanguageModelsOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/customizations\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
"Reques... | List custom language models.
Lists information about all custom language models that are owned by an instance of the service. Use the `language`
parameter to see all custom language models for the specified language. Omit the parameter to see all custom
language models for all languages. You must use credentials for the instance of the service that owns a model to
list information about it.
**See also:** [Listing custom language
models](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#listModels-language).
@param listLanguageModelsOptions the {@link ListLanguageModelsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link LanguageModels} | [
"List",
"custom",
"language",
"models",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L860-L874 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.trainLanguageModel | public ServiceCall<Void> trainLanguageModel(TrainLanguageModelOptions trainLanguageModelOptions) {
Validator.notNull(trainLanguageModelOptions, "trainLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations", "train" };
String[] pathParameters = { trainLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "trainLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (trainLanguageModelOptions.wordTypeToAdd() != null) {
builder.query("word_type_to_add", trainLanguageModelOptions.wordTypeToAdd());
}
if (trainLanguageModelOptions.customizationWeight() != null) {
builder.query("customization_weight", String.valueOf(trainLanguageModelOptions.customizationWeight()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> trainLanguageModel(TrainLanguageModelOptions trainLanguageModelOptions) {
Validator.notNull(trainLanguageModelOptions, "trainLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations", "train" };
String[] pathParameters = { trainLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "trainLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (trainLanguageModelOptions.wordTypeToAdd() != null) {
builder.query("word_type_to_add", trainLanguageModelOptions.wordTypeToAdd());
}
if (trainLanguageModelOptions.customizationWeight() != null) {
builder.query("customization_weight", String.valueOf(trainLanguageModelOptions.customizationWeight()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"trainLanguageModel",
"(",
"TrainLanguageModelOptions",
"trainLanguageModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"trainLanguageModelOptions",
",",
"\"trainLanguageModelOptions cannot be null\"",
")",
";",
"String",
... | Train a custom language model.
Initiates the training of a custom language model with new resources such as corpora, grammars, and custom words.
After adding, modifying, or deleting resources for a custom language model, use this method to begin the actual
training of the model on the latest data. You can specify whether the custom language model is to be trained with
all words from its words resource or only with words that were added or modified by the user directly. You must use
credentials for the instance of the service that owns a model to train it.
The training method is asynchronous. It can take on the order of minutes to complete depending on the amount of
data on which the service is being trained and the current load on the service. The method returns an HTTP 200
response code to indicate that the training process has begun.
You can monitor the status of the training by using the **Get a custom language model** method to poll the model's
status. Use a loop to check the status every 10 seconds. The method returns a `LanguageModel` object that includes
`status` and `progress` fields. A status of `available` means that the custom model is trained and ready to use.
The service cannot accept subsequent training requests or requests to add new resources until the existing request
completes.
Training can fail to start for the following reasons:
* The service is currently handling another request for the custom model, such as another training request or a
request to add a corpus or grammar to the model.
* No training data have been added to the custom model.
* One or more words that were added to the custom model have invalid sounds-like pronunciations that you must fix.
**See also:** [Train the custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#trainModel-language).
@param trainLanguageModelOptions the {@link TrainLanguageModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Train",
"a",
"custom",
"language",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L952-L970 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.addCorpus | public ServiceCall<Void> addCorpus(AddCorpusOptions addCorpusOptions) {
Validator.notNull(addCorpusOptions, "addCorpusOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { addCorpusOptions.customizationId(), addCorpusOptions.corpusName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (addCorpusOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite()));
}
builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> addCorpus(AddCorpusOptions addCorpusOptions) {
Validator.notNull(addCorpusOptions, "addCorpusOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { addCorpusOptions.customizationId(), addCorpusOptions.corpusName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (addCorpusOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite()));
}
builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"addCorpus",
"(",
"AddCorpusOptions",
"addCorpusOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"addCorpusOptions",
",",
"\"addCorpusOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
... | Add a corpus.
Adds a single corpus text file of new training data to a custom language model. Use multiple requests to submit
multiple corpus text files. You must use credentials for the instance of the service that owns a model to add a
corpus to it. Adding a corpus does not affect the custom language model until you train the model for the new data
by using the **Train a custom language model** method.
Submit a plain text file that contains sample sentences from the domain of interest to enable the service to
extract words in context. The more sentences you add that represent the context in which speakers use words from
the domain, the better the service's recognition accuracy.
The call returns an HTTP 201 response code if the corpus is valid. The service then asynchronously processes the
contents of the corpus and automatically extracts new words that it finds. This can take on the order of a minute
or two to complete depending on the total number of words and the number of new words in the corpus, as well as the
current load on the service. You cannot submit requests to add additional resources to the custom model or to train
the model until the service's analysis of the corpus for the current request completes. Use the **List a corpus**
method to check the status of the analysis.
The service auto-populates the model's words resource with words from the corpus that are not found in its base
vocabulary. These are referred to as out-of-vocabulary (OOV) words. You can use the **List custom words** method to
examine the words resource. You can use other words method to eliminate typos and modify how words are pronounced
as needed.
To add a corpus file that has the same name as an existing corpus, set the `allow_overwrite` parameter to `true`;
otherwise, the request fails. Overwriting an existing corpus causes the service to process the corpus text file and
extract OOV words anew. Before doing so, it removes any OOV words associated with the existing corpus from the
model's words resource unless they were also added by another corpus or grammar, or they have been modified in some
way with the **Add custom words** or **Add a custom word** method.
The service limits the overall amount of data that you can add to a custom model to a maximum of 10 million total
words from all sources combined. Also, you can add no more than 30 thousand custom (OOV) words to a model. This
includes words that the service extracts from corpora and grammars, and words that you add directly.
**See also:**
* [Working with corpora](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingCorpora)
* [Add corpora to the custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addCorpora).
@param addCorpusOptions the {@link AddCorpusOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Add",
"a",
"corpus",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1049-L1065 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.deleteCorpus | public ServiceCall<Void> deleteCorpus(DeleteCorpusOptions deleteCorpusOptions) {
Validator.notNull(deleteCorpusOptions, "deleteCorpusOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { deleteCorpusOptions.customizationId(), deleteCorpusOptions.corpusName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> deleteCorpus(DeleteCorpusOptions deleteCorpusOptions) {
Validator.notNull(deleteCorpusOptions, "deleteCorpusOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { deleteCorpusOptions.customizationId(), deleteCorpusOptions.corpusName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"deleteCorpus",
"(",
"DeleteCorpusOptions",
"deleteCorpusOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"deleteCorpusOptions",
",",
"\"deleteCorpusOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
... | Delete a corpus.
Deletes an existing corpus from a custom language model. The service removes any out-of-vocabulary (OOV) words that
are associated with the corpus from the custom model's words resource unless they were also added by another corpus
or grammar, or they were modified in some way with the **Add custom words** or **Add a custom word** method.
Removing a corpus does not affect the custom model until you train the model with the **Train a custom language
model** method. You must use credentials for the instance of the service that owns a model to delete its corpora.
**See also:** [Deleting a corpus from a custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#deleteCorpus).
@param deleteCorpusOptions the {@link DeleteCorpusOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Delete",
"a",
"corpus",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1082-L1094 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.getCorpus | public ServiceCall<Corpus> getCorpus(GetCorpusOptions getCorpusOptions) {
Validator.notNull(getCorpusOptions, "getCorpusOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { getCorpusOptions.customizationId(), getCorpusOptions.corpusName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Corpus.class));
} | java | public ServiceCall<Corpus> getCorpus(GetCorpusOptions getCorpusOptions) {
Validator.notNull(getCorpusOptions, "getCorpusOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { getCorpusOptions.customizationId(), getCorpusOptions.corpusName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Corpus.class));
} | [
"public",
"ServiceCall",
"<",
"Corpus",
">",
"getCorpus",
"(",
"GetCorpusOptions",
"getCorpusOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getCorpusOptions",
",",
"\"getCorpusOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",... | Get a corpus.
Gets information about a corpus from a custom language model. The information includes the total number of words
and out-of-vocabulary (OOV) words, name, and status of the corpus. You must use credentials for the instance of the
service that owns a model to list its corpora.
**See also:** [Listing corpora for a custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#listCorpora).
@param getCorpusOptions the {@link GetCorpusOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Corpus} | [
"Get",
"a",
"corpus",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1109-L1121 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.listCorpora | public ServiceCall<Corpora> listCorpora(ListCorporaOptions listCorporaOptions) {
Validator.notNull(listCorporaOptions, "listCorporaOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { listCorporaOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listCorpora");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Corpora.class));
} | java | public ServiceCall<Corpora> listCorpora(ListCorporaOptions listCorporaOptions) {
Validator.notNull(listCorporaOptions, "listCorporaOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { listCorporaOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listCorpora");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Corpora.class));
} | [
"public",
"ServiceCall",
"<",
"Corpora",
">",
"listCorpora",
"(",
"ListCorporaOptions",
"listCorporaOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listCorporaOptions",
",",
"\"listCorporaOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
... | List corpora.
Lists information about all corpora from a custom language model. The information includes the total number of
words and out-of-vocabulary (OOV) words, name, and status of each corpus. You must use credentials for the instance
of the service that owns a model to list its corpora.
**See also:** [Listing corpora for a custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#listCorpora).
@param listCorporaOptions the {@link ListCorporaOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Corpora} | [
"List",
"corpora",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1136-L1148 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.addGrammar | public ServiceCall<Void> addGrammar(AddGrammarOptions addGrammarOptions) {
Validator.notNull(addGrammarOptions, "addGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { addGrammarOptions.customizationId(), addGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Content-Type", addGrammarOptions.contentType());
if (addGrammarOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addGrammarOptions.allowOverwrite()));
}
builder.bodyContent(addGrammarOptions.contentType(), null, null, addGrammarOptions.grammarFile());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> addGrammar(AddGrammarOptions addGrammarOptions) {
Validator.notNull(addGrammarOptions, "addGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { addGrammarOptions.customizationId(), addGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Content-Type", addGrammarOptions.contentType());
if (addGrammarOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addGrammarOptions.allowOverwrite()));
}
builder.bodyContent(addGrammarOptions.contentType(), null, null, addGrammarOptions.grammarFile());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"addGrammar",
"(",
"AddGrammarOptions",
"addGrammarOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"addGrammarOptions",
",",
"\"addGrammarOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"... | Add a grammar.
Adds a single grammar file to a custom language model. Submit a plain text file in UTF-8 format that defines the
grammar. Use multiple requests to submit multiple grammar files. You must use credentials for the instance of the
service that owns a model to add a grammar to it. Adding a grammar does not affect the custom language model until
you train the model for the new data by using the **Train a custom language model** method.
The call returns an HTTP 201 response code if the grammar is valid. The service then asynchronously processes the
contents of the grammar and automatically extracts new words that it finds. This can take a few seconds to complete
depending on the size and complexity of the grammar, as well as the current load on the service. You cannot submit
requests to add additional resources to the custom model or to train the model until the service's analysis of the
grammar for the current request completes. Use the **Get a grammar** method to check the status of the analysis.
The service populates the model's words resource with any word that is recognized by the grammar that is not found
in the model's base vocabulary. These are referred to as out-of-vocabulary (OOV) words. You can use the **List
custom words** method to examine the words resource and use other words-related methods to eliminate typos and
modify how words are pronounced as needed.
To add a grammar that has the same name as an existing grammar, set the `allow_overwrite` parameter to `true`;
otherwise, the request fails. Overwriting an existing grammar causes the service to process the grammar file and
extract OOV words anew. Before doing so, it removes any OOV words associated with the existing grammar from the
model's words resource unless they were also added by another resource or they have been modified in some way with
the **Add custom words** or **Add a custom word** method.
The service limits the overall amount of data that you can add to a custom model to a maximum of 10 million total
words from all sources combined. Also, you can add no more than 30 thousand OOV words to a model. This includes
words that the service extracts from corpora and grammars and words that you add directly.
**See also:**
* [Working with grammars](https://cloud.ibm.com/docs/services/speech-to-text/)
* [Add grammars to the custom language model](https://cloud.ibm.com/docs/services/speech-to-text/).
@param addGrammarOptions the {@link AddGrammarOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Add",
"a",
"grammar",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1404-L1421 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.deleteGrammar | public ServiceCall<Void> deleteGrammar(DeleteGrammarOptions deleteGrammarOptions) {
Validator.notNull(deleteGrammarOptions, "deleteGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { deleteGrammarOptions.customizationId(), deleteGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> deleteGrammar(DeleteGrammarOptions deleteGrammarOptions) {
Validator.notNull(deleteGrammarOptions, "deleteGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { deleteGrammarOptions.customizationId(), deleteGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"deleteGrammar",
"(",
"DeleteGrammarOptions",
"deleteGrammarOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"deleteGrammarOptions",
",",
"\"deleteGrammarOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegmen... | Delete a grammar.
Deletes an existing grammar from a custom language model. The service removes any out-of-vocabulary (OOV) words
associated with the grammar from the custom model's words resource unless they were also added by another resource
or they were modified in some way with the **Add custom words** or **Add a custom word** method. Removing a grammar
does not affect the custom model until you train the model with the **Train a custom language model** method. You
must use credentials for the instance of the service that owns a model to delete its grammar.
**See also:** [Deleting a grammar from a custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/).
@param deleteGrammarOptions the {@link DeleteGrammarOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Delete",
"a",
"grammar",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1438-L1450 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.getGrammar | public ServiceCall<Grammar> getGrammar(GetGrammarOptions getGrammarOptions) {
Validator.notNull(getGrammarOptions, "getGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { getGrammarOptions.customizationId(), getGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Grammar.class));
} | java | public ServiceCall<Grammar> getGrammar(GetGrammarOptions getGrammarOptions) {
Validator.notNull(getGrammarOptions, "getGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { getGrammarOptions.customizationId(), getGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Grammar.class));
} | [
"public",
"ServiceCall",
"<",
"Grammar",
">",
"getGrammar",
"(",
"GetGrammarOptions",
"getGrammarOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getGrammarOptions",
",",
"\"getGrammarOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
... | Get a grammar.
Gets information about a grammar from a custom language model. The information includes the total number of
out-of-vocabulary (OOV) words, name, and status of the grammar. You must use credentials for the instance of the
service that owns a model to list its grammars.
**See also:** [Listing grammars from a custom language model](https://cloud.ibm.com/docs/services/speech-to-text/).
@param getGrammarOptions the {@link GetGrammarOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Grammar} | [
"Get",
"a",
"grammar",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1464-L1476 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.listGrammars | public ServiceCall<Grammars> listGrammars(ListGrammarsOptions listGrammarsOptions) {
Validator.notNull(listGrammarsOptions, "listGrammarsOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { listGrammarsOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listGrammars");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Grammars.class));
} | java | public ServiceCall<Grammars> listGrammars(ListGrammarsOptions listGrammarsOptions) {
Validator.notNull(listGrammarsOptions, "listGrammarsOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { listGrammarsOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listGrammars");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Grammars.class));
} | [
"public",
"ServiceCall",
"<",
"Grammars",
">",
"listGrammars",
"(",
"ListGrammarsOptions",
"listGrammarsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listGrammarsOptions",
",",
"\"listGrammarsOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegment... | List grammars.
Lists information about all grammars from a custom language model. The information includes the total number of
out-of-vocabulary (OOV) words, name, and status of each grammar. You must use credentials for the instance of the
service that owns a model to list its grammars.
**See also:** [Listing grammars from a custom language model](https://cloud.ibm.com/docs/services/speech-to-text/).
@param listGrammarsOptions the {@link ListGrammarsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Grammars} | [
"List",
"grammars",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1490-L1502 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.createAcousticModel | public ServiceCall<AcousticModel> createAcousticModel(CreateAcousticModelOptions createAcousticModelOptions) {
Validator.notNull(createAcousticModelOptions, "createAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createAcousticModelOptions.name());
contentJson.addProperty("base_model_name", createAcousticModelOptions.baseModelName());
if (createAcousticModelOptions.description() != null) {
contentJson.addProperty("description", createAcousticModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AcousticModel.class));
} | java | public ServiceCall<AcousticModel> createAcousticModel(CreateAcousticModelOptions createAcousticModelOptions) {
Validator.notNull(createAcousticModelOptions, "createAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createAcousticModelOptions.name());
contentJson.addProperty("base_model_name", createAcousticModelOptions.baseModelName());
if (createAcousticModelOptions.description() != null) {
contentJson.addProperty("description", createAcousticModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AcousticModel.class));
} | [
"public",
"ServiceCall",
"<",
"AcousticModel",
">",
"createAcousticModel",
"(",
"CreateAcousticModelOptions",
"createAcousticModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createAcousticModelOptions",
",",
"\"createAcousticModelOptions cannot be null\"",
")",
";",
... | Create a custom acoustic model.
Creates a new custom acoustic model for a specified base model. The custom acoustic model can be used only with the
base model for which it is created. The model is owned by the instance of the service whose credentials are used to
create it.
**See also:** [Create a custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#createModel-acoustic).
@param createAcousticModelOptions the {@link CreateAcousticModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link AcousticModel} | [
"Create",
"a",
"custom",
"acoustic",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1517-L1534 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.getAcousticModel | public ServiceCall<AcousticModel> getAcousticModel(GetAcousticModelOptions getAcousticModelOptions) {
Validator.notNull(getAcousticModelOptions, "getAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations" };
String[] pathParameters = { getAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AcousticModel.class));
} | java | public ServiceCall<AcousticModel> getAcousticModel(GetAcousticModelOptions getAcousticModelOptions) {
Validator.notNull(getAcousticModelOptions, "getAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations" };
String[] pathParameters = { getAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AcousticModel.class));
} | [
"public",
"ServiceCall",
"<",
"AcousticModel",
">",
"getAcousticModel",
"(",
"GetAcousticModelOptions",
"getAcousticModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getAcousticModelOptions",
",",
"\"getAcousticModelOptions cannot be null\"",
")",
";",
"String",
"... | Get a custom acoustic model.
Gets information about a specified custom acoustic model. You must use credentials for the instance of the service
that owns a model to list information about it.
**See also:** [Listing custom acoustic
models](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#listModels-acoustic).
@param getAcousticModelOptions the {@link GetAcousticModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link AcousticModel} | [
"Get",
"a",
"custom",
"acoustic",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1575-L1587 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.listAcousticModels | public ServiceCall<AcousticModels> listAcousticModels(ListAcousticModelsOptions listAcousticModelsOptions) {
String[] pathSegments = { "v1/acoustic_customizations" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listAcousticModels");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listAcousticModelsOptions != null) {
if (listAcousticModelsOptions.language() != null) {
builder.query("language", listAcousticModelsOptions.language());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AcousticModels.class));
} | java | public ServiceCall<AcousticModels> listAcousticModels(ListAcousticModelsOptions listAcousticModelsOptions) {
String[] pathSegments = { "v1/acoustic_customizations" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listAcousticModels");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listAcousticModelsOptions != null) {
if (listAcousticModelsOptions.language() != null) {
builder.query("language", listAcousticModelsOptions.language());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AcousticModels.class));
} | [
"public",
"ServiceCall",
"<",
"AcousticModels",
">",
"listAcousticModels",
"(",
"ListAcousticModelsOptions",
"listAcousticModelsOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/acoustic_customizations\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
... | List custom acoustic models.
Lists information about all custom acoustic models that are owned by an instance of the service. Use the `language`
parameter to see all custom acoustic models for the specified language. Omit the parameter to see all custom
acoustic models for all languages. You must use credentials for the instance of the service that owns a model to
list information about it.
**See also:** [Listing custom acoustic
models](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#listModels-acoustic).
@param listAcousticModelsOptions the {@link ListAcousticModelsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link AcousticModels} | [
"List",
"custom",
"acoustic",
"models",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1603-L1617 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.resetAcousticModel | public ServiceCall<Void> resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions) {
Validator.notNull(resetAcousticModelOptions, "resetAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "reset" };
String[] pathParameters = { resetAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "resetAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions) {
Validator.notNull(resetAcousticModelOptions, "resetAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "reset" };
String[] pathParameters = { resetAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "resetAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"resetAcousticModel",
"(",
"ResetAcousticModelOptions",
"resetAcousticModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"resetAcousticModelOptions",
",",
"\"resetAcousticModelOptions cannot be null\"",
")",
";",
"String",
... | Reset a custom acoustic model.
Resets a custom acoustic model by removing all audio resources from the model. Resetting a custom acoustic model
initializes the model to its state when it was first created. Metadata such as the name and language of the model
are preserved, but the model's audio resources are removed and must be re-created. You must use credentials for the
instance of the service that owns a model to reset it.
**See also:** [Resetting a custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#resetModel-acoustic).
@param resetAcousticModelOptions the {@link ResetAcousticModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Reset",
"a",
"custom",
"acoustic",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1650-L1662 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.trainAcousticModel | public ServiceCall<Void> trainAcousticModel(TrainAcousticModelOptions trainAcousticModelOptions) {
Validator.notNull(trainAcousticModelOptions, "trainAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "train" };
String[] pathParameters = { trainAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "trainAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (trainAcousticModelOptions.customLanguageModelId() != null) {
builder.query("custom_language_model_id", trainAcousticModelOptions.customLanguageModelId());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> trainAcousticModel(TrainAcousticModelOptions trainAcousticModelOptions) {
Validator.notNull(trainAcousticModelOptions, "trainAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "train" };
String[] pathParameters = { trainAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "trainAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (trainAcousticModelOptions.customLanguageModelId() != null) {
builder.query("custom_language_model_id", trainAcousticModelOptions.customLanguageModelId());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"trainAcousticModel",
"(",
"TrainAcousticModelOptions",
"trainAcousticModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"trainAcousticModelOptions",
",",
"\"trainAcousticModelOptions cannot be null\"",
")",
";",
"String",
... | Train a custom acoustic model.
Initiates the training of a custom acoustic model with new or changed audio resources. After adding or deleting
audio resources for a custom acoustic model, use this method to begin the actual training of the model on the
latest audio data. The custom acoustic model does not reflect its changed data until you train it. You must use
credentials for the instance of the service that owns a model to train it.
The training method is asynchronous. It can take on the order of minutes or hours to complete depending on the
total amount of audio data on which the custom acoustic model is being trained and the current load on the service.
Typically, training a custom acoustic model takes approximately two to four times the length of its audio data. The
range of time depends on the model being trained and the nature of the audio, such as whether the audio is clean or
noisy. The method returns an HTTP 200 response code to indicate that the training process has begun.
You can monitor the status of the training by using the **Get a custom acoustic model** method to poll the model's
status. Use a loop to check the status once a minute. The method returns an `AcousticModel` object that includes
`status` and `progress` fields. A status of `available` indicates that the custom model is trained and ready to
use. The service cannot accept subsequent training requests, or requests to add new audio resources, until the
existing request completes.
You can use the optional `custom_language_model_id` parameter to specify the GUID of a separately created custom
language model that is to be used during training. Train with a custom language model if you have verbatim
transcriptions of the audio files that you have added to the custom model or you have either corpora (text files)
or a list of words that are relevant to the contents of the audio files. Both of the custom models must be based on
the same version of the same base model for training to succeed.
Training can fail to start for the following reasons:
* The service is currently handling another request for the custom model, such as another training request or a
request to add audio resources to the model.
* The custom model contains less than 10 minutes or more than 100 hours of audio data.
* One or more of the custom model's audio resources is invalid.
* You passed an incompatible custom language model with the `custom_language_model_id` query parameter. Both custom
models must be based on the same version of the same base model.
**See also:** [Train the custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#trainModel-acoustic).
@param trainAcousticModelOptions the {@link TrainAcousticModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Train",
"a",
"custom",
"acoustic",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1704-L1719 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.upgradeAcousticModel | public ServiceCall<Void> upgradeAcousticModel(UpgradeAcousticModelOptions upgradeAcousticModelOptions) {
Validator.notNull(upgradeAcousticModelOptions, "upgradeAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "upgrade_model" };
String[] pathParameters = { upgradeAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "upgradeAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (upgradeAcousticModelOptions.customLanguageModelId() != null) {
builder.query("custom_language_model_id", upgradeAcousticModelOptions.customLanguageModelId());
}
if (upgradeAcousticModelOptions.force() != null) {
builder.query("force", String.valueOf(upgradeAcousticModelOptions.force()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> upgradeAcousticModel(UpgradeAcousticModelOptions upgradeAcousticModelOptions) {
Validator.notNull(upgradeAcousticModelOptions, "upgradeAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "upgrade_model" };
String[] pathParameters = { upgradeAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "upgradeAcousticModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (upgradeAcousticModelOptions.customLanguageModelId() != null) {
builder.query("custom_language_model_id", upgradeAcousticModelOptions.customLanguageModelId());
}
if (upgradeAcousticModelOptions.force() != null) {
builder.query("force", String.valueOf(upgradeAcousticModelOptions.force()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"upgradeAcousticModel",
"(",
"UpgradeAcousticModelOptions",
"upgradeAcousticModelOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"upgradeAcousticModelOptions",
",",
"\"upgradeAcousticModelOptions cannot be null\"",
")",
";",
"S... | Upgrade a custom acoustic model.
Initiates the upgrade of a custom acoustic model to the latest version of its base language model. The upgrade
method is asynchronous. It can take on the order of minutes or hours to complete depending on the amount of data in
the custom model and the current load on the service; typically, upgrade takes approximately twice the length of
the total audio contained in the custom model. A custom model must be in the `ready` or `available` state to be
upgraded. You must use credentials for the instance of the service that owns a model to upgrade it.
The method returns an HTTP 200 response code to indicate that the upgrade process has begun successfully. You can
monitor the status of the upgrade by using the **Get a custom acoustic model** method to poll the model's status.
The method returns an `AcousticModel` object that includes `status` and `progress` fields. Use a loop to check the
status once a minute. While it is being upgraded, the custom model has the status `upgrading`. When the upgrade is
complete, the model resumes the status that it had prior to upgrade. The service cannot accept subsequent requests
for the model until the upgrade completes.
If the custom acoustic model was trained with a separately created custom language model, you must use the
`custom_language_model_id` parameter to specify the GUID of that custom language model. The custom language model
must be upgraded before the custom acoustic model can be upgraded. Omit the parameter if the custom acoustic model
was not trained with a custom language model.
**See also:** [Upgrading a custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic).
@param upgradeAcousticModelOptions the {@link UpgradeAcousticModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Upgrade",
"a",
"custom",
"acoustic",
"model",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1748-L1766 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.addAudio | public ServiceCall<Void> addAudio(AddAudioOptions addAudioOptions) {
Validator.notNull(addAudioOptions, "addAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { addAudioOptions.customizationId(), addAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (addAudioOptions.containedContentType() != null) {
builder.header("Contained-Content-Type", addAudioOptions.containedContentType());
}
if (addAudioOptions.contentType() != null) {
builder.header("Content-Type", addAudioOptions.contentType());
}
if (addAudioOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addAudioOptions.allowOverwrite()));
}
builder.bodyContent(addAudioOptions.contentType(), null, null, addAudioOptions.audioResource());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> addAudio(AddAudioOptions addAudioOptions) {
Validator.notNull(addAudioOptions, "addAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { addAudioOptions.customizationId(), addAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (addAudioOptions.containedContentType() != null) {
builder.header("Contained-Content-Type", addAudioOptions.containedContentType());
}
if (addAudioOptions.contentType() != null) {
builder.header("Content-Type", addAudioOptions.contentType());
}
if (addAudioOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addAudioOptions.allowOverwrite()));
}
builder.bodyContent(addAudioOptions.contentType(), null, null, addAudioOptions.audioResource());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"addAudio",
"(",
"AddAudioOptions",
"addAudioOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"addAudioOptions",
",",
"\"addAudioOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v... | Add an audio resource.
Adds an audio resource to a custom acoustic model. Add audio content that reflects the acoustic characteristics of
the audio that you plan to transcribe. You must use credentials for the instance of the service that owns a model
to add an audio resource to it. Adding audio data does not affect the custom acoustic model until you train the
model for the new data by using the **Train a custom acoustic model** method.
You can add individual audio files or an archive file that contains multiple audio files. Adding multiple audio
files via a single archive file is significantly more efficient than adding each file individually. You can add
audio resources in any format that the service supports for speech recognition.
You can use this method to add any number of audio resources to a custom model by calling the method once for each
audio or archive file. But the addition of one audio resource must be fully complete before you can add another.
You must add a minimum of 10 minutes and a maximum of 100 hours of audio that includes speech, not just silence, to
a custom acoustic model before you can train it. No audio resource, audio- or archive-type, can be larger than 100
MB. To add an audio resource that has the same name as an existing audio resource, set the `allow_overwrite`
parameter to `true`; otherwise, the request fails.
The method is asynchronous. It can take several seconds to complete depending on the duration of the audio and, in
the case of an archive file, the total number of audio files being processed. The service returns a 201 response
code if the audio is valid. It then asynchronously analyzes the contents of the audio file or files and
automatically extracts information about the audio such as its length, sampling rate, and encoding. You cannot
submit requests to add additional audio resources to a custom acoustic model, or to train the model, until the
service's analysis of all audio files for the current request completes.
To determine the status of the service's analysis of the audio, use the **Get an audio resource** method to poll
the status of the audio. The method accepts the customization ID of the custom model and the name of the audio
resource, and it returns the status of the resource. Use a loop to check the status of the audio every few seconds
until it becomes `ok`.
**See also:** [Add audio to the custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#addAudio).
### Content types for audio-type resources
You can add an individual audio file in any format that the service supports for speech recognition. For an
audio-type resource, use the `Content-Type` parameter to specify the audio format (MIME type) of the audio file,
including specifying the sampling rate, channels, and endianness where indicated.
* `audio/alaw` (Specify the sampling rate (`rate`) of the audio.)
* `audio/basic` (Use only with narrowband models.)
* `audio/flac`
* `audio/g729` (Use only with narrowband models.)
* `audio/l16` (Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness
(`endianness`) of the audio.)
* `audio/mp3`
* `audio/mpeg`
* `audio/mulaw` (Specify the sampling rate (`rate`) of the audio.)
* `audio/ogg` (The service automatically detects the codec of the input audio.)
* `audio/ogg;codecs=opus`
* `audio/ogg;codecs=vorbis`
* `audio/wav` (Provide audio with a maximum of nine channels.)
* `audio/webm` (The service automatically detects the codec of the input audio.)
* `audio/webm;codecs=opus`
* `audio/webm;codecs=vorbis`
The sampling rate of an audio file must match the sampling rate of the base model for the custom model: for
broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is
higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling
rate of the audio is lower than the minimum required rate, the service labels the audio file as `invalid`.
**See also:** [Audio formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
### Content types for archive-type resources
You can add an archive file (**.zip** or **.tar.gz** file) that contains audio files in any format that the
service supports for speech recognition. For an archive-type resource, use the `Content-Type` parameter to specify
the media type of the archive file:
* `application/zip` for a **.zip** file
* `application/gzip` for a **.tar.gz** file.
When you add an archive-type resource, the `Contained-Content-Type` header is optional depending on the format of
the files that you are adding:
* For audio files of type `audio/alaw`, `audio/basic`, `audio/l16`, or `audio/mulaw`, you must use the
`Contained-Content-Type` header to specify the format of the contained audio files. Include the `rate`, `channels`,
and `endianness` parameters where necessary. In this case, all audio files contained in the archive file must have
the same audio format.
* For audio files of all other types, you can omit the `Contained-Content-Type` header. In this case, the audio
files contained in the archive file can have any of the formats not listed in the previous bullet. The audio files
do not need to have the same format.
Do not use the `Contained-Content-Type` header when adding an audio-type resource.
### Naming restrictions for embedded audio files
The name of an audio file that is embedded within an archive-type resource must meet the following restrictions:
* Include a maximum of 128 characters in the file name; this includes the file extension.
* Do not include spaces, slashes, or backslashes in the file name.
* Do not use the name of an audio file that has already been added to the custom model as part of an archive-type
resource.
@param addAudioOptions the {@link AddAudioOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Add",
"an",
"audio",
"resource",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1862-L1884 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.deleteAudio | public ServiceCall<Void> deleteAudio(DeleteAudioOptions deleteAudioOptions) {
Validator.notNull(deleteAudioOptions, "deleteAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { deleteAudioOptions.customizationId(), deleteAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> deleteAudio(DeleteAudioOptions deleteAudioOptions) {
Validator.notNull(deleteAudioOptions, "deleteAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { deleteAudioOptions.customizationId(), deleteAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"deleteAudio",
"(",
"DeleteAudioOptions",
"deleteAudioOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"deleteAudioOptions",
",",
"\"deleteAudioOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"="... | Delete an audio resource.
Deletes an existing audio resource from a custom acoustic model. Deleting an archive-type audio resource removes
the entire archive of files; the current interface does not allow deletion of individual files from an archive
resource. Removing an audio resource does not affect the custom model until you train the model on its updated data
by using the **Train a custom acoustic model** method. You must use credentials for the instance of the service
that owns a model to delete its audio resources.
**See also:** [Deleting an audio resource from a custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#deleteAudio).
@param deleteAudioOptions the {@link DeleteAudioOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Delete",
"an",
"audio",
"resource",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1901-L1913 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.getAudio | public ServiceCall<AudioListing> getAudio(GetAudioOptions getAudioOptions) {
Validator.notNull(getAudioOptions, "getAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { getAudioOptions.customizationId(), getAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioListing.class));
} | java | public ServiceCall<AudioListing> getAudio(GetAudioOptions getAudioOptions) {
Validator.notNull(getAudioOptions, "getAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { getAudioOptions.customizationId(), getAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioListing.class));
} | [
"public",
"ServiceCall",
"<",
"AudioListing",
">",
"getAudio",
"(",
"GetAudioOptions",
"getAudioOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getAudioOptions",
",",
"\"getAudioOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{"... | Get an audio resource.
Gets information about an audio resource from a custom acoustic model. The method returns an `AudioListing` object
whose fields depend on the type of audio resource that you specify with the method's `audio_name` parameter:
* **For an audio-type resource,** the object's fields match those of an `AudioResource` object: `duration`, `name`,
`details`, and `status`.
* **For an archive-type resource,** the object includes a `container` field whose fields match those of an
`AudioResource` object. It also includes an `audio` field, which contains an array of `AudioResource` objects that
provides information about the audio files that are contained in the archive.
The information includes the status of the specified audio resource. The status is important for checking the
service's analysis of a resource that you add to the custom model.
* For an audio-type resource, the `status` field is located in the `AudioListing` object.
* For an archive-type resource, the `status` field is located in the `AudioResource` object that is returned in the
`container` field.
You must use credentials for the instance of the service that owns a model to list its audio resources.
**See also:** [Listing audio resources for a custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#listAudio).
@param getAudioOptions the {@link GetAudioOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link AudioListing} | [
"Get",
"an",
"audio",
"resource",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1940-L1952 | train |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.listAudio | public ServiceCall<AudioResources> listAudio(ListAudioOptions listAudioOptions) {
Validator.notNull(listAudioOptions, "listAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { listAudioOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioResources.class));
} | java | public ServiceCall<AudioResources> listAudio(ListAudioOptions listAudioOptions) {
Validator.notNull(listAudioOptions, "listAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { listAudioOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioResources.class));
} | [
"public",
"ServiceCall",
"<",
"AudioResources",
">",
"listAudio",
"(",
"ListAudioOptions",
"listAudioOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listAudioOptions",
",",
"\"listAudioOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"="... | List audio resources.
Lists information about all audio resources from a custom acoustic model. The information includes the name of the
resource and information about its audio data, such as its duration. It also includes the status of the audio
resource, which is important for checking the service's analysis of the resource in response to a request to add it
to the custom acoustic model. You must use credentials for the instance of the service that owns a model to list
its audio resources.
**See also:** [Listing audio resources for a custom acoustic
model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#listAudio).
@param listAudioOptions the {@link ListAudioOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link AudioResources} | [
"List",
"audio",
"resources",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L1969-L1981 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.message | public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
Validator.notNull(messageOptions, "messageOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "message" };
String[] pathParameters = { messageOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "message");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (messageOptions.nodesVisitedDetails() != null) {
builder.query("nodes_visited_details", String.valueOf(messageOptions.nodesVisitedDetails()));
}
final JsonObject contentJson = new JsonObject();
if (messageOptions.input() != null) {
contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input()));
}
if (messageOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents()));
}
if (messageOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities()));
}
if (messageOptions.alternateIntents() != null) {
contentJson.addProperty("alternate_intents", messageOptions.alternateIntents());
}
if (messageOptions.context() != null) {
contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context()));
}
if (messageOptions.output() != null) {
contentJson.add("output", GsonSingleton.getGson().toJsonTree(messageOptions.output()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MessageResponse.class));
} | java | public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
Validator.notNull(messageOptions, "messageOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "message" };
String[] pathParameters = { messageOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "message");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (messageOptions.nodesVisitedDetails() != null) {
builder.query("nodes_visited_details", String.valueOf(messageOptions.nodesVisitedDetails()));
}
final JsonObject contentJson = new JsonObject();
if (messageOptions.input() != null) {
contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input()));
}
if (messageOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents()));
}
if (messageOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities()));
}
if (messageOptions.alternateIntents() != null) {
contentJson.addProperty("alternate_intents", messageOptions.alternateIntents());
}
if (messageOptions.context() != null) {
contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context()));
}
if (messageOptions.output() != null) {
contentJson.add("output", GsonSingleton.getGson().toJsonTree(messageOptions.output()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MessageResponse.class));
} | [
"public",
"ServiceCall",
"<",
"MessageResponse",
">",
"message",
"(",
"MessageOptions",
"messageOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"messageOptions",
",",
"\"messageOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
... | Get response to user input.
Send user input to a workspace and receive a response.
There is no rate limit for this operation.
@param messageOptions the {@link MessageOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link MessageResponse} | [
"Get",
"response",
"to",
"user",
"input",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L161-L197 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.createWorkspace | public ServiceCall<Workspace> createWorkspace(CreateWorkspaceOptions createWorkspaceOptions) {
String[] pathSegments = { "v1/workspaces" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createWorkspaceOptions != null) {
final JsonObject contentJson = new JsonObject();
if (createWorkspaceOptions.name() != null) {
contentJson.addProperty("name", createWorkspaceOptions.name());
}
if (createWorkspaceOptions.description() != null) {
contentJson.addProperty("description", createWorkspaceOptions.description());
}
if (createWorkspaceOptions.language() != null) {
contentJson.addProperty("language", createWorkspaceOptions.language());
}
if (createWorkspaceOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.metadata()));
}
if (createWorkspaceOptions.learningOptOut() != null) {
contentJson.addProperty("learning_opt_out", createWorkspaceOptions.learningOptOut());
}
if (createWorkspaceOptions.systemSettings() != null) {
contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.systemSettings()));
}
if (createWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.intents()));
}
if (createWorkspaceOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.entities()));
}
if (createWorkspaceOptions.dialogNodes() != null) {
contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.dialogNodes()));
}
if (createWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions
.counterexamples()));
}
builder.bodyJson(contentJson);
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} | java | public ServiceCall<Workspace> createWorkspace(CreateWorkspaceOptions createWorkspaceOptions) {
String[] pathSegments = { "v1/workspaces" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createWorkspaceOptions != null) {
final JsonObject contentJson = new JsonObject();
if (createWorkspaceOptions.name() != null) {
contentJson.addProperty("name", createWorkspaceOptions.name());
}
if (createWorkspaceOptions.description() != null) {
contentJson.addProperty("description", createWorkspaceOptions.description());
}
if (createWorkspaceOptions.language() != null) {
contentJson.addProperty("language", createWorkspaceOptions.language());
}
if (createWorkspaceOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.metadata()));
}
if (createWorkspaceOptions.learningOptOut() != null) {
contentJson.addProperty("learning_opt_out", createWorkspaceOptions.learningOptOut());
}
if (createWorkspaceOptions.systemSettings() != null) {
contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.systemSettings()));
}
if (createWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.intents()));
}
if (createWorkspaceOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.entities()));
}
if (createWorkspaceOptions.dialogNodes() != null) {
contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.dialogNodes()));
}
if (createWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions
.counterexamples()));
}
builder.bodyJson(contentJson);
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} | [
"public",
"ServiceCall",
"<",
"Workspace",
">",
"createWorkspace",
"(",
"CreateWorkspaceOptions",
"createWorkspaceOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/workspaces\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
"RequestBuilder",
".",
... | Create workspace.
Create a workspace based on component objects. You must provide workspace components defining the content of the
new workspace.
This operation is limited to 30 requests per 30 minutes. For more information, see **Rate limiting**.
@param createWorkspaceOptions the {@link CreateWorkspaceOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Workspace} | [
"Create",
"workspace",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L210-L255 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getWorkspace | public ServiceCall<Workspace> getWorkspace(GetWorkspaceOptions getWorkspaceOptions) {
Validator.notNull(getWorkspaceOptions, "getWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { getWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getWorkspaceOptions.export() != null) {
builder.query("export", String.valueOf(getWorkspaceOptions.export()));
}
if (getWorkspaceOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getWorkspaceOptions.includeAudit()));
}
if (getWorkspaceOptions.sort() != null) {
builder.query("sort", getWorkspaceOptions.sort());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} | java | public ServiceCall<Workspace> getWorkspace(GetWorkspaceOptions getWorkspaceOptions) {
Validator.notNull(getWorkspaceOptions, "getWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { getWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getWorkspaceOptions.export() != null) {
builder.query("export", String.valueOf(getWorkspaceOptions.export()));
}
if (getWorkspaceOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getWorkspaceOptions.includeAudit()));
}
if (getWorkspaceOptions.sort() != null) {
builder.query("sort", getWorkspaceOptions.sort());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} | [
"public",
"ServiceCall",
"<",
"Workspace",
">",
"getWorkspace",
"(",
"GetWorkspaceOptions",
"getWorkspaceOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getWorkspaceOptions",
",",
"\"getWorkspaceOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegmen... | Get information about a workspace.
Get information about a workspace, optionally including all workspace content.
With **export**=`false`, this operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the
limit is 20 requests per 30 minutes. For more information, see **Rate limiting**.
@param getWorkspaceOptions the {@link GetWorkspaceOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Workspace} | [
"Get",
"information",
"about",
"a",
"workspace",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L307-L329 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listWorkspaces | public ServiceCall<WorkspaceCollection> listWorkspaces(ListWorkspacesOptions listWorkspacesOptions) {
String[] pathSegments = { "v1/workspaces" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listWorkspaces");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listWorkspacesOptions != null) {
if (listWorkspacesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listWorkspacesOptions.pageLimit()));
}
if (listWorkspacesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listWorkspacesOptions.includeCount()));
}
if (listWorkspacesOptions.sort() != null) {
builder.query("sort", listWorkspacesOptions.sort());
}
if (listWorkspacesOptions.cursor() != null) {
builder.query("cursor", listWorkspacesOptions.cursor());
}
if (listWorkspacesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listWorkspacesOptions.includeAudit()));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(WorkspaceCollection.class));
} | java | public ServiceCall<WorkspaceCollection> listWorkspaces(ListWorkspacesOptions listWorkspacesOptions) {
String[] pathSegments = { "v1/workspaces" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listWorkspaces");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listWorkspacesOptions != null) {
if (listWorkspacesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listWorkspacesOptions.pageLimit()));
}
if (listWorkspacesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listWorkspacesOptions.includeCount()));
}
if (listWorkspacesOptions.sort() != null) {
builder.query("sort", listWorkspacesOptions.sort());
}
if (listWorkspacesOptions.cursor() != null) {
builder.query("cursor", listWorkspacesOptions.cursor());
}
if (listWorkspacesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listWorkspacesOptions.includeAudit()));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(WorkspaceCollection.class));
} | [
"public",
"ServiceCall",
"<",
"WorkspaceCollection",
">",
"listWorkspaces",
"(",
"ListWorkspacesOptions",
"listWorkspacesOptions",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v1/workspaces\"",
"}",
";",
"RequestBuilder",
"builder",
"=",
"RequestBuilder",
... | List workspaces.
List the workspaces associated with a Watson Assistant service instance.
This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**.
@param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} | [
"List",
"workspaces",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L341-L368 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.updateWorkspace | public ServiceCall<Workspace> updateWorkspace(UpdateWorkspaceOptions updateWorkspaceOptions) {
Validator.notNull(updateWorkspaceOptions, "updateWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { updateWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateWorkspaceOptions.append() != null) {
builder.query("append", String.valueOf(updateWorkspaceOptions.append()));
}
final JsonObject contentJson = new JsonObject();
if (updateWorkspaceOptions.name() != null) {
contentJson.addProperty("name", updateWorkspaceOptions.name());
}
if (updateWorkspaceOptions.description() != null) {
contentJson.addProperty("description", updateWorkspaceOptions.description());
}
if (updateWorkspaceOptions.language() != null) {
contentJson.addProperty("language", updateWorkspaceOptions.language());
}
if (updateWorkspaceOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata()));
}
if (updateWorkspaceOptions.learningOptOut() != null) {
contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut());
}
if (updateWorkspaceOptions.systemSettings() != null) {
contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings()));
}
if (updateWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.intents()));
}
if (updateWorkspaceOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.entities()));
}
if (updateWorkspaceOptions.dialogNodes() != null) {
contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.dialogNodes()));
}
if (updateWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.counterexamples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} | java | public ServiceCall<Workspace> updateWorkspace(UpdateWorkspaceOptions updateWorkspaceOptions) {
Validator.notNull(updateWorkspaceOptions, "updateWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { updateWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateWorkspaceOptions.append() != null) {
builder.query("append", String.valueOf(updateWorkspaceOptions.append()));
}
final JsonObject contentJson = new JsonObject();
if (updateWorkspaceOptions.name() != null) {
contentJson.addProperty("name", updateWorkspaceOptions.name());
}
if (updateWorkspaceOptions.description() != null) {
contentJson.addProperty("description", updateWorkspaceOptions.description());
}
if (updateWorkspaceOptions.language() != null) {
contentJson.addProperty("language", updateWorkspaceOptions.language());
}
if (updateWorkspaceOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata()));
}
if (updateWorkspaceOptions.learningOptOut() != null) {
contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut());
}
if (updateWorkspaceOptions.systemSettings() != null) {
contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings()));
}
if (updateWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.intents()));
}
if (updateWorkspaceOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.entities()));
}
if (updateWorkspaceOptions.dialogNodes() != null) {
contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.dialogNodes()));
}
if (updateWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.counterexamples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} | [
"public",
"ServiceCall",
"<",
"Workspace",
">",
"updateWorkspace",
"(",
"UpdateWorkspaceOptions",
"updateWorkspaceOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateWorkspaceOptions",
",",
"\"updateWorkspaceOptions cannot be null\"",
")",
";",
"String",
"[",
"]"... | Update workspace.
Update an existing workspace with new or modified data. You must provide component objects defining the content of
the updated workspace.
This operation is limited to 30 request per 30 minutes. For more information, see **Rate limiting**.
@param updateWorkspaceOptions the {@link UpdateWorkspaceOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Workspace} | [
"Update",
"workspace",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L394-L442 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.createIntent | public ServiceCall<Intent> createIntent(CreateIntentOptions createIntentOptions) {
Validator.notNull(createIntentOptions, "createIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { createIntentOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createIntent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("intent", createIntentOptions.intent());
if (createIntentOptions.description() != null) {
contentJson.addProperty("description", createIntentOptions.description());
}
if (createIntentOptions.examples() != null) {
contentJson.add("examples", GsonSingleton.getGson().toJsonTree(createIntentOptions.examples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
} | java | public ServiceCall<Intent> createIntent(CreateIntentOptions createIntentOptions) {
Validator.notNull(createIntentOptions, "createIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { createIntentOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createIntent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("intent", createIntentOptions.intent());
if (createIntentOptions.description() != null) {
contentJson.addProperty("description", createIntentOptions.description());
}
if (createIntentOptions.examples() != null) {
contentJson.add("examples", GsonSingleton.getGson().toJsonTree(createIntentOptions.examples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
} | [
"public",
"ServiceCall",
"<",
"Intent",
">",
"createIntent",
"(",
"CreateIntentOptions",
"createIntentOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createIntentOptions",
",",
"\"createIntentOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments"... | Create intent.
Create a new intent.
This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**.
@param createIntentOptions the {@link CreateIntentOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Intent} | [
"Create",
"intent",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L454-L476 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getIntent | public ServiceCall<Intent> getIntent(GetIntentOptions getIntentOptions) {
Validator.notNull(getIntentOptions, "getIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { getIntentOptions.workspaceId(), getIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getIntent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getIntentOptions.export() != null) {
builder.query("export", String.valueOf(getIntentOptions.export()));
}
if (getIntentOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getIntentOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
} | java | public ServiceCall<Intent> getIntent(GetIntentOptions getIntentOptions) {
Validator.notNull(getIntentOptions, "getIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { getIntentOptions.workspaceId(), getIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getIntent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getIntentOptions.export() != null) {
builder.query("export", String.valueOf(getIntentOptions.export()));
}
if (getIntentOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getIntentOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
} | [
"public",
"ServiceCall",
"<",
"Intent",
">",
"getIntent",
"(",
"GetIntentOptions",
"getIntentOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getIntentOptions",
",",
"\"getIntentOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",... | Get intent.
Get information about an intent, optionally including all intent content.
With **export**=`false`, this operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the
limit is 400 requests per 30 minutes. For more information, see **Rate limiting**.
@param getIntentOptions the {@link GetIntentOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Intent} | [
"Get",
"intent",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L514-L533 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listIntents | public ServiceCall<IntentCollection> listIntents(ListIntentsOptions listIntentsOptions) {
Validator.notNull(listIntentsOptions, "listIntentsOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { listIntentsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listIntents");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listIntentsOptions.export() != null) {
builder.query("export", String.valueOf(listIntentsOptions.export()));
}
if (listIntentsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listIntentsOptions.pageLimit()));
}
if (listIntentsOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listIntentsOptions.includeCount()));
}
if (listIntentsOptions.sort() != null) {
builder.query("sort", listIntentsOptions.sort());
}
if (listIntentsOptions.cursor() != null) {
builder.query("cursor", listIntentsOptions.cursor());
}
if (listIntentsOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listIntentsOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(IntentCollection.class));
} | java | public ServiceCall<IntentCollection> listIntents(ListIntentsOptions listIntentsOptions) {
Validator.notNull(listIntentsOptions, "listIntentsOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { listIntentsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listIntents");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listIntentsOptions.export() != null) {
builder.query("export", String.valueOf(listIntentsOptions.export()));
}
if (listIntentsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listIntentsOptions.pageLimit()));
}
if (listIntentsOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listIntentsOptions.includeCount()));
}
if (listIntentsOptions.sort() != null) {
builder.query("sort", listIntentsOptions.sort());
}
if (listIntentsOptions.cursor() != null) {
builder.query("cursor", listIntentsOptions.cursor());
}
if (listIntentsOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listIntentsOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(IntentCollection.class));
} | [
"public",
"ServiceCall",
"<",
"IntentCollection",
">",
"listIntents",
"(",
"ListIntentsOptions",
"listIntentsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listIntentsOptions",
",",
"\"listIntentsOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegm... | List intents.
List the intents for a workspace.
With **export**=`false`, this operation is limited to 2000 requests per 30 minutes. With **export**=`true`, the
limit is 400 requests per 30 minutes. For more information, see **Rate limiting**.
@param listIntentsOptions the {@link ListIntentsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link IntentCollection} | [
"List",
"intents",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L546-L577 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.updateIntent | public ServiceCall<Intent> updateIntent(UpdateIntentOptions updateIntentOptions) {
Validator.notNull(updateIntentOptions, "updateIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { updateIntentOptions.workspaceId(), updateIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateIntent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateIntentOptions.newIntent() != null) {
contentJson.addProperty("intent", updateIntentOptions.newIntent());
}
if (updateIntentOptions.newDescription() != null) {
contentJson.addProperty("description", updateIntentOptions.newDescription());
}
if (updateIntentOptions.newExamples() != null) {
contentJson.add("examples", GsonSingleton.getGson().toJsonTree(updateIntentOptions.newExamples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
} | java | public ServiceCall<Intent> updateIntent(UpdateIntentOptions updateIntentOptions) {
Validator.notNull(updateIntentOptions, "updateIntentOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents" };
String[] pathParameters = { updateIntentOptions.workspaceId(), updateIntentOptions.intent() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateIntent");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateIntentOptions.newIntent() != null) {
contentJson.addProperty("intent", updateIntentOptions.newIntent());
}
if (updateIntentOptions.newDescription() != null) {
contentJson.addProperty("description", updateIntentOptions.newDescription());
}
if (updateIntentOptions.newExamples() != null) {
contentJson.add("examples", GsonSingleton.getGson().toJsonTree(updateIntentOptions.newExamples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class));
} | [
"public",
"ServiceCall",
"<",
"Intent",
">",
"updateIntent",
"(",
"UpdateIntentOptions",
"updateIntentOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateIntentOptions",
",",
"\"updateIntentOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments"... | Update intent.
Update an existing intent with new or modified data. You must provide component objects defining the content of the
updated intent.
This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**.
@param updateIntentOptions the {@link UpdateIntentOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Intent} | [
"Update",
"intent",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L590-L614 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.createExample | public ServiceCall<Example> createExample(CreateExampleOptions createExampleOptions) {
Validator.notNull(createExampleOptions, "createExampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents", "examples" };
String[] pathParameters = { createExampleOptions.workspaceId(), createExampleOptions.intent() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", createExampleOptions.text());
if (createExampleOptions.mentions() != null) {
contentJson.add("mentions", GsonSingleton.getGson().toJsonTree(createExampleOptions.mentions()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class));
} | java | public ServiceCall<Example> createExample(CreateExampleOptions createExampleOptions) {
Validator.notNull(createExampleOptions, "createExampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents", "examples" };
String[] pathParameters = { createExampleOptions.workspaceId(), createExampleOptions.intent() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", createExampleOptions.text());
if (createExampleOptions.mentions() != null) {
contentJson.add("mentions", GsonSingleton.getGson().toJsonTree(createExampleOptions.mentions()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class));
} | [
"public",
"ServiceCall",
"<",
"Example",
">",
"createExample",
"(",
"CreateExampleOptions",
"createExampleOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createExampleOptions",
",",
"\"createExampleOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSeg... | Create user input example.
Add a new user input example to an intent.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param createExampleOptions the {@link CreateExampleOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Example} | [
"Create",
"user",
"input",
"example",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L626-L645 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getExample | public ServiceCall<Example> getExample(GetExampleOptions getExampleOptions) {
Validator.notNull(getExampleOptions, "getExampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents", "examples" };
String[] pathParameters = { getExampleOptions.workspaceId(), getExampleOptions.intent(), getExampleOptions.text() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getExampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getExampleOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class));
} | java | public ServiceCall<Example> getExample(GetExampleOptions getExampleOptions) {
Validator.notNull(getExampleOptions, "getExampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents", "examples" };
String[] pathParameters = { getExampleOptions.workspaceId(), getExampleOptions.intent(), getExampleOptions.text() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getExampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getExampleOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class));
} | [
"public",
"ServiceCall",
"<",
"Example",
">",
"getExample",
"(",
"GetExampleOptions",
"getExampleOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getExampleOptions",
",",
"\"getExampleOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
... | Get user input example.
Get information about a user input example.
This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**.
@param getExampleOptions the {@link GetExampleOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Example} | [
"Get",
"user",
"input",
"example",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L683-L699 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listExamples | public ServiceCall<ExampleCollection> listExamples(ListExamplesOptions listExamplesOptions) {
Validator.notNull(listExamplesOptions, "listExamplesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents", "examples" };
String[] pathParameters = { listExamplesOptions.workspaceId(), listExamplesOptions.intent() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listExamples");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listExamplesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listExamplesOptions.pageLimit()));
}
if (listExamplesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listExamplesOptions.includeCount()));
}
if (listExamplesOptions.sort() != null) {
builder.query("sort", listExamplesOptions.sort());
}
if (listExamplesOptions.cursor() != null) {
builder.query("cursor", listExamplesOptions.cursor());
}
if (listExamplesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listExamplesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ExampleCollection.class));
} | java | public ServiceCall<ExampleCollection> listExamples(ListExamplesOptions listExamplesOptions) {
Validator.notNull(listExamplesOptions, "listExamplesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "intents", "examples" };
String[] pathParameters = { listExamplesOptions.workspaceId(), listExamplesOptions.intent() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listExamples");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listExamplesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listExamplesOptions.pageLimit()));
}
if (listExamplesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listExamplesOptions.includeCount()));
}
if (listExamplesOptions.sort() != null) {
builder.query("sort", listExamplesOptions.sort());
}
if (listExamplesOptions.cursor() != null) {
builder.query("cursor", listExamplesOptions.cursor());
}
if (listExamplesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listExamplesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ExampleCollection.class));
} | [
"public",
"ServiceCall",
"<",
"ExampleCollection",
">",
"listExamples",
"(",
"ListExamplesOptions",
"listExamplesOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listExamplesOptions",
",",
"\"listExamplesOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pa... | List user input examples.
List the user input examples for an intent, optionally including contextual entity mentions.
This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**.
@param listExamplesOptions the {@link ListExamplesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link ExampleCollection} | [
"List",
"user",
"input",
"examples",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L711-L739 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getCounterexample | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getCounterexample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getCounterexampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getCounterexampleOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class));
} | java | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getCounterexample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getCounterexampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getCounterexampleOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class));
} | [
"public",
"ServiceCall",
"<",
"Counterexample",
">",
"getCounterexample",
"(",
"GetCounterexampleOptions",
"getCounterexampleOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getCounterexampleOptions",
",",
"\"getCounterexampleOptions cannot be null\"",
")",
";",
"String... | 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} | [
"Get",
"counterexample",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L838-L854 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listCounterexamples | public ServiceCall<CounterexampleCollection> listCounterexamples(
ListCounterexamplesOptions listCounterexamplesOptions) {
Validator.notNull(listCounterexamplesOptions, "listCounterexamplesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "counterexamples" };
String[] pathParameters = { listCounterexamplesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listCounterexamples");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listCounterexamplesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listCounterexamplesOptions.pageLimit()));
}
if (listCounterexamplesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listCounterexamplesOptions.includeCount()));
}
if (listCounterexamplesOptions.sort() != null) {
builder.query("sort", listCounterexamplesOptions.sort());
}
if (listCounterexamplesOptions.cursor() != null) {
builder.query("cursor", listCounterexamplesOptions.cursor());
}
if (listCounterexamplesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listCounterexamplesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CounterexampleCollection.class));
} | java | public ServiceCall<CounterexampleCollection> listCounterexamples(
ListCounterexamplesOptions listCounterexamplesOptions) {
Validator.notNull(listCounterexamplesOptions, "listCounterexamplesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "counterexamples" };
String[] pathParameters = { listCounterexamplesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listCounterexamples");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listCounterexamplesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listCounterexamplesOptions.pageLimit()));
}
if (listCounterexamplesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listCounterexamplesOptions.includeCount()));
}
if (listCounterexamplesOptions.sort() != null) {
builder.query("sort", listCounterexamplesOptions.sort());
}
if (listCounterexamplesOptions.cursor() != null) {
builder.query("cursor", listCounterexamplesOptions.cursor());
}
if (listCounterexamplesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listCounterexamplesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(CounterexampleCollection.class));
} | [
"public",
"ServiceCall",
"<",
"CounterexampleCollection",
">",
"listCounterexamples",
"(",
"ListCounterexamplesOptions",
"listCounterexamplesOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listCounterexamplesOptions",
",",
"\"listCounterexamplesOptions cannot be null\"",
"... | List counterexamples.
List the counterexamples for a workspace. Counterexamples are examples that have been marked as irrelevant input.
This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**.
@param listCounterexamplesOptions the {@link ListCounterexamplesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link CounterexampleCollection} | [
"List",
"counterexamples",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L866-L895 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.updateCounterexample | public ServiceCall<Counterexample> updateCounterexample(UpdateCounterexampleOptions updateCounterexampleOptions) {
Validator.notNull(updateCounterexampleOptions, "updateCounterexampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "counterexamples" };
String[] pathParameters = { updateCounterexampleOptions.workspaceId(), updateCounterexampleOptions.text() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateCounterexample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateCounterexampleOptions.newText() != null) {
contentJson.addProperty("text", updateCounterexampleOptions.newText());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class));
} | java | public ServiceCall<Counterexample> updateCounterexample(UpdateCounterexampleOptions updateCounterexampleOptions) {
Validator.notNull(updateCounterexampleOptions, "updateCounterexampleOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "counterexamples" };
String[] pathParameters = { updateCounterexampleOptions.workspaceId(), updateCounterexampleOptions.text() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateCounterexample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateCounterexampleOptions.newText() != null) {
contentJson.addProperty("text", updateCounterexampleOptions.newText());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Counterexample.class));
} | [
"public",
"ServiceCall",
"<",
"Counterexample",
">",
"updateCounterexample",
"(",
"UpdateCounterexampleOptions",
"updateCounterexampleOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateCounterexampleOptions",
",",
"\"updateCounterexampleOptions cannot be null\"",
")",
... | Update counterexample.
Update the text of a counterexample. Counterexamples are examples that have been marked as irrelevant input.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param updateCounterexampleOptions the {@link UpdateCounterexampleOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Counterexample} | [
"Update",
"counterexample",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L907-L925 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.createEntity | public ServiceCall<Entity> createEntity(CreateEntityOptions createEntityOptions) {
Validator.notNull(createEntityOptions, "createEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { createEntityOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createEntity");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("entity", createEntityOptions.entity());
if (createEntityOptions.description() != null) {
contentJson.addProperty("description", createEntityOptions.description());
}
if (createEntityOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createEntityOptions.metadata()));
}
if (createEntityOptions.fuzzyMatch() != null) {
contentJson.addProperty("fuzzy_match", createEntityOptions.fuzzyMatch());
}
if (createEntityOptions.values() != null) {
contentJson.add("values", GsonSingleton.getGson().toJsonTree(createEntityOptions.values()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
} | java | public ServiceCall<Entity> createEntity(CreateEntityOptions createEntityOptions) {
Validator.notNull(createEntityOptions, "createEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { createEntityOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createEntity");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("entity", createEntityOptions.entity());
if (createEntityOptions.description() != null) {
contentJson.addProperty("description", createEntityOptions.description());
}
if (createEntityOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createEntityOptions.metadata()));
}
if (createEntityOptions.fuzzyMatch() != null) {
contentJson.addProperty("fuzzy_match", createEntityOptions.fuzzyMatch());
}
if (createEntityOptions.values() != null) {
contentJson.add("values", GsonSingleton.getGson().toJsonTree(createEntityOptions.values()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
} | [
"public",
"ServiceCall",
"<",
"Entity",
">",
"createEntity",
"(",
"CreateEntityOptions",
"createEntityOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createEntityOptions",
",",
"\"createEntityOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments"... | Create entity.
Create a new entity, or enable a system entity.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param createEntityOptions the {@link CreateEntityOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Entity} | [
"Create",
"entity",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L937-L965 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getEntity | public ServiceCall<Entity> getEntity(GetEntityOptions getEntityOptions) {
Validator.notNull(getEntityOptions, "getEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { getEntityOptions.workspaceId(), getEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getEntity");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getEntityOptions.export() != null) {
builder.query("export", String.valueOf(getEntityOptions.export()));
}
if (getEntityOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getEntityOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
} | java | public ServiceCall<Entity> getEntity(GetEntityOptions getEntityOptions) {
Validator.notNull(getEntityOptions, "getEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { getEntityOptions.workspaceId(), getEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getEntity");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getEntityOptions.export() != null) {
builder.query("export", String.valueOf(getEntityOptions.export()));
}
if (getEntityOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getEntityOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
} | [
"public",
"ServiceCall",
"<",
"Entity",
">",
"getEntity",
"(",
"GetEntityOptions",
"getEntityOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getEntityOptions",
",",
"\"getEntityOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",... | Get entity.
Get information about an entity, optionally including all entity content.
With **export**=`false`, this operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the
limit is 200 requests per 30 minutes. For more information, see **Rate limiting**.
@param getEntityOptions the {@link GetEntityOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Entity} | [
"Get",
"entity",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1003-L1022 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listEntities | public ServiceCall<EntityCollection> listEntities(ListEntitiesOptions listEntitiesOptions) {
Validator.notNull(listEntitiesOptions, "listEntitiesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { listEntitiesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listEntities");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listEntitiesOptions.export() != null) {
builder.query("export", String.valueOf(listEntitiesOptions.export()));
}
if (listEntitiesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listEntitiesOptions.pageLimit()));
}
if (listEntitiesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listEntitiesOptions.includeCount()));
}
if (listEntitiesOptions.sort() != null) {
builder.query("sort", listEntitiesOptions.sort());
}
if (listEntitiesOptions.cursor() != null) {
builder.query("cursor", listEntitiesOptions.cursor());
}
if (listEntitiesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listEntitiesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(EntityCollection.class));
} | java | public ServiceCall<EntityCollection> listEntities(ListEntitiesOptions listEntitiesOptions) {
Validator.notNull(listEntitiesOptions, "listEntitiesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { listEntitiesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listEntities");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listEntitiesOptions.export() != null) {
builder.query("export", String.valueOf(listEntitiesOptions.export()));
}
if (listEntitiesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listEntitiesOptions.pageLimit()));
}
if (listEntitiesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listEntitiesOptions.includeCount()));
}
if (listEntitiesOptions.sort() != null) {
builder.query("sort", listEntitiesOptions.sort());
}
if (listEntitiesOptions.cursor() != null) {
builder.query("cursor", listEntitiesOptions.cursor());
}
if (listEntitiesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listEntitiesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(EntityCollection.class));
} | [
"public",
"ServiceCall",
"<",
"EntityCollection",
">",
"listEntities",
"(",
"ListEntitiesOptions",
"listEntitiesOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listEntitiesOptions",
",",
"\"listEntitiesOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pat... | List entities.
List the entities for a workspace.
With **export**=`false`, this operation is limited to 1000 requests per 30 minutes. With **export**=`true`, the
limit is 200 requests per 30 minutes. For more information, see **Rate limiting**.
@param listEntitiesOptions the {@link ListEntitiesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link EntityCollection} | [
"List",
"entities",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1035-L1066 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.updateEntity | public ServiceCall<Entity> updateEntity(UpdateEntityOptions updateEntityOptions) {
Validator.notNull(updateEntityOptions, "updateEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { updateEntityOptions.workspaceId(), updateEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateEntity");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateEntityOptions.newEntity() != null) {
contentJson.addProperty("entity", updateEntityOptions.newEntity());
}
if (updateEntityOptions.newDescription() != null) {
contentJson.addProperty("description", updateEntityOptions.newDescription());
}
if (updateEntityOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newMetadata()));
}
if (updateEntityOptions.newFuzzyMatch() != null) {
contentJson.addProperty("fuzzy_match", updateEntityOptions.newFuzzyMatch());
}
if (updateEntityOptions.newValues() != null) {
contentJson.add("values", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newValues()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
} | java | public ServiceCall<Entity> updateEntity(UpdateEntityOptions updateEntityOptions) {
Validator.notNull(updateEntityOptions, "updateEntityOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities" };
String[] pathParameters = { updateEntityOptions.workspaceId(), updateEntityOptions.entity() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateEntity");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateEntityOptions.newEntity() != null) {
contentJson.addProperty("entity", updateEntityOptions.newEntity());
}
if (updateEntityOptions.newDescription() != null) {
contentJson.addProperty("description", updateEntityOptions.newDescription());
}
if (updateEntityOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newMetadata()));
}
if (updateEntityOptions.newFuzzyMatch() != null) {
contentJson.addProperty("fuzzy_match", updateEntityOptions.newFuzzyMatch());
}
if (updateEntityOptions.newValues() != null) {
contentJson.add("values", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newValues()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class));
} | [
"public",
"ServiceCall",
"<",
"Entity",
">",
"updateEntity",
"(",
"UpdateEntityOptions",
"updateEntityOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateEntityOptions",
",",
"\"updateEntityOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments"... | Update entity.
Update an existing entity with new or modified data. You must provide component objects defining the content of the
updated entity.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param updateEntityOptions the {@link UpdateEntityOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Entity} | [
"Update",
"entity",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1079-L1109 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.createValue | public ServiceCall<Value> createValue(CreateValueOptions createValueOptions) {
Validator.notNull(createValueOptions, "createValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { createValueOptions.workspaceId(), createValueOptions.entity() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("value", createValueOptions.value());
if (createValueOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createValueOptions.metadata()));
}
if (createValueOptions.valueType() != null) {
contentJson.addProperty("type", createValueOptions.valueType());
}
if (createValueOptions.synonyms() != null) {
contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(createValueOptions.synonyms()));
}
if (createValueOptions.patterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(createValueOptions.patterns()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
} | java | public ServiceCall<Value> createValue(CreateValueOptions createValueOptions) {
Validator.notNull(createValueOptions, "createValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { createValueOptions.workspaceId(), createValueOptions.entity() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("value", createValueOptions.value());
if (createValueOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createValueOptions.metadata()));
}
if (createValueOptions.valueType() != null) {
contentJson.addProperty("type", createValueOptions.valueType());
}
if (createValueOptions.synonyms() != null) {
contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(createValueOptions.synonyms()));
}
if (createValueOptions.patterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(createValueOptions.patterns()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
} | [
"public",
"ServiceCall",
"<",
"Value",
">",
"createValue",
"(",
"CreateValueOptions",
"createValueOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"createValueOptions",
",",
"\"createValueOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=... | Create entity value.
Create a new value for an entity.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param createValueOptions the {@link CreateValueOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Value} | [
"Create",
"entity",
"value",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1153-L1181 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.deleteValue | public ServiceCall<Void> deleteValue(DeleteValueOptions deleteValueOptions) {
Validator.notNull(deleteValueOptions, "deleteValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { deleteValueOptions.workspaceId(), deleteValueOptions.entity(), deleteValueOptions
.value() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | java | public ServiceCall<Void> deleteValue(DeleteValueOptions deleteValueOptions) {
Validator.notNull(deleteValueOptions, "deleteValueOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { deleteValueOptions.workspaceId(), deleteValueOptions.entity(), deleteValueOptions
.value() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "deleteValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} | [
"public",
"ServiceCall",
"<",
"Void",
">",
"deleteValue",
"(",
"DeleteValueOptions",
"deleteValueOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"deleteValueOptions",
",",
"\"deleteValueOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"="... | Delete entity value.
Delete a value from an entity.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param deleteValueOptions the {@link DeleteValueOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void | [
"Delete",
"entity",
"value",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1193-L1207 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getValue | public ServiceCall<Value> 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
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(Value.class));
} | java | public ServiceCall<Value> 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
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(Value.class));
} | [
"public",
"ServiceCall",
"<",
"Value",
">",
"getValue",
"(",
"GetValueOptions",
"getValueOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getValueOptions",
",",
"\"getValueOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"... | 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 Value} | [
"Get",
"entity",
"value",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1219-L1238 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listValues | public ServiceCall<ValueCollection> listValues(ListValuesOptions listValuesOptions) {
Validator.notNull(listValuesOptions, "listValuesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { listValuesOptions.workspaceId(), listValuesOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listValues");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listValuesOptions.export() != null) {
builder.query("export", String.valueOf(listValuesOptions.export()));
}
if (listValuesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listValuesOptions.pageLimit()));
}
if (listValuesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listValuesOptions.includeCount()));
}
if (listValuesOptions.sort() != null) {
builder.query("sort", listValuesOptions.sort());
}
if (listValuesOptions.cursor() != null) {
builder.query("cursor", listValuesOptions.cursor());
}
if (listValuesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listValuesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ValueCollection.class));
} | java | public ServiceCall<ValueCollection> listValues(ListValuesOptions listValuesOptions) {
Validator.notNull(listValuesOptions, "listValuesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { listValuesOptions.workspaceId(), listValuesOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listValues");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listValuesOptions.export() != null) {
builder.query("export", String.valueOf(listValuesOptions.export()));
}
if (listValuesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listValuesOptions.pageLimit()));
}
if (listValuesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listValuesOptions.includeCount()));
}
if (listValuesOptions.sort() != null) {
builder.query("sort", listValuesOptions.sort());
}
if (listValuesOptions.cursor() != null) {
builder.query("cursor", listValuesOptions.cursor());
}
if (listValuesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listValuesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ValueCollection.class));
} | [
"public",
"ServiceCall",
"<",
"ValueCollection",
">",
"listValues",
"(",
"ListValuesOptions",
"listValuesOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listValuesOptions",
",",
"\"listValuesOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",... | List entity values.
List the values for an entity.
This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**.
@param listValuesOptions the {@link ListValuesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link ValueCollection} | [
"List",
"entity",
"values",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1250-L1281 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.updateValue | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateValueOptions.newValue() != null) {
contentJson.addProperty("value", updateValueOptions.newValue());
}
if (updateValueOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateValueOptions.newMetadata()));
}
if (updateValueOptions.valueType() != null) {
contentJson.addProperty("type", updateValueOptions.valueType());
}
if (updateValueOptions.newSynonyms() != null) {
contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(updateValueOptions.newSynonyms()));
}
if (updateValueOptions.newPatterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(updateValueOptions.newPatterns()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
} | java | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateValue");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateValueOptions.newValue() != null) {
contentJson.addProperty("value", updateValueOptions.newValue());
}
if (updateValueOptions.newMetadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateValueOptions.newMetadata()));
}
if (updateValueOptions.valueType() != null) {
contentJson.addProperty("type", updateValueOptions.valueType());
}
if (updateValueOptions.newSynonyms() != null) {
contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(updateValueOptions.newSynonyms()));
}
if (updateValueOptions.newPatterns() != null) {
contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(updateValueOptions.newPatterns()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Value.class));
} | [
"public",
"ServiceCall",
"<",
"Value",
">",
"updateValue",
"(",
"UpdateValueOptions",
"updateValueOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateValueOptions",
",",
"\"updateValueOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=... | 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} | [
"Update",
"entity",
"value",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1294-L1325 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getSynonym | public ServiceCall<Synonym> getSynonym(GetSynonymOptions getSynonymOptions) {
Validator.notNull(getSynonymOptions, "getSynonymOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" };
String[] pathParameters = { getSynonymOptions.workspaceId(), getSynonymOptions.entity(), getSynonymOptions.value(),
getSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getSynonym");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getSynonymOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getSynonymOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Synonym.class));
} | java | public ServiceCall<Synonym> getSynonym(GetSynonymOptions getSynonymOptions) {
Validator.notNull(getSynonymOptions, "getSynonymOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" };
String[] pathParameters = { getSynonymOptions.workspaceId(), getSynonymOptions.entity(), getSynonymOptions.value(),
getSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getSynonym");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getSynonymOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getSynonymOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Synonym.class));
} | [
"public",
"ServiceCall",
"<",
"Synonym",
">",
"getSynonym",
"(",
"GetSynonymOptions",
"getSynonymOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getSynonymOptions",
",",
"\"getSynonymOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
... | Get entity value synonym.
Get information about a synonym of an entity value.
This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**.
@param getSynonymOptions the {@link GetSynonymOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Synonym} | [
"Get",
"entity",
"value",
"synonym",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1392-L1409 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listSynonyms | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listSynonyms");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
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));
} | java | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listSynonyms");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
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));
} | [
"public",
"ServiceCall",
"<",
"SynonymCollection",
">",
"listSynonyms",
"(",
"ListSynonymsOptions",
"listSynonymsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listSynonymsOptions",
",",
"\"listSynonymsOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pa... | 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} | [
"List",
"entity",
"value",
"synonyms",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1421-L1450 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.updateSynonym | public ServiceCall<Synonym> updateSynonym(UpdateSynonymOptions updateSynonymOptions) {
Validator.notNull(updateSynonymOptions, "updateSynonymOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" };
String[] pathParameters = { updateSynonymOptions.workspaceId(), updateSynonymOptions.entity(), updateSynonymOptions
.value(), updateSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateSynonym");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateSynonymOptions.newSynonym() != null) {
contentJson.addProperty("synonym", updateSynonymOptions.newSynonym());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Synonym.class));
} | java | public ServiceCall<Synonym> updateSynonym(UpdateSynonymOptions updateSynonymOptions) {
Validator.notNull(updateSynonymOptions, "updateSynonymOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" };
String[] pathParameters = { updateSynonymOptions.workspaceId(), updateSynonymOptions.entity(), updateSynonymOptions
.value(), updateSynonymOptions.synonym() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateSynonym");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateSynonymOptions.newSynonym() != null) {
contentJson.addProperty("synonym", updateSynonymOptions.newSynonym());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Synonym.class));
} | [
"public",
"ServiceCall",
"<",
"Synonym",
">",
"updateSynonym",
"(",
"UpdateSynonymOptions",
"updateSynonymOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"updateSynonymOptions",
",",
"\"updateSynonymOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSeg... | Update entity value synonym.
Update an existing entity value synonym with new text.
This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
@param updateSynonymOptions the {@link UpdateSynonymOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link Synonym} | [
"Update",
"entity",
"value",
"synonym",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1462-L1481 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.getDialogNode | public ServiceCall<DialogNode> getDialogNode(GetDialogNodeOptions getDialogNodeOptions) {
Validator.notNull(getDialogNodeOptions, "getDialogNodeOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "dialog_nodes" };
String[] pathParameters = { getDialogNodeOptions.workspaceId(), getDialogNodeOptions.dialogNode() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getDialogNode");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getDialogNodeOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getDialogNodeOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNode.class));
} | java | public ServiceCall<DialogNode> getDialogNode(GetDialogNodeOptions getDialogNodeOptions) {
Validator.notNull(getDialogNodeOptions, "getDialogNodeOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "dialog_nodes" };
String[] pathParameters = { getDialogNodeOptions.workspaceId(), getDialogNodeOptions.dialogNode() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "getDialogNode");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getDialogNodeOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(getDialogNodeOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNode.class));
} | [
"public",
"ServiceCall",
"<",
"DialogNode",
">",
"getDialogNode",
"(",
"GetDialogNodeOptions",
"getDialogNodeOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"getDialogNodeOptions",
",",
"\"getDialogNodeOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"path... | Get dialog node.
Get information about a dialog node.
This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**.
@param getDialogNodeOptions the {@link GetDialogNodeOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link DialogNode} | [
"Get",
"dialog",
"node",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1597-L1613 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listDialogNodes | public ServiceCall<DialogNodeCollection> listDialogNodes(ListDialogNodesOptions listDialogNodesOptions) {
Validator.notNull(listDialogNodesOptions, "listDialogNodesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "dialog_nodes" };
String[] pathParameters = { listDialogNodesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listDialogNodes");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listDialogNodesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listDialogNodesOptions.pageLimit()));
}
if (listDialogNodesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listDialogNodesOptions.includeCount()));
}
if (listDialogNodesOptions.sort() != null) {
builder.query("sort", listDialogNodesOptions.sort());
}
if (listDialogNodesOptions.cursor() != null) {
builder.query("cursor", listDialogNodesOptions.cursor());
}
if (listDialogNodesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listDialogNodesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNodeCollection.class));
} | java | public ServiceCall<DialogNodeCollection> listDialogNodes(ListDialogNodesOptions listDialogNodesOptions) {
Validator.notNull(listDialogNodesOptions, "listDialogNodesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "dialog_nodes" };
String[] pathParameters = { listDialogNodesOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listDialogNodes");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listDialogNodesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listDialogNodesOptions.pageLimit()));
}
if (listDialogNodesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listDialogNodesOptions.includeCount()));
}
if (listDialogNodesOptions.sort() != null) {
builder.query("sort", listDialogNodesOptions.sort());
}
if (listDialogNodesOptions.cursor() != null) {
builder.query("cursor", listDialogNodesOptions.cursor());
}
if (listDialogNodesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listDialogNodesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNodeCollection.class));
} | [
"public",
"ServiceCall",
"<",
"DialogNodeCollection",
">",
"listDialogNodes",
"(",
"ListDialogNodesOptions",
"listDialogNodesOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listDialogNodesOptions",
",",
"\"listDialogNodesOptions cannot be null\"",
")",
";",
"String",
... | List dialog nodes.
List the dialog nodes for a workspace.
This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**.
@param listDialogNodesOptions the {@link ListDialogNodesOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link DialogNodeCollection} | [
"List",
"dialog",
"nodes",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1625-L1653 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listAllLogs | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listAllLogs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
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));
} | java | 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);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listAllLogs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
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));
} | [
"public",
"ServiceCall",
"<",
"LogCollection",
">",
"listAllLogs",
"(",
"ListAllLogsOptions",
"listAllLogsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listAllLogsOptions",
",",
"\"listAllLogsOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegment... | 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} | [
"List",
"log",
"events",
"in",
"all",
"workspaces",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1747-L1768 | train |
watson-developer-cloud/java-sdk | assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java | Assistant.listLogs | public ServiceCall<LogCollection> listLogs(ListLogsOptions listLogsOptions) {
Validator.notNull(listLogsOptions, "listLogsOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "logs" };
String[] pathParameters = { listLogsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listLogs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listLogsOptions.sort() != null) {
builder.query("sort", listLogsOptions.sort());
}
if (listLogsOptions.filter() != null) {
builder.query("filter", listLogsOptions.filter());
}
if (listLogsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listLogsOptions.pageLimit()));
}
if (listLogsOptions.cursor() != null) {
builder.query("cursor", listLogsOptions.cursor());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogCollection.class));
} | java | public ServiceCall<LogCollection> listLogs(ListLogsOptions listLogsOptions) {
Validator.notNull(listLogsOptions, "listLogsOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "logs" };
String[] pathParameters = { listLogsOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listLogs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listLogsOptions.sort() != null) {
builder.query("sort", listLogsOptions.sort());
}
if (listLogsOptions.filter() != null) {
builder.query("filter", listLogsOptions.filter());
}
if (listLogsOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listLogsOptions.pageLimit()));
}
if (listLogsOptions.cursor() != null) {
builder.query("cursor", listLogsOptions.cursor());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LogCollection.class));
} | [
"public",
"ServiceCall",
"<",
"LogCollection",
">",
"listLogs",
"(",
"ListLogsOptions",
"listLogsOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"listLogsOptions",
",",
"\"listLogsOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{... | List log events in a workspace.
List the events from the log of a specific workspace.
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 listLogsOptions the {@link ListLogsOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link LogCollection} | [
"List",
"log",
"events",
"in",
"a",
"workspace",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java#L1781-L1806 | train |
watson-developer-cloud/java-sdk | tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java | ToneAnalyzer.tone | public ServiceCall<ToneAnalysis> tone(ToneOptions toneOptions) {
Validator.notNull(toneOptions, "toneOptions cannot be null");
String[] pathSegments = { "v3/tone" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("tone_analyzer", "v3", "tone");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (toneOptions.contentLanguage() != null) {
builder.header("Content-Language", toneOptions.contentLanguage());
}
if (toneOptions.acceptLanguage() != null) {
builder.header("Accept-Language", toneOptions.acceptLanguage());
}
if (toneOptions.contentType() != null) {
builder.header("Content-Type", toneOptions.contentType());
}
if (toneOptions.sentences() != null) {
builder.query("sentences", String.valueOf(toneOptions.sentences()));
}
if (toneOptions.tones() != null) {
builder.query("tones", RequestUtils.join(toneOptions.tones(), ","));
}
builder.bodyContent(toneOptions.contentType(), toneOptions.toneInput(), null, toneOptions.body());
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ToneAnalysis.class));
} | java | public ServiceCall<ToneAnalysis> tone(ToneOptions toneOptions) {
Validator.notNull(toneOptions, "toneOptions cannot be null");
String[] pathSegments = { "v3/tone" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("tone_analyzer", "v3", "tone");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (toneOptions.contentLanguage() != null) {
builder.header("Content-Language", toneOptions.contentLanguage());
}
if (toneOptions.acceptLanguage() != null) {
builder.header("Accept-Language", toneOptions.acceptLanguage());
}
if (toneOptions.contentType() != null) {
builder.header("Content-Type", toneOptions.contentType());
}
if (toneOptions.sentences() != null) {
builder.query("sentences", String.valueOf(toneOptions.sentences()));
}
if (toneOptions.tones() != null) {
builder.query("tones", RequestUtils.join(toneOptions.tones(), ","));
}
builder.bodyContent(toneOptions.contentType(), toneOptions.toneInput(), null, toneOptions.body());
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ToneAnalysis.class));
} | [
"public",
"ServiceCall",
"<",
"ToneAnalysis",
">",
"tone",
"(",
"ToneOptions",
"toneOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"toneOptions",
",",
"\"toneOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
"{",
"\"v3/tone\"",
... | Analyze general tone.
Use the general purpose endpoint to analyze the tone of your input content. The service analyzes the content for
emotional and language tones. The method always analyzes the tone of the full document; by default, it also
analyzes the tone of each individual sentence of the content.
You can submit no more than 128 KB of total input content and no more than 1000 individual sentences in JSON, plain
text, or HTML format. The service analyzes the first 1000 sentences for document-level analysis and only the first
100 sentences for sentence-level analysis.
Per the JSON specification, the default character encoding for JSON content is effectively always UTF-8; per the
HTTP specification, the default encoding for plain text and HTML is ISO-8859-1 (effectively, the ASCII character
set). When specifying a content type of plain text or HTML, include the `charset` parameter to indicate the
character encoding of the input text; for example: `Content-Type: text/plain;charset=utf-8`. For `text/html`, the
service removes HTML tags and analyzes only the textual content.
**See also:** [Using the general-purpose
endpoint](https://cloud.ibm.com/docs/services/tone-analyzer/using-tone.html#using-the-general-purpose-endpoint).
@param toneOptions the {@link ToneOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link ToneAnalysis} | [
"Analyze",
"general",
"tone",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java#L121-L148 | train |
watson-developer-cloud/java-sdk | tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java | ToneAnalyzer.toneChat | public ServiceCall<UtteranceAnalyses> toneChat(ToneChatOptions toneChatOptions) {
Validator.notNull(toneChatOptions, "toneChatOptions cannot be null");
String[] pathSegments = { "v3/tone_chat" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("tone_analyzer", "v3", "toneChat");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (toneChatOptions.contentLanguage() != null) {
builder.header("Content-Language", toneChatOptions.contentLanguage());
}
if (toneChatOptions.acceptLanguage() != null) {
builder.header("Accept-Language", toneChatOptions.acceptLanguage());
}
final JsonObject contentJson = new JsonObject();
contentJson.add("utterances", GsonSingleton.getGson().toJsonTree(toneChatOptions.utterances()));
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(UtteranceAnalyses.class));
} | java | public ServiceCall<UtteranceAnalyses> toneChat(ToneChatOptions toneChatOptions) {
Validator.notNull(toneChatOptions, "toneChatOptions cannot be null");
String[] pathSegments = { "v3/tone_chat" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("tone_analyzer", "v3", "toneChat");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (toneChatOptions.contentLanguage() != null) {
builder.header("Content-Language", toneChatOptions.contentLanguage());
}
if (toneChatOptions.acceptLanguage() != null) {
builder.header("Accept-Language", toneChatOptions.acceptLanguage());
}
final JsonObject contentJson = new JsonObject();
contentJson.add("utterances", GsonSingleton.getGson().toJsonTree(toneChatOptions.utterances()));
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(UtteranceAnalyses.class));
} | [
"public",
"ServiceCall",
"<",
"UtteranceAnalyses",
">",
"toneChat",
"(",
"ToneChatOptions",
"toneChatOptions",
")",
"{",
"Validator",
".",
"notNull",
"(",
"toneChatOptions",
",",
"\"toneChatOptions cannot be null\"",
")",
";",
"String",
"[",
"]",
"pathSegments",
"=",
... | Analyze customer engagement tone.
Use the customer engagement endpoint to analyze the tone of customer service and customer support conversations.
For each utterance of a conversation, the method reports the most prevalent subset of the following seven tones:
sad, frustrated, satisfied, excited, polite, impolite, and sympathetic.
If you submit more than 50 utterances, the service returns a warning for the overall content and analyzes only the
first 50 utterances. If you submit a single utterance that contains more than 500 characters, the service returns
an error for that utterance and does not analyze the utterance. The request fails if all utterances have more than
500 characters. Per the JSON specification, the default character encoding for JSON content is effectively always
UTF-8.
**See also:** [Using the customer-engagement
endpoint]
(https://cloud.ibm.com/docs/services/tone-analyzer/using-tone-chat.html#using-the-customer-engagement-endpoint).
@param toneChatOptions the {@link ToneChatOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of {@link UtteranceAnalyses} | [
"Analyze",
"customer",
"engagement",
"tone",
"."
] | c926117afd20e2002b69942537720ab733a914f3 | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java#L170-L190 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/UniqueNamer.java | UniqueNamer.getName | public String getName(String oldName) {
if (oldName != null && this.existing.containsKey(oldName)) {
return this.existing.get(oldName);
}
final String name = this.prefix + this.counter;
this.counter++;
if (oldName != null) {
this.existing.put(oldName, name);
}
return name;
} | java | public String getName(String oldName) {
if (oldName != null && this.existing.containsKey(oldName)) {
return this.existing.get(oldName);
}
final String name = this.prefix + this.counter;
this.counter++;
if (oldName != null) {
this.existing.put(oldName, name);
}
return name;
} | [
"public",
"String",
"getName",
"(",
"String",
"oldName",
")",
"{",
"if",
"(",
"oldName",
"!=",
"null",
"&&",
"this",
".",
"existing",
".",
"containsKey",
"(",
"oldName",
")",
")",
"{",
"return",
"this",
".",
"existing",
".",
"get",
"(",
"oldName",
")",... | Gets the new name for the given old name, where if no old name is given a
new name will be generated.
@param oldName
the old name to get the new name for.
@return the new name. | [
"Gets",
"the",
"new",
"name",
"for",
"the",
"given",
"old",
"name",
"where",
"if",
"no",
"old",
"name",
"is",
"given",
"a",
"new",
"name",
"will",
"be",
"generated",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/UniqueNamer.java#L46-L59 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java | JsonLdUtils.isNode | static boolean isNode(Object v) {
// Note: A value is a subject if all of these hold true:
// 1. It is an Object.
// 2. It is not a @value, @set, or @list.
// 3. It has more than 1 key OR any existing key is not @id.
if (v instanceof Map && !(((Map) v).containsKey("@value") || ((Map) v).containsKey("@set")
|| ((Map) v).containsKey("@list"))) {
return ((Map<String, Object>) v).size() > 1 || !((Map) v).containsKey("@id");
}
return false;
} | java | static boolean isNode(Object v) {
// Note: A value is a subject if all of these hold true:
// 1. It is an Object.
// 2. It is not a @value, @set, or @list.
// 3. It has more than 1 key OR any existing key is not @id.
if (v instanceof Map && !(((Map) v).containsKey("@value") || ((Map) v).containsKey("@set")
|| ((Map) v).containsKey("@list"))) {
return ((Map<String, Object>) v).size() > 1 || !((Map) v).containsKey("@id");
}
return false;
} | [
"static",
"boolean",
"isNode",
"(",
"Object",
"v",
")",
"{",
"// Note: A value is a subject if all of these hold true:",
"// 1. It is an Object.",
"// 2. It is not a @value, @set, or @list.",
"// 3. It has more than 1 key OR any existing key is not @id.",
"if",
"(",
"v",
"instanceof",
... | Returns true if the given value is a subject with properties.
@param v
the value to check.
@return true if the value is a subject with properties, false if not. | [
"Returns",
"true",
"if",
"the",
"given",
"value",
"is",
"a",
"subject",
"with",
"properties",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L150-L160 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java | JsonLdUtils.isNodeReference | static boolean isNodeReference(Object v) {
// Note: A value is a subject reference if all of these hold true:
// 1. It is an Object.
// 2. It has a single key: @id.
return (v instanceof Map && ((Map<String, Object>) v).size() == 1
&& ((Map<String, Object>) v).containsKey("@id"));
} | java | static boolean isNodeReference(Object v) {
// Note: A value is a subject reference if all of these hold true:
// 1. It is an Object.
// 2. It has a single key: @id.
return (v instanceof Map && ((Map<String, Object>) v).size() == 1
&& ((Map<String, Object>) v).containsKey("@id"));
} | [
"static",
"boolean",
"isNodeReference",
"(",
"Object",
"v",
")",
"{",
"// Note: A value is a subject reference if all of these hold true:",
"// 1. It is an Object.",
"// 2. It has a single key: @id.",
"return",
"(",
"v",
"instanceof",
"Map",
"&&",
"(",
"(",
"Map",
"<",
"Str... | Returns true if the given value is a subject reference.
@param v
the value to check.
@return true if the value is a subject reference, false if not. | [
"Returns",
"true",
"if",
"the",
"given",
"value",
"is",
"a",
"subject",
"reference",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L170-L176 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java | JsonLdUtils.fillNodesToPrune | static void fillNodesToPrune(Object input, final Map<String, Object> toPrune) {
// recurse through arrays
if (isArray(input)) {
for (final Object i : (List<Object>) input) {
fillNodesToPrune(i, toPrune);
}
} else if (isObject(input)) {
// skip @values
if (isValue(input)) {
return;
}
// recurse through @lists
if (isList(input)) {
fillNodesToPrune(((Map<String, Object>) input).get("@list"), toPrune);
return;
}
// recurse through properties
for (final String prop : new LinkedHashSet<>(((Map<String, Object>) input).keySet())) {
if (prop.equals(JsonLdConsts.ID)) {
final String id = (String) ((Map<String, Object>) input).get(JsonLdConsts.ID);
if (id.startsWith("_:")) {
// if toPrune contains the id already, it was already
// present somewhere else,
// so we just null the value
if (toPrune.containsKey(id)) {
toPrune.put(id, null);
} else {
// else we add the object as the value
toPrune.put(id, input);
}
}
} else {
fillNodesToPrune(((Map<String, Object>) input).get(prop), toPrune);
}
}
} else if (input instanceof String) {
// this is an id, as non-id values will have been discarded by the
// isValue() above
final String p = (String) input;
if (p.startsWith("_:")) {
// the id is outside of the context of an @id property, if we're
// in that case,
// then we're referencing a blank node id so this id should not
// be removed
toPrune.put(p, null);
}
}
} | java | static void fillNodesToPrune(Object input, final Map<String, Object> toPrune) {
// recurse through arrays
if (isArray(input)) {
for (final Object i : (List<Object>) input) {
fillNodesToPrune(i, toPrune);
}
} else if (isObject(input)) {
// skip @values
if (isValue(input)) {
return;
}
// recurse through @lists
if (isList(input)) {
fillNodesToPrune(((Map<String, Object>) input).get("@list"), toPrune);
return;
}
// recurse through properties
for (final String prop : new LinkedHashSet<>(((Map<String, Object>) input).keySet())) {
if (prop.equals(JsonLdConsts.ID)) {
final String id = (String) ((Map<String, Object>) input).get(JsonLdConsts.ID);
if (id.startsWith("_:")) {
// if toPrune contains the id already, it was already
// present somewhere else,
// so we just null the value
if (toPrune.containsKey(id)) {
toPrune.put(id, null);
} else {
// else we add the object as the value
toPrune.put(id, input);
}
}
} else {
fillNodesToPrune(((Map<String, Object>) input).get(prop), toPrune);
}
}
} else if (input instanceof String) {
// this is an id, as non-id values will have been discarded by the
// isValue() above
final String p = (String) input;
if (p.startsWith("_:")) {
// the id is outside of the context of an @id property, if we're
// in that case,
// then we're referencing a blank node id so this id should not
// be removed
toPrune.put(p, null);
}
}
} | [
"static",
"void",
"fillNodesToPrune",
"(",
"Object",
"input",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"toPrune",
")",
"{",
"// recurse through arrays",
"if",
"(",
"isArray",
"(",
"input",
")",
")",
"{",
"for",
"(",
"final",
"Object",
"i",
... | Gets the objects on which we'll prune the blank node ID
@param input
the framed output before compaction
@param toPrune
the resulting object. | [
"Gets",
"the",
"objects",
"on",
"which",
"we",
"ll",
"prune",
"the",
"blank",
"node",
"ID"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L275-L322 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java | JsonLdUtils.isBlankNode | static boolean isBlankNode(Object v) {
// Note: A value is a blank node if all of these hold true:
// 1. It is an Object.
// 2. If it has an @id key its value begins with '_:'.
// 3. It has no keys OR is not a @value, @set, or @list.
if (v instanceof Map) {
final Map<String, Object> map = (Map<String, Object>) v;
if (map.containsKey("@id")) {
return ((String) map.get("@id")).startsWith("_:");
} else {
return map.isEmpty() || !map.containsKey("@value") || map.containsKey("@set")
|| map.containsKey("@list");
}
}
return false;
} | java | static boolean isBlankNode(Object v) {
// Note: A value is a blank node if all of these hold true:
// 1. It is an Object.
// 2. If it has an @id key its value begins with '_:'.
// 3. It has no keys OR is not a @value, @set, or @list.
if (v instanceof Map) {
final Map<String, Object> map = (Map<String, Object>) v;
if (map.containsKey("@id")) {
return ((String) map.get("@id")).startsWith("_:");
} else {
return map.isEmpty() || !map.containsKey("@value") || map.containsKey("@set")
|| map.containsKey("@list");
}
}
return false;
} | [
"static",
"boolean",
"isBlankNode",
"(",
"Object",
"v",
")",
"{",
"// Note: A value is a blank node if all of these hold true:",
"// 1. It is an Object.",
"// 2. If it has an @id key its value begins with '_:'.",
"// 3. It has no keys OR is not a @value, @set, or @list.",
"if",
"(",
"v",... | Returns true if the given value is a blank node.
@param v
the value to check.
@return true if the value is a blank node, false if not. | [
"Returns",
"true",
"if",
"the",
"given",
"value",
"is",
"a",
"blank",
"node",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L393-L408 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java | JsonLdUtils.isList | static Boolean isList(Object v) {
return (v instanceof Map && ((Map<String, Object>) v).containsKey("@list"));
} | java | static Boolean isList(Object v) {
return (v instanceof Map && ((Map<String, Object>) v).containsKey("@list"));
} | [
"static",
"Boolean",
"isList",
"(",
"Object",
"v",
")",
"{",
"return",
"(",
"v",
"instanceof",
"Map",
"&&",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"v",
")",
".",
"containsKey",
"(",
"\"@list\"",
")",
")",
";",
"}"
] | Returns true if the given value is a JSON-LD List
@param v
the value to check.
@return | [
"Returns",
"true",
"if",
"the",
"given",
"value",
"is",
"a",
"JSON",
"-",
"LD",
"List"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L457-L459 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java | JsonLdUtils.isValue | static Boolean isValue(Object v) {
return (v instanceof Map && ((Map<String, Object>) v).containsKey("@value"));
} | java | static Boolean isValue(Object v) {
return (v instanceof Map && ((Map<String, Object>) v).containsKey("@value"));
} | [
"static",
"Boolean",
"isValue",
"(",
"Object",
"v",
")",
"{",
"return",
"(",
"v",
"instanceof",
"Map",
"&&",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"v",
")",
".",
"containsKey",
"(",
"\"@value\"",
")",
")",
";",
"}"
] | Returns true if the given value is a JSON-LD value
@param v
the value to check.
@return | [
"Returns",
"true",
"if",
"the",
"given",
"value",
"is",
"a",
"JSON",
"-",
"LD",
"value"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L479-L481 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonLdUrl.java | JsonLdUrl.removeDotSegments | public static String removeDotSegments(String path, boolean hasAuthority) {
String rval = "";
if (path.indexOf("/") == 0) {
rval = "/";
}
// RFC 3986 5.2.4 (reworked)
final List<String> input = new ArrayList<String>(Arrays.asList(path.split("/")));
if (path.endsWith("/")) {
// javascript .split includes a blank entry if the string ends with
// the delimiter, java .split does not so we need to add it manually
input.add("");
}
final List<String> output = new ArrayList<String>();
for (int i = 0; i < input.size(); i++) {
if (".".equals(input.get(i)) || ("".equals(input.get(i)) && input.size() - i > 1)) {
// input.remove(0);
continue;
}
if ("..".equals(input.get(i))) {
// input.remove(0);
if (hasAuthority
|| (output.size() > 0 && !"..".equals(output.get(output.size() - 1)))) {
// [].pop() doesn't fail, to replicate this we need to check
// that there is something to remove
if (output.size() > 0) {
output.remove(output.size() - 1);
}
} else {
output.add("..");
}
continue;
}
output.add(input.get(i));
// input.remove(0);
}
if (output.size() > 0) {
rval += output.get(0);
for (int i = 1; i < output.size(); i++) {
rval += "/" + output.get(i);
}
}
return rval;
} | java | public static String removeDotSegments(String path, boolean hasAuthority) {
String rval = "";
if (path.indexOf("/") == 0) {
rval = "/";
}
// RFC 3986 5.2.4 (reworked)
final List<String> input = new ArrayList<String>(Arrays.asList(path.split("/")));
if (path.endsWith("/")) {
// javascript .split includes a blank entry if the string ends with
// the delimiter, java .split does not so we need to add it manually
input.add("");
}
final List<String> output = new ArrayList<String>();
for (int i = 0; i < input.size(); i++) {
if (".".equals(input.get(i)) || ("".equals(input.get(i)) && input.size() - i > 1)) {
// input.remove(0);
continue;
}
if ("..".equals(input.get(i))) {
// input.remove(0);
if (hasAuthority
|| (output.size() > 0 && !"..".equals(output.get(output.size() - 1)))) {
// [].pop() doesn't fail, to replicate this we need to check
// that there is something to remove
if (output.size() > 0) {
output.remove(output.size() - 1);
}
} else {
output.add("..");
}
continue;
}
output.add(input.get(i));
// input.remove(0);
}
if (output.size() > 0) {
rval += output.get(0);
for (int i = 1; i < output.size(); i++) {
rval += "/" + output.get(i);
}
}
return rval;
} | [
"public",
"static",
"String",
"removeDotSegments",
"(",
"String",
"path",
",",
"boolean",
"hasAuthority",
")",
"{",
"String",
"rval",
"=",
"\"\"",
";",
"if",
"(",
"path",
".",
"indexOf",
"(",
"\"/\"",
")",
"==",
"0",
")",
"{",
"rval",
"=",
"\"/\"",
";"... | Removes dot segments from a JsonLdUrl path.
@param path
the path to remove dot segments from.
@param hasAuthority
true if the JsonLdUrl has an authority, false if not.
@return The URL without the dot segments | [
"Removes",
"dot",
"segments",
"from",
"a",
"JsonLdUrl",
"path",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonLdUrl.java#L114-L159 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonLdUrl.java | JsonLdUrl.parseAuthority | private static void parseAuthority(JsonLdUrl parsed) {
// parse authority for unparsed relative network-path reference
if (parsed.href.indexOf(":") == -1 && parsed.href.indexOf("//") == 0
&& "".equals(parsed.host)) {
// must parse authority from pathname
parsed.pathname = parsed.pathname.substring(2);
final int idx = parsed.pathname.indexOf("/");
if (idx == -1) {
parsed.authority = parsed.pathname;
parsed.pathname = "";
} else {
parsed.authority = parsed.pathname.substring(0, idx);
parsed.pathname = parsed.pathname.substring(idx);
}
} else {
// construct authority
parsed.authority = parsed.host;
if (!"".equals(parsed.auth)) {
parsed.authority = parsed.auth + "@" + parsed.authority;
}
}
} | java | private static void parseAuthority(JsonLdUrl parsed) {
// parse authority for unparsed relative network-path reference
if (parsed.href.indexOf(":") == -1 && parsed.href.indexOf("//") == 0
&& "".equals(parsed.host)) {
// must parse authority from pathname
parsed.pathname = parsed.pathname.substring(2);
final int idx = parsed.pathname.indexOf("/");
if (idx == -1) {
parsed.authority = parsed.pathname;
parsed.pathname = "";
} else {
parsed.authority = parsed.pathname.substring(0, idx);
parsed.pathname = parsed.pathname.substring(idx);
}
} else {
// construct authority
parsed.authority = parsed.host;
if (!"".equals(parsed.auth)) {
parsed.authority = parsed.auth + "@" + parsed.authority;
}
}
} | [
"private",
"static",
"void",
"parseAuthority",
"(",
"JsonLdUrl",
"parsed",
")",
"{",
"// parse authority for unparsed relative network-path reference",
"if",
"(",
"parsed",
".",
"href",
".",
"indexOf",
"(",
"\":\"",
")",
"==",
"-",
"1",
"&&",
"parsed",
".",
"href"... | Parses the authority for the pre-parsed given JsonLdUrl.
@param parsed
the pre-parsed JsonLdUrl. | [
"Parses",
"the",
"authority",
"for",
"the",
"pre",
"-",
"parsed",
"given",
"JsonLdUrl",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonLdUrl.java#L293-L314 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/RDFDatasetUtils.java | RDFDatasetUtils.escape | public static void escape(String str, StringBuilder rval) {
for (int i = 0; i < str.length(); i++) {
final char hi = str.charAt(i);
if (hi <= 0x8 || hi == 0xB || hi == 0xC || (hi >= 0xE && hi <= 0x1F)
|| (hi >= 0x7F && hi <= 0xA0) || // 0xA0 is end of
// non-printable latin-1
// supplement
// characters
((hi >= 0x24F // 0x24F is the end of latin extensions
&& !Character.isHighSurrogate(hi))
// TODO: there's probably a lot of other characters that
// shouldn't be escaped that
// fall outside these ranges, this is one example from the
// json-ld tests
)) {
rval.append(String.format("\\u%04x", (int) hi));
} else if (Character.isHighSurrogate(hi)) {
final char lo = str.charAt(++i);
final int c = (hi << 10) + lo + (0x10000 - (0xD800 << 10) - 0xDC00);
rval.append(String.format("\\U%08x", c));
} else {
switch (hi) {
case '\b':
rval.append("\\b");
break;
case '\n':
rval.append("\\n");
break;
case '\t':
rval.append("\\t");
break;
case '\f':
rval.append("\\f");
break;
case '\r':
rval.append("\\r");
break;
// case '\'':
// rval += "\\'";
// break;
case '\"':
rval.append("\\\"");
// rval += "\\u0022";
break;
case '\\':
rval.append("\\\\");
break;
default:
// just put the char as is
rval.append(hi);
break;
}
}
}
// return rval;
} | java | public static void escape(String str, StringBuilder rval) {
for (int i = 0; i < str.length(); i++) {
final char hi = str.charAt(i);
if (hi <= 0x8 || hi == 0xB || hi == 0xC || (hi >= 0xE && hi <= 0x1F)
|| (hi >= 0x7F && hi <= 0xA0) || // 0xA0 is end of
// non-printable latin-1
// supplement
// characters
((hi >= 0x24F // 0x24F is the end of latin extensions
&& !Character.isHighSurrogate(hi))
// TODO: there's probably a lot of other characters that
// shouldn't be escaped that
// fall outside these ranges, this is one example from the
// json-ld tests
)) {
rval.append(String.format("\\u%04x", (int) hi));
} else if (Character.isHighSurrogate(hi)) {
final char lo = str.charAt(++i);
final int c = (hi << 10) + lo + (0x10000 - (0xD800 << 10) - 0xDC00);
rval.append(String.format("\\U%08x", c));
} else {
switch (hi) {
case '\b':
rval.append("\\b");
break;
case '\n':
rval.append("\\n");
break;
case '\t':
rval.append("\\t");
break;
case '\f':
rval.append("\\f");
break;
case '\r':
rval.append("\\r");
break;
// case '\'':
// rval += "\\'";
// break;
case '\"':
rval.append("\\\"");
// rval += "\\u0022";
break;
case '\\':
rval.append("\\\\");
break;
default:
// just put the char as is
rval.append(hi);
break;
}
}
}
// return rval;
} | [
"public",
"static",
"void",
"escape",
"(",
"String",
"str",
",",
"StringBuilder",
"rval",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"char",
"hi",
"=",
"str",
".... | Escapes the given string according to the N-Quads escape rules
@param str
The string to escape
@param rval
The {@link StringBuilder} to append to. | [
"Escapes",
"the",
"given",
"string",
"according",
"to",
"the",
"N",
"-",
"Quads",
"escape",
"rules"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDatasetUtils.java#L203-L258 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/RDFDataset.java | RDFDataset.getContext | public Map<String, Object> getContext() {
final Map<String, Object> rval = newMap();
rval.putAll(context);
// replace "" with "@vocab"
if (rval.containsKey("")) {
rval.put("@vocab", rval.remove(""));
}
return rval;
} | java | public Map<String, Object> getContext() {
final Map<String, Object> rval = newMap();
rval.putAll(context);
// replace "" with "@vocab"
if (rval.containsKey("")) {
rval.put("@vocab", rval.remove(""));
}
return rval;
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getContext",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"rval",
"=",
"newMap",
"(",
")",
";",
"rval",
".",
"putAll",
"(",
"context",
")",
";",
"// replace \"\" with \"@vocab\"",
... | Returns a valid context containing any namespaces set
@return The context map | [
"Returns",
"a",
"valid",
"context",
"containing",
"any",
"namespaces",
"set"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L412-L420 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/RDFDataset.java | RDFDataset.parseContext | public void parseContext(Object contextLike) throws JsonLdError {
Context context;
if (api != null) {
context = new Context(api.opts);
} else {
context = new Context();
}
// Context will do our recursive parsing and initial IRI resolution
context = context.parse(contextLike);
// And then leak to us the potential 'prefixes'
final Map<String, String> prefixes = context.getPrefixes(true);
for (final String key : prefixes.keySet()) {
final String val = prefixes.get(key);
if ("@vocab".equals(key)) {
if (val == null || isString(val)) {
setNamespace("", val);
} else {
}
} else if (!isKeyword(key)) {
setNamespace(key, val);
// TODO: should we make sure val is a valid URI prefix (i.e. it
// ends with /# or ?)
// or is it ok that full URIs for terms are used?
}
}
} | java | public void parseContext(Object contextLike) throws JsonLdError {
Context context;
if (api != null) {
context = new Context(api.opts);
} else {
context = new Context();
}
// Context will do our recursive parsing and initial IRI resolution
context = context.parse(contextLike);
// And then leak to us the potential 'prefixes'
final Map<String, String> prefixes = context.getPrefixes(true);
for (final String key : prefixes.keySet()) {
final String val = prefixes.get(key);
if ("@vocab".equals(key)) {
if (val == null || isString(val)) {
setNamespace("", val);
} else {
}
} else if (!isKeyword(key)) {
setNamespace(key, val);
// TODO: should we make sure val is a valid URI prefix (i.e. it
// ends with /# or ?)
// or is it ok that full URIs for terms are used?
}
}
} | [
"public",
"void",
"parseContext",
"(",
"Object",
"contextLike",
")",
"throws",
"JsonLdError",
"{",
"Context",
"context",
";",
"if",
"(",
"api",
"!=",
"null",
")",
"{",
"context",
"=",
"new",
"Context",
"(",
"api",
".",
"opts",
")",
";",
"}",
"else",
"{... | parses a context object and sets any namespaces found within it
@param contextLike
The context to parse
@throws JsonLdError
If the context can't be parsed | [
"parses",
"a",
"context",
"object",
"and",
"sets",
"any",
"namespaces",
"found",
"within",
"it"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L430-L456 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/RDFDataset.java | RDFDataset.addTriple | public void addTriple(final String subject, final String predicate, final String object) {
addQuad(subject, predicate, object, "@default");
} | java | public void addTriple(final String subject, final String predicate, final String object) {
addQuad(subject, predicate, object, "@default");
} | [
"public",
"void",
"addTriple",
"(",
"final",
"String",
"subject",
",",
"final",
"String",
"predicate",
",",
"final",
"String",
"object",
")",
"{",
"addQuad",
"(",
"subject",
",",
"predicate",
",",
"object",
",",
"\"@default\"",
")",
";",
"}"
] | Adds a triple to the default graph of this dataset
@param subject
the subject for the triple
@param predicate
the predicate for the triple
@param object
the object for the triple | [
"Adds",
"a",
"triple",
"to",
"the",
"default",
"graph",
"of",
"this",
"dataset"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L516-L518 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/RDFDataset.java | RDFDataset.objectToRDF | private Node objectToRDF(Object item) {
// convert value object to RDF
if (isValue(item)) {
final Object value = ((Map<String, Object>) item).get("@value");
final Object datatype = ((Map<String, Object>) item).get("@type");
// convert to XSD datatypes as appropriate
if (value instanceof Boolean || value instanceof Number) {
// convert to XSD datatype
if (value instanceof Boolean) {
return new Literal(value.toString(),
datatype == null ? XSD_BOOLEAN : (String) datatype, null);
} else if (value instanceof Double || value instanceof Float
|| XSD_DOUBLE.equals(datatype)) {
if (value instanceof Double && !Double.isFinite((double) value)) {
return new Literal(Double.toString((double) value),
datatype == null ? XSD_DOUBLE : (String) datatype, null);
} else if (value instanceof Float && !Float.isFinite((float) value)) {
return new Literal(Float.toString((float) value),
datatype == null ? XSD_DOUBLE : (String) datatype, null);
} else {
// canonical double representation
final DecimalFormat df = new DecimalFormat("0.0###############E0");
df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
return new Literal(df.format(value),
datatype == null ? XSD_DOUBLE : (String) datatype, null);
}
} else {
final DecimalFormat df = new DecimalFormat("0");
return new Literal(df.format(value),
datatype == null ? XSD_INTEGER : (String) datatype, null);
}
} else if (((Map<String, Object>) item).containsKey("@language")) {
return new Literal((String) value,
datatype == null ? RDF_LANGSTRING : (String) datatype,
(String) ((Map<String, Object>) item).get("@language"));
} else {
return new Literal((String) value,
datatype == null ? XSD_STRING : (String) datatype, null);
}
}
// convert string/node object to RDF
else {
final String id;
if (isObject(item)) {
id = (String) ((Map<String, Object>) item).get("@id");
if (JsonLdUtils.isRelativeIri(id)) {
return null;
}
} else {
id = (String) item;
}
if (id.indexOf("_:") == 0) {
// NOTE: once again no need to rename existing blank nodes
return new BlankNode(id);
} else {
return new IRI(id);
}
}
} | java | private Node objectToRDF(Object item) {
// convert value object to RDF
if (isValue(item)) {
final Object value = ((Map<String, Object>) item).get("@value");
final Object datatype = ((Map<String, Object>) item).get("@type");
// convert to XSD datatypes as appropriate
if (value instanceof Boolean || value instanceof Number) {
// convert to XSD datatype
if (value instanceof Boolean) {
return new Literal(value.toString(),
datatype == null ? XSD_BOOLEAN : (String) datatype, null);
} else if (value instanceof Double || value instanceof Float
|| XSD_DOUBLE.equals(datatype)) {
if (value instanceof Double && !Double.isFinite((double) value)) {
return new Literal(Double.toString((double) value),
datatype == null ? XSD_DOUBLE : (String) datatype, null);
} else if (value instanceof Float && !Float.isFinite((float) value)) {
return new Literal(Float.toString((float) value),
datatype == null ? XSD_DOUBLE : (String) datatype, null);
} else {
// canonical double representation
final DecimalFormat df = new DecimalFormat("0.0###############E0");
df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
return new Literal(df.format(value),
datatype == null ? XSD_DOUBLE : (String) datatype, null);
}
} else {
final DecimalFormat df = new DecimalFormat("0");
return new Literal(df.format(value),
datatype == null ? XSD_INTEGER : (String) datatype, null);
}
} else if (((Map<String, Object>) item).containsKey("@language")) {
return new Literal((String) value,
datatype == null ? RDF_LANGSTRING : (String) datatype,
(String) ((Map<String, Object>) item).get("@language"));
} else {
return new Literal((String) value,
datatype == null ? XSD_STRING : (String) datatype, null);
}
}
// convert string/node object to RDF
else {
final String id;
if (isObject(item)) {
id = (String) ((Map<String, Object>) item).get("@id");
if (JsonLdUtils.isRelativeIri(id)) {
return null;
}
} else {
id = (String) item;
}
if (id.indexOf("_:") == 0) {
// NOTE: once again no need to rename existing blank nodes
return new BlankNode(id);
} else {
return new IRI(id);
}
}
} | [
"private",
"Node",
"objectToRDF",
"(",
"Object",
"item",
")",
"{",
"// convert value object to RDF",
"if",
"(",
"isValue",
"(",
"item",
")",
")",
"{",
"final",
"Object",
"value",
"=",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"item",
")",
... | Converts a JSON-LD value object to an RDF literal or a JSON-LD string or
node object to an RDF resource.
@param item
the JSON-LD value or node object.
@return the RDF literal or RDF resource. | [
"Converts",
"a",
"JSON",
"-",
"LD",
"value",
"object",
"to",
"an",
"RDF",
"literal",
"or",
"a",
"JSON",
"-",
"LD",
"string",
"or",
"node",
"object",
"to",
"an",
"RDF",
"resource",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L647-L706 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/DocumentLoader.java | DocumentLoader.addInjectedDoc | public DocumentLoader addInjectedDoc(String url, String doc) throws JsonLdError {
try {
m_injectedDocs.put(url, JsonUtils.fromString(doc));
return this;
} catch (final Exception e) {
throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e);
}
} | java | public DocumentLoader addInjectedDoc(String url, String doc) throws JsonLdError {
try {
m_injectedDocs.put(url, JsonUtils.fromString(doc));
return this;
} catch (final Exception e) {
throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e);
}
} | [
"public",
"DocumentLoader",
"addInjectedDoc",
"(",
"String",
"url",
",",
"String",
"doc",
")",
"throws",
"JsonLdError",
"{",
"try",
"{",
"m_injectedDocs",
".",
"put",
"(",
"url",
",",
"JsonUtils",
".",
"fromString",
"(",
"doc",
")",
")",
";",
"return",
"th... | Avoid resolving a document by instead using the given serialised
representation.
@param url
The URL this document represents.
@param doc
The serialised document as a String
@return This object for fluent addition of other injected documents.
@throws JsonLdError
If loading of the document failed for any reason. | [
"Avoid",
"resolving",
"a",
"document",
"by",
"instead",
"using",
"the",
"given",
"serialised",
"representation",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/DocumentLoader.java#L37-L44 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/DocumentLoader.java | DocumentLoader.loadDocument | public RemoteDocument loadDocument(String url) throws JsonLdError {
if (m_injectedDocs.containsKey(url)) {
try {
return new RemoteDocument(url, m_injectedDocs.get(url));
} catch (final Exception e) {
throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e);
}
} else {
final String disallowRemote = System
.getProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING);
if ("true".equalsIgnoreCase(disallowRemote)) {
throw new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED,
"Remote context loading has been disallowed (url was " + url + ")");
}
try {
return new RemoteDocument(url, JsonUtils.fromURL(new URL(url), getHttpClient()));
} catch (final Exception e) {
throw new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED, url, e);
}
}
} | java | public RemoteDocument loadDocument(String url) throws JsonLdError {
if (m_injectedDocs.containsKey(url)) {
try {
return new RemoteDocument(url, m_injectedDocs.get(url));
} catch (final Exception e) {
throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e);
}
} else {
final String disallowRemote = System
.getProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING);
if ("true".equalsIgnoreCase(disallowRemote)) {
throw new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED,
"Remote context loading has been disallowed (url was " + url + ")");
}
try {
return new RemoteDocument(url, JsonUtils.fromURL(new URL(url), getHttpClient()));
} catch (final Exception e) {
throw new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED, url, e);
}
}
} | [
"public",
"RemoteDocument",
"loadDocument",
"(",
"String",
"url",
")",
"throws",
"JsonLdError",
"{",
"if",
"(",
"m_injectedDocs",
".",
"containsKey",
"(",
"url",
")",
")",
"{",
"try",
"{",
"return",
"new",
"RemoteDocument",
"(",
"url",
",",
"m_injectedDocs",
... | Loads the URL if possible, returning it as a RemoteDocument.
@param url
The URL to load
@return The resolved URL as a RemoteDocument
@throws JsonLdError
If there are errors loading or remote context loading has
been disallowed. | [
"Loads",
"the",
"URL",
"if",
"possible",
"returning",
"it",
"as",
"a",
"RemoteDocument",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/DocumentLoader.java#L56-L77 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java | JsonUtils.toPrettyString | public static String toPrettyString(Object jsonObject)
throws JsonGenerationException, IOException {
final StringWriter sw = new StringWriter();
writePrettyPrint(sw, jsonObject);
return sw.toString();
} | java | public static String toPrettyString(Object jsonObject)
throws JsonGenerationException, IOException {
final StringWriter sw = new StringWriter();
writePrettyPrint(sw, jsonObject);
return sw.toString();
} | [
"public",
"static",
"String",
"toPrettyString",
"(",
"Object",
"jsonObject",
")",
"throws",
"JsonGenerationException",
",",
"IOException",
"{",
"final",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"writePrettyPrint",
"(",
"sw",
",",
"jsonObjec... | Writes the given JSON-LD Object out to a String, using indentation and
new lines to improve readability.
@param jsonObject
The JSON-LD Object to serialize.
@return A JSON document serialised to a String.
@throws JsonGenerationException
If there is a JSON error during serialization.
@throws IOException
If there is an IO error during serialization. | [
"Writes",
"the",
"given",
"JSON",
"-",
"LD",
"Object",
"out",
"to",
"a",
"String",
"using",
"indentation",
"and",
"new",
"lines",
"to",
"improve",
"readability",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L256-L261 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java | JsonUtils.write | public static void write(Writer writer, Object jsonObject)
throws JsonGenerationException, IOException {
final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
jw.writeObject(jsonObject);
} | java | public static void write(Writer writer, Object jsonObject)
throws JsonGenerationException, IOException {
final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
jw.writeObject(jsonObject);
} | [
"public",
"static",
"void",
"write",
"(",
"Writer",
"writer",
",",
"Object",
"jsonObject",
")",
"throws",
"JsonGenerationException",
",",
"IOException",
"{",
"final",
"JsonGenerator",
"jw",
"=",
"JSON_FACTORY",
".",
"createGenerator",
"(",
"writer",
")",
";",
"j... | Writes the given JSON-LD Object out to the given Writer.
@param writer
The writer that is to receive the serialized JSON-LD object.
@param jsonObject
The JSON-LD Object to serialize.
@throws JsonGenerationException
If there is a JSON error during serialization.
@throws IOException
If there is an IO error during serialization. | [
"Writes",
"the",
"given",
"JSON",
"-",
"LD",
"Object",
"out",
"to",
"the",
"given",
"Writer",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L292-L296 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java | JsonUtils.writePrettyPrint | public static void writePrettyPrint(Writer writer, Object jsonObject)
throws JsonGenerationException, IOException {
final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
jw.useDefaultPrettyPrinter();
jw.writeObject(jsonObject);
} | java | public static void writePrettyPrint(Writer writer, Object jsonObject)
throws JsonGenerationException, IOException {
final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
jw.useDefaultPrettyPrinter();
jw.writeObject(jsonObject);
} | [
"public",
"static",
"void",
"writePrettyPrint",
"(",
"Writer",
"writer",
",",
"Object",
"jsonObject",
")",
"throws",
"JsonGenerationException",
",",
"IOException",
"{",
"final",
"JsonGenerator",
"jw",
"=",
"JSON_FACTORY",
".",
"createGenerator",
"(",
"writer",
")",
... | Writes the given JSON-LD Object out to the given Writer, using
indentation and new lines to improve readability.
@param writer
The writer that is to receive the serialized JSON-LD object.
@param jsonObject
The JSON-LD Object to serialize.
@throws JsonGenerationException
If there is a JSON error during serialization.
@throws IOException
If there is an IO error during serialization. | [
"Writes",
"the",
"given",
"JSON",
"-",
"LD",
"Object",
"out",
"to",
"the",
"given",
"Writer",
"using",
"indentation",
"and",
"new",
"lines",
"to",
"improve",
"readability",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L311-L316 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/Obj.java | Obj.newMap | public static Map<String, Object> newMap(String key, Object value) {
final Map<String, Object> result = newMap();
result.put(key, value);
return result;
} | java | public static Map<String, Object> newMap(String key, Object value) {
final Map<String, Object> result = newMap();
result.put(key, value);
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"newMap",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"newMap",
"(",
")",
";",
"result",
".",
"put",
"(",
"k... | Helper function for creating maps and tuning them as necessary.
@param key
A key to add to the map on creation.
@param value
A value to attach to the key in the new map.
@return A new {@link Map} instance. | [
"Helper",
"function",
"for",
"creating",
"maps",
"and",
"tuning",
"them",
"as",
"necessary",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/Obj.java#L26-L30 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java | JsonLdProcessor.fromRDF | public static Object fromRDF(Object dataset, JsonLdOptions options) throws JsonLdError {
// handle non specified serializer case
RDFParser parser = null;
if (options.format == null && dataset instanceof String) {
// attempt to parse the input as nquads
options.format = JsonLdConsts.APPLICATION_NQUADS;
}
if (rdfParsers.containsKey(options.format)) {
parser = rdfParsers.get(options.format);
} else {
throw new JsonLdError(JsonLdError.Error.UNKNOWN_FORMAT, options.format);
}
// convert from RDF
return fromRDF(dataset, options, parser);
} | java | public static Object fromRDF(Object dataset, JsonLdOptions options) throws JsonLdError {
// handle non specified serializer case
RDFParser parser = null;
if (options.format == null && dataset instanceof String) {
// attempt to parse the input as nquads
options.format = JsonLdConsts.APPLICATION_NQUADS;
}
if (rdfParsers.containsKey(options.format)) {
parser = rdfParsers.get(options.format);
} else {
throw new JsonLdError(JsonLdError.Error.UNKNOWN_FORMAT, options.format);
}
// convert from RDF
return fromRDF(dataset, options, parser);
} | [
"public",
"static",
"Object",
"fromRDF",
"(",
"Object",
"dataset",
",",
"JsonLdOptions",
"options",
")",
"throws",
"JsonLdError",
"{",
"// handle non specified serializer case",
"RDFParser",
"parser",
"=",
"null",
";",
"if",
"(",
"options",
".",
"format",
"==",
"n... | Converts an RDF dataset to JSON-LD.
@param dataset
a serialized string of RDF in a format specified by the format
option or an RDF dataset to convert.
@param options
the options to use: [format] the format if input is not an
array: 'application/nquads' for N-Quads (default).
[useRdfType] true to use rdf:type, false to use @type
(default: false). [useNativeTypes] true to convert XSD types
into native types (boolean, integer, double), false not to
(default: true).
@return A JSON-LD object.
@throws JsonLdError
If there is an error converting the dataset to JSON-LD. | [
"Converts",
"an",
"RDF",
"dataset",
"to",
"JSON",
"-",
"LD",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java#L384-L402 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java | JsonLdProcessor.normalize | public static Object normalize(Object input, JsonLdOptions options) throws JsonLdError {
final JsonLdOptions opts = options.copy();
opts.format = null;
final RDFDataset dataset = (RDFDataset) toRDF(input, opts);
return new JsonLdApi(options).normalize(dataset);
} | java | public static Object normalize(Object input, JsonLdOptions options) throws JsonLdError {
final JsonLdOptions opts = options.copy();
opts.format = null;
final RDFDataset dataset = (RDFDataset) toRDF(input, opts);
return new JsonLdApi(options).normalize(dataset);
} | [
"public",
"static",
"Object",
"normalize",
"(",
"Object",
"input",
",",
"JsonLdOptions",
"options",
")",
"throws",
"JsonLdError",
"{",
"final",
"JsonLdOptions",
"opts",
"=",
"options",
".",
"copy",
"(",
")",
";",
"opts",
".",
"format",
"=",
"null",
";",
"f... | Performs RDF dataset normalization on the given JSON-LD input. The output
is an RDF dataset unless the 'format' option is used.
@param input
the JSON-LD input to normalize.
@param options
the options to use: [base] the base IRI to use. [format] the
format if output is a string: 'application/nquads' for
N-Quads. [loadContext(url, callback(err, url, result))] the
context loader.
@return The JSON-LD object
@throws JsonLdError
If there is an error normalizing the dataset. | [
"Performs",
"RDF",
"dataset",
"normalization",
"on",
"the",
"given",
"JSON",
"-",
"LD",
"input",
".",
"The",
"output",
"is",
"an",
"RDF",
"dataset",
"unless",
"the",
"format",
"option",
"is",
"used",
"."
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java#L604-L611 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/Context.java | Context.compactValue | public Object compactValue(String activeProperty, Map<String, Object> value) {
// 1)
int numberMembers = value.size();
// 2)
if (value.containsKey(JsonLdConsts.INDEX)
&& JsonLdConsts.INDEX.equals(this.getContainer(activeProperty))) {
numberMembers--;
}
// 3)
if (numberMembers > 2) {
return value;
}
// 4)
final String typeMapping = getTypeMapping(activeProperty);
final String languageMapping = getLanguageMapping(activeProperty);
if (value.containsKey(JsonLdConsts.ID)) {
// 4.1)
if (numberMembers == 1 && JsonLdConsts.ID.equals(typeMapping)) {
return compactIri((String) value.get(JsonLdConsts.ID));
}
// 4.2)
if (numberMembers == 1 && JsonLdConsts.VOCAB.equals(typeMapping)) {
return compactIri((String) value.get(JsonLdConsts.ID), true);
}
// 4.3)
return value;
}
final Object valueValue = value.get(JsonLdConsts.VALUE);
// 5)
if (value.containsKey(JsonLdConsts.TYPE)
&& Obj.equals(value.get(JsonLdConsts.TYPE), typeMapping)) {
return valueValue;
}
// 6)
if (value.containsKey(JsonLdConsts.LANGUAGE)) {
// TODO: SPEC: doesn't specify to check default language as well
if (Obj.equals(value.get(JsonLdConsts.LANGUAGE), languageMapping) || Obj
.equals(value.get(JsonLdConsts.LANGUAGE), this.get(JsonLdConsts.LANGUAGE))) {
return valueValue;
}
}
// 7)
if (numberMembers == 1 && (!(valueValue instanceof String)
|| !this.containsKey(JsonLdConsts.LANGUAGE)
|| (termDefinitions.containsKey(activeProperty)
&& getTermDefinition(activeProperty).containsKey(JsonLdConsts.LANGUAGE)
&& languageMapping == null))) {
return valueValue;
}
// 8)
return value;
} | java | public Object compactValue(String activeProperty, Map<String, Object> value) {
// 1)
int numberMembers = value.size();
// 2)
if (value.containsKey(JsonLdConsts.INDEX)
&& JsonLdConsts.INDEX.equals(this.getContainer(activeProperty))) {
numberMembers--;
}
// 3)
if (numberMembers > 2) {
return value;
}
// 4)
final String typeMapping = getTypeMapping(activeProperty);
final String languageMapping = getLanguageMapping(activeProperty);
if (value.containsKey(JsonLdConsts.ID)) {
// 4.1)
if (numberMembers == 1 && JsonLdConsts.ID.equals(typeMapping)) {
return compactIri((String) value.get(JsonLdConsts.ID));
}
// 4.2)
if (numberMembers == 1 && JsonLdConsts.VOCAB.equals(typeMapping)) {
return compactIri((String) value.get(JsonLdConsts.ID), true);
}
// 4.3)
return value;
}
final Object valueValue = value.get(JsonLdConsts.VALUE);
// 5)
if (value.containsKey(JsonLdConsts.TYPE)
&& Obj.equals(value.get(JsonLdConsts.TYPE), typeMapping)) {
return valueValue;
}
// 6)
if (value.containsKey(JsonLdConsts.LANGUAGE)) {
// TODO: SPEC: doesn't specify to check default language as well
if (Obj.equals(value.get(JsonLdConsts.LANGUAGE), languageMapping) || Obj
.equals(value.get(JsonLdConsts.LANGUAGE), this.get(JsonLdConsts.LANGUAGE))) {
return valueValue;
}
}
// 7)
if (numberMembers == 1 && (!(valueValue instanceof String)
|| !this.containsKey(JsonLdConsts.LANGUAGE)
|| (termDefinitions.containsKey(activeProperty)
&& getTermDefinition(activeProperty).containsKey(JsonLdConsts.LANGUAGE)
&& languageMapping == null))) {
return valueValue;
}
// 8)
return value;
} | [
"public",
"Object",
"compactValue",
"(",
"String",
"activeProperty",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"value",
")",
"{",
"// 1)",
"int",
"numberMembers",
"=",
"value",
".",
"size",
"(",
")",
";",
"// 2)",
"if",
"(",
"value",
".",
"containsK... | Value Compaction Algorithm
http://json-ld.org/spec/latest/json-ld-api/#value-compaction
@param activeProperty
The Active Property
@param value
The value to compact
@return The compacted value | [
"Value",
"Compaction",
"Algorithm"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/Context.java#L78-L129 | train |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/Context.java | Context.parse | @SuppressWarnings("unchecked")
public Context parse(Object localContext, List<String> remoteContexts) throws JsonLdError {
return parse(localContext, remoteContexts, false);
} | java | @SuppressWarnings("unchecked")
public Context parse(Object localContext, List<String> remoteContexts) throws JsonLdError {
return parse(localContext, remoteContexts, false);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Context",
"parse",
"(",
"Object",
"localContext",
",",
"List",
"<",
"String",
">",
"remoteContexts",
")",
"throws",
"JsonLdError",
"{",
"return",
"parse",
"(",
"localContext",
",",
"remoteContexts",
... | Context Processing Algorithm
http://json-ld.org/spec/latest/json-ld-api/#context-processing-algorithms
@param localContext
The Local Context object.
@param remoteContexts
The list of Strings denoting the remote Context URLs.
@return The parsed and merged Context.
@throws JsonLdError
If there is an error parsing the contexts. | [
"Context",
"Processing",
"Algorithm"
] | efeef6ee96029a0011649633457035fa6be42da1 | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/Context.java#L144-L147 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.