Skip to content

[Discovery] Add newest generated code and update tests #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,6 @@ public class Discovery extends WatsonService {

private String versionDate;

/** The Constant VERSION_DATE_2017_11_07. */
public static final String VERSION_DATE_2017_11_07 = "2017-11-07";
/** The Constant VERSION_DATE_2017_09_01. */
public static final String VERSION_DATE_2017_09_01 = "2017-09-01";
/** The Constant VERSION_DATE_2017_08_01. */
public static final String VERSION_DATE_2017_08_01 = "2017-08-01";
/** The Constant VERSION_DATE_2017_07_19. */
public static final String VERSION_DATE_2017_07_19 = "2017-07-19";
/** The Constant VERSION_DATE_2017_06_25. */
public static final String VERSION_DATE_2017_06_25 = "2017-06-25";
/** The Constant VERSION_DATE_2016_12_01. */
public static final String VERSION_DATE_2016_12_01 = "2016-12-01";

/**
* Instantiates a new `Discovery`.
*
Expand All @@ -124,8 +111,7 @@ public Discovery(String versionDate) {
setEndPoint(URL);
}

Validator.isTrue((versionDate != null) && !versionDate.isEmpty(),
"'version cannot be null. Use " + VERSION_DATE_2017_11_07);
Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null.");

this.versionDate = versionDate;
}
Expand Down Expand Up @@ -227,9 +213,9 @@ public ServiceCall<ListEnvironmentsResponse> listEnvironments() {
}

/**
* List fields in specified collecitons.
* List fields in specified collections.
*
* Gets a list of the unique fields (and their types) stored in the indexes of the specified collecitons.
* Gets a list of the unique fields (and their types) stored in the indexes of the specified collections.
*
* @param listFieldsOptions the {@link ListFieldsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link ListCollectionFieldsResponse}
Expand Down Expand Up @@ -763,6 +749,15 @@ public ServiceCall<QueryResponse> federatedQuery(FederatedQueryOptions federated
if (federatedQueryOptions.deduplicateField() != null) {
builder.query("deduplicate.field", federatedQueryOptions.deduplicateField());
}
if (federatedQueryOptions.similar() != null) {
builder.query("similar", String.valueOf(federatedQueryOptions.similar()));
}
if (federatedQueryOptions.similarDocumentIds() != null) {
builder.query("similar.document_ids", RequestUtils.join(federatedQueryOptions.similarDocumentIds(), ","));
}
if (federatedQueryOptions.similarFields() != null) {
builder.query("similar.fields", RequestUtils.join(federatedQueryOptions.similarFields(), ","));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryResponse.class));
}

Expand Down Expand Up @@ -814,6 +809,15 @@ public ServiceCall<QueryNoticesResponse> federatedQueryNotices(
if (federatedQueryNoticesOptions.deduplicateField() != null) {
builder.query("deduplicate.field", federatedQueryNoticesOptions.deduplicateField());
}
if (federatedQueryNoticesOptions.similar() != null) {
builder.query("similar", String.valueOf(federatedQueryNoticesOptions.similar()));
}
if (federatedQueryNoticesOptions.similarDocumentIds() != null) {
builder.query("similar.document_ids", RequestUtils.join(federatedQueryNoticesOptions.similarDocumentIds(), ","));
}
if (federatedQueryNoticesOptions.similarFields() != null) {
builder.query("similar.fields", RequestUtils.join(federatedQueryNoticesOptions.similarFields(), ","));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryNoticesResponse.class));
}

Expand Down Expand Up @@ -876,6 +880,15 @@ public ServiceCall<QueryResponse> query(QueryOptions queryOptions) {
if (queryOptions.deduplicateField() != null) {
builder.query("deduplicate.field", queryOptions.deduplicateField());
}
if (queryOptions.similar() != null) {
builder.query("similar", String.valueOf(queryOptions.similar()));
}
if (queryOptions.similarDocumentIds() != null) {
builder.query("similar.document_ids", RequestUtils.join(queryOptions.similarDocumentIds(), ","));
}
if (queryOptions.similarFields() != null) {
builder.query("similar.fields", RequestUtils.join(queryOptions.similarFields(), ","));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryResponse.class));
}

Expand Down Expand Up @@ -968,6 +981,15 @@ public ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryN
if (queryNoticesOptions.deduplicateField() != null) {
builder.query("deduplicate.field", queryNoticesOptions.deduplicateField());
}
if (queryNoticesOptions.similar() != null) {
builder.query("similar", String.valueOf(queryNoticesOptions.similar()));
}
if (queryNoticesOptions.similarDocumentIds() != null) {
builder.query("similar.document_ids", RequestUtils.join(queryNoticesOptions.similarDocumentIds(), ","));
}
if (queryNoticesOptions.similarFields() != null) {
builder.query("similar.fields", RequestUtils.join(queryNoticesOptions.similarFields(), ","));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryNoticesResponse.class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,4 @@ public Long getMatchingResults() {
public List<QueryAggregation> getAggregations() {
return aggregations;
}

/**
* Sets the key.
*
* @param key the new key
*/
public void setKey(final String key) {
this.key = key;
}

/**
* Sets the matchingResults.
*
* @param matchingResults the new matchingResults
*/
public void setMatchingResults(final long matchingResults) {
this.matchingResults = matchingResults;
}

/**
* Sets the aggregations.
*
* @param aggregations the new aggregations
*/
public void setAggregations(final List<QueryAggregation> aggregations) {
this.aggregations = aggregations;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,67 +174,4 @@ public CollectionDiskUsage getDiskUsage() {
public TrainingStatus getTrainingStatus() {
return trainingStatus;
}

/**
* Sets the name.
*
* @param name the new name
*/
public void setName(final String name) {
this.name = name;
}

/**
* Sets the description.
*
* @param description the new description
*/
public void setDescription(final String description) {
this.description = description;
}

/**
* Sets the configurationId.
*
* @param configurationId the new configurationId
*/
public void setConfigurationId(final String configurationId) {
this.configurationId = configurationId;
}

/**
* Sets the language.
*
* @param language the new language
*/
public void setLanguage(final String language) {
this.language = language;
}

/**
* Sets the documentCounts.
*
* @param documentCounts the new documentCounts
*/
public void setDocumentCounts(final DocumentCounts documentCounts) {
this.documentCounts = documentCounts;
}

/**
* Sets the diskUsage.
*
* @param diskUsage the new diskUsage
*/
public void setDiskUsage(final CollectionDiskUsage diskUsage) {
this.diskUsage = diskUsage;
}

/**
* Sets the trainingStatus.
*
* @param trainingStatus the new trainingStatus
*/
public void setTrainingStatus(final TrainingStatus trainingStatus) {
this.trainingStatus = trainingStatus;
}
}

This file was deleted.

Loading