本文整理了Java中com.ibm.watson.developer_cloud.http.RequestBuilder.constructHttpUrl
方法的一些代码示例,展示了RequestBuilder.constructHttpUrl
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestBuilder.constructHttpUrl
方法的具体详情如下:
包路径:com.ibm.watson.developer_cloud.http.RequestBuilder
类名称:RequestBuilder
方法名:constructHttpUrl
[英]Creates a properly encoded HttpUrl object with no path parameters.
[中]创建没有路径参数的正确编码的HttpUrl对象。
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* List classifiers.
*
* Returns an empty array if no classifiers are available.
*
* @param listClassifiersOptions the {@link ListClassifiersOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link ClassifierList}
*/
public ServiceCall<ClassifierList> listClassifiers(ListClassifiersOptions listClassifiersOptions) {
String[] pathSegments = { "v1/classifiers" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (listClassifiersOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ClassifierList.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* List voices.
*
* Lists all voices available for use with the service. The information includes the name, language, gender, and other
* details about the voice. To see information about a specific voice, use the **Get a voice** method.
*
* **See also:** [Specifying a voice](https://cloud.ibm.com/docs/services/text-to-speech/http.html#voices).
*
* @param listVoicesOptions the {@link ListVoicesOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Voices}
*/
public ServiceCall<Voices> listVoices(ListVoicesOptions listVoicesOptions) {
String[] pathSegments = { "v1/voices" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (listVoicesOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Voices.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Gets the list of submitted batch-processing jobs.
*
* Gets the list of batch-processing jobs submitted by users.
*
* @param listBatchesOptions the {@link ListBatchesOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Batches}
*/
public ServiceCall<Batches> listBatches(ListBatchesOptions listBatchesOptions) {
String[] pathSegments = { "v1/batches" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query(VERSION, versionDate);
if (listBatchesOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Batches.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete classifier.
*
* @param deleteClassifierOptions the {@link DeleteClassifierOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteClassifier(DeleteClassifierOptions deleteClassifierOptions) {
Validator.notNull(deleteClassifierOptions, "deleteClassifierOptions cannot be null");
String[] pathSegments = { "v1/classifiers" };
String[] pathParameters = { deleteClassifierOptions.classifierId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Get information about a classifier.
*
* Returns status and other information about a classifier.
*
* @param getClassifierOptions the {@link GetClassifierOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Classifier}
*/
public ServiceCall<Classifier> getClassifier(GetClassifierOptions getClassifierOptions) {
Validator.notNull(getClassifierOptions, "getClassifierOptions cannot be null");
String[] pathSegments = { "v1/classifiers" };
String[] pathParameters = { getClassifierOptions.classifierId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Classifier.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete environment.
*
* @param deleteEnvironmentOptions the {@link DeleteEnvironmentOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteEnvironment(DeleteEnvironmentOptions deleteEnvironmentOptions) {
Validator.notNull(deleteEnvironmentOptions, "deleteEnvironmentOptions cannot be null");
String[] pathSegments = { "v1/environments" };
String[] pathParameters = { deleteEnvironmentOptions.environmentId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete a classifier.
*
* @param deleteClassifierOptions the {@link DeleteClassifierOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteClassifier(DeleteClassifierOptions deleteClassifierOptions) {
Validator.notNull(deleteClassifierOptions, "deleteClassifierOptions cannot be null");
String[] pathSegments = { "v3/classifiers" };
String[] pathParameters = { deleteClassifierOptions.classifierId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Get environment info.
*
* @param getEnvironmentOptions the {@link GetEnvironmentOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Environment}
*/
public ServiceCall<Environment> getEnvironment(GetEnvironmentOptions getEnvironmentOptions) {
Validator.notNull(getEnvironmentOptions, "getEnvironmentOptions cannot be null");
String[] pathSegments = { "v1/environments" };
String[] pathParameters = { getEnvironmentOptions.environmentId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Environment.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete model.
*
* Deletes a custom model.
*
* @param deleteModelOptions the {@link DeleteModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteModel(DeleteModelOptions deleteModelOptions) {
Validator.notNull(deleteModelOptions, "deleteModelOptions cannot be null");
String[] pathSegments = { "v1/models" };
String[] pathParameters = { deleteModelOptions.modelId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Gets information about a specific batch-processing request.
*
* Gets information about a batch-processing request with a specified ID.
*
* @param getBatchOptions the {@link GetBatchOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link BatchStatus}
*/
public ServiceCall<BatchStatus> getBatch(GetBatchOptions getBatchOptions) {
Validator.notNull(getBatchOptions, "getBatchOptions cannot be null");
String[] pathSegments = { "v1/batches" };
String[] pathParameters = { getBatchOptions.batchId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(BatchStatus.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* 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}
*/
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);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(GatewayList.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Retrieve classifier details.
*
* Retrieve information about a custom classifier.
*
* @param getClassifierOptions the {@link GetClassifierOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Classifier}
*/
public ServiceCall<Classifier> getClassifier(GetClassifierOptions getClassifierOptions) {
Validator.notNull(getClassifierOptions, "getClassifierOptions cannot be null");
String[] pathSegments = { "v3/classifiers" };
String[] pathParameters = { getClassifierOptions.classifierId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Classifier.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Get collection details.
*
* @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Collection}
*/
public ServiceCall<Collection> getCollection(GetCollectionOptions getCollectionOptions) {
Validator.notNull(getCollectionOptions, "getCollectionOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections" };
String[] pathParameters = { getCollectionOptions.environmentId(), getCollectionOptions.collectionId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Collection.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Get configuration details.
*
* @param getConfigurationOptions the {@link GetConfigurationOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Configuration}
*/
public ServiceCall<Configuration> getConfiguration(GetConfigurationOptions getConfigurationOptions) {
Validator.notNull(getConfigurationOptions, "getConfigurationOptions cannot be null");
String[] pathSegments = { "v1/environments", "configurations" };
String[] pathParameters = { getConfigurationOptions.environmentId(), getConfigurationOptions.configurationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Configuration.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete a collection.
*
* @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteCollection(DeleteCollectionOptions deleteCollectionOptions) {
Validator.notNull(deleteCollectionOptions, "deleteCollectionOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections" };
String[] pathParameters = { deleteCollectionOptions.environmentId(), deleteCollectionOptions.collectionId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete Gateway.
*
* Delete the specified gateway configuration.
*
* @param deleteGatewayOptions the {@link DeleteGatewayOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteGateway(DeleteGatewayOptions deleteGatewayOptions) {
Validator.notNull(deleteGatewayOptions, "deleteGatewayOptions cannot be null");
String[] pathSegments = { "v1/environments", "gateways" };
String[] pathParameters = { deleteGatewayOptions.environmentId(), deleteGatewayOptions.gatewayId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Identify language.
*
* Identifies the language of the input text.
*
* @param identifyOptions the {@link IdentifyOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link IdentifiedLanguages}
*/
public ServiceCall<IdentifiedLanguages> identify(IdentifyOptions identifyOptions) {
Validator.notNull(identifyOptions, "identifyOptions cannot be null");
String[] pathSegments = { "v3/identify" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query(VERSION, versionDate);
builder.bodyContent(identifyOptions.text(), "text/plain");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(IdentifiedLanguages.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* Delete session.
*
* Deletes a session explicitly before it times out.
*
* @param deleteSessionOptions the {@link DeleteSessionOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteSession(DeleteSessionOptions deleteSessionOptions) {
Validator.notNull(deleteSessionOptions, "deleteSessionOptions cannot be null");
String[] pathSegments = { "v2/assistants", "sessions" };
String[] pathParameters = { deleteSessionOptions.assistantId(), deleteSessionOptions.sessionId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* 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}
*/
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);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingDataSet.class));
}
代码示例来源:origin: watson-developer-cloud/java-sdk
/**
* 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}
*/
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);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class));
}
内容来源于网络,如有侵权,请联系作者删除!