-
Notifications
You must be signed in to change notification settings - Fork 528
Discovery #505
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
Discovery #505
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3bd7575
Welcome to Discovery 1.0
maniax89 e92d6a7
Add Discovery IT Tests
maniax89 796ceb3
Add Environment Sizes for Discovery
maniax89 e11b78c
Remove @author
maniax89 e21bfa7
Fix versions in README
maniax89 0b2687c
Added descriptions for classes + removed extra ones
maniax89 418cc9f
Fix copyrights
maniax89 da41339
Make status enums
maniax89 e80fdc4
Rename QueryAggregation and fixup documentation
maniax89 c1168e0
Make environment sizes more generic
maniax89 e2e04ca
available_with_notices -> available with notices
maniax89 585f913
Fix checkstyle messages
maniax89 cdaf273
Add tests for Discovery
maniax89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Discovery | ||
|
|
||
| ## Installation | ||
|
|
||
| ##### Maven | ||
| ```xml | ||
| <dependency> | ||
| <groupId>com.ibm.watson.developer_cloud</groupId> | ||
| <artifactId>discovery</artifactId> | ||
| <version>3.5.3</version> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| ##### Gradle | ||
| ```gradle | ||
| 'com.ibm.watson.developer_cloud:discovery:3.5.3' | ||
| ``` | ||
|
|
||
| ## Usage | ||
| The [Discovery][discovery] wraps the environment, collection, configuration, document, and query operations of the Discovery service. | ||
|
|
||
| ```java | ||
| Discovery service = new Discovery("2016-12-15"); | ||
| service.setEndpoint("https://gateway.watsonplatform.net/discovery/api/"); | ||
| service.setUsernameAndPassword("<username>", "<password>"); | ||
|
|
||
| //TODO add service | ||
| ``` | ||
|
|
||
| [discovery]: http://www.ibm.com/watson/developercloud/doc/discovery/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <parent> | ||
| <artifactId>parent</artifactId> | ||
| <groupId>com.ibm.watson.developer_cloud</groupId> | ||
| <version>3.5.3-SNAPSHOT</version> | ||
| </parent> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <artifactId>discovery</artifactId> | ||
| <name>Discovery</name> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>core</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
435 changes: 435 additions & 0 deletions
435
discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java
Large diffs are not rendered by default.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
...rc/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/collection/Collection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * Copyright 2016 IBM Corp. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package com.ibm.watson.developer_cloud.discovery.v1.model.collection; | ||
|
|
||
| import com.google.gson.annotations.SerializedName; | ||
| import com.ibm.watson.developer_cloud.discovery.v1.model.common.Status; | ||
| import com.ibm.watson.developer_cloud.service.model.GenericModel; | ||
|
|
||
| import java.util.Date; | ||
|
|
||
| /** | ||
| * A Collection holds the documents that have been ingested and allows querying against it. | ||
| */ | ||
| public class Collection extends GenericModel { | ||
| @SerializedName(CollectionManager.ID) | ||
| private String collectionId; | ||
| @SerializedName(CollectionManager.NAME) | ||
| private String name; | ||
| @SerializedName(CollectionManager.STATUS) | ||
| private Status status; | ||
| @SerializedName(CollectionManager.CREATED) | ||
| private Date created; | ||
| @SerializedName(CollectionManager.UPDATED) | ||
| private Date updated; | ||
| @SerializedName(CollectionManager.DESCRIPTION) | ||
| private String description; | ||
| @SerializedName(CollectionManager.CONFIGURATION_ID) | ||
| private String configurationId; | ||
| @SerializedName(CollectionManager.LANGUAGE) | ||
| private String language; | ||
| @SerializedName(CollectionManager.DOCUMENT_COUNTS) | ||
| private DocumentCounts documentCounts; | ||
|
|
||
| public String getCollectionId() { | ||
| return collectionId; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public Status getStatus() { | ||
| return status; | ||
| } | ||
|
|
||
| public Date getCreated() { | ||
| return created; | ||
| } | ||
|
|
||
| public Date getUpdated() { | ||
| return updated; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public String getConfigurationId() { | ||
| return configurationId; | ||
| } | ||
|
|
||
| public String getLanguage() { | ||
| return language; | ||
| } | ||
|
|
||
| public DocumentCounts getDocumentCounts() { | ||
| return documentCounts; | ||
| } | ||
| } |
89 changes: 89 additions & 0 deletions
89
.../java/com/ibm/watson/developer_cloud/discovery/v1/model/collection/CollectionManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright 2016 IBM Corp. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package com.ibm.watson.developer_cloud.discovery.v1.model.collection; | ||
|
|
||
| import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.GetCollectionFieldsRequest; | ||
| import com.ibm.watson.developer_cloud.http.ServiceCall; | ||
| import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.GetCollectionFieldsResponse; | ||
| import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.Field; | ||
|
|
||
| /** | ||
| * Interface defining the constants and methods associated with Collections. | ||
| * | ||
| * @see Collection | ||
| */ | ||
| public interface CollectionManager { | ||
| String COLLECTIONS = "collections"; | ||
|
|
||
| //Collection | ||
| String ID = "collection_id"; | ||
| String NAME = "name"; | ||
| String DESCRIPTION = "description"; | ||
| String CREATED = "created"; | ||
| String UPDATED = "update"; | ||
| String STATUS = "status"; | ||
| String CONFIGURATION_ID = "configuration_id"; | ||
| String LANGUAGE = "language"; | ||
| String DOCUMENT_COUNTS = "document_counts"; | ||
|
|
||
| //Document Counts | ||
| String AVAILABLE = "available"; | ||
| String PROCESSING = "processing"; | ||
| String FAILED = "failed"; | ||
|
|
||
| //Fields | ||
| String FIELDS = "fields"; | ||
| String FIELD = "field"; | ||
| String TYPE = "type"; | ||
|
|
||
| /** | ||
| * Gets a list of {@link Collection}. An optional parameter of name can be provided to filter by name. | ||
| * | ||
| * @param getRequest options for getting the {@link Collection}s | ||
| * @return a {@link GetCollectionsResponse} containing the result of {@link GetCollectionsRequest} | ||
| */ | ||
| ServiceCall<GetCollectionsResponse> getCollections(GetCollectionsRequest getRequest); | ||
|
|
||
| /** | ||
| * Gets a {@link Collection}. | ||
| * | ||
| * @param getRequest options for getting the {@link Collection} | ||
| * @return a {@link GetCollectionResponse} containing the result of {@link GetCollectionRequest} | ||
| */ | ||
| ServiceCall<GetCollectionResponse> getCollection(GetCollectionRequest getRequest); | ||
|
|
||
| /** | ||
| * Creates a {@link Collection}. | ||
| * | ||
| * @param createRequest options for creating a {@link Collection} | ||
| * @return a {@link CreateCollectionResponse} containing the result of {@link CreateCollectionRequest} | ||
| */ | ||
| ServiceCall<CreateCollectionResponse> createCollection(CreateCollectionRequest createRequest); | ||
|
|
||
| /** | ||
| * Deletes a {@link Collection}. | ||
| * | ||
| * @param deleteRequest options for deleting a {@link Collection} | ||
| * @return a {@link DeleteCollectionResponse} containing the result of {@link DeleteCollectionRequest} | ||
| */ | ||
| ServiceCall<DeleteCollectionResponse> deleteCollection(DeleteCollectionRequest deleteRequest); | ||
|
|
||
| /** | ||
| * Gets a list of unique {@link Field}s from a {@link Collection}. | ||
| * | ||
| * @param getRequest options for getting a unique fields from a {@link Collection} | ||
| * @return a {@link GetCollectionFieldsResponse} containing the result of {@link GetCollectionFieldsRequest} | ||
| */ | ||
| ServiceCall<GetCollectionFieldsResponse> getCollectionFields(GetCollectionFieldsRequest getRequest); | ||
| } |
83 changes: 83 additions & 0 deletions
83
...com/ibm/watson/developer_cloud/discovery/v1/model/collection/CreateCollectionRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /* | ||
| * Copyright 2016 IBM Corp. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package com.ibm.watson.developer_cloud.discovery.v1.model.collection; | ||
|
|
||
| import com.ibm.watson.developer_cloud.service.model.GenericModel; | ||
|
|
||
| /** | ||
| * Request to create a {@link Collection}. | ||
| */ | ||
| public class CreateCollectionRequest extends GenericModel { | ||
| private final String environmentId; | ||
| private final String name; | ||
| private final String description; | ||
| private final String configurationId; | ||
| private final String language; | ||
|
|
||
| private CreateCollectionRequest(Builder builder) { | ||
| this.environmentId = builder.environmentId; | ||
| this.name = builder.name; | ||
| this.description = builder.description; | ||
| this.configurationId = builder.configurationId; | ||
| this.language = builder.language; | ||
| } | ||
|
|
||
| public String getEnvironmentId() { | ||
| return environmentId; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public String getConfigurationId() { | ||
| return configurationId; | ||
| } | ||
|
|
||
| public String getLanguage() { | ||
| return language; | ||
| } | ||
|
|
||
| public static class Builder { | ||
| private final String environmentId; | ||
| private final String name; | ||
| private final String configurationId; | ||
| private String description; | ||
| private String language; | ||
|
|
||
| public Builder(String environmentId, String configurationId, String name) { | ||
| this.environmentId = environmentId; | ||
| this.configurationId = configurationId; | ||
| this.name = name; | ||
| } | ||
|
|
||
| public Builder description(String description) { | ||
| this.description = description; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder language(String language) { | ||
| this.language = language; | ||
| return this; | ||
| } | ||
|
|
||
| public CreateCollectionRequest build() { | ||
| return new CreateCollectionRequest(this); | ||
| } | ||
| } | ||
| } | ||
20 changes: 20 additions & 0 deletions
20
...om/ibm/watson/developer_cloud/discovery/v1/model/collection/CreateCollectionResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Copyright 2016 IBM Corp. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package com.ibm.watson.developer_cloud.discovery.v1.model.collection; | ||
|
|
||
| /** | ||
| * Response from {@link CreateCollectionRequest}. | ||
| */ | ||
| public class CreateCollectionResponse extends Collection { | ||
| } |
51 changes: 51 additions & 0 deletions
51
...com/ibm/watson/developer_cloud/discovery/v1/model/collection/DeleteCollectionRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright 2016 IBM Corp. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package com.ibm.watson.developer_cloud.discovery.v1.model.collection; | ||
|
|
||
| import com.ibm.watson.developer_cloud.service.model.GenericModel; | ||
|
|
||
| /** | ||
| * Request to delete a {@link Collection}. | ||
| */ | ||
| public class DeleteCollectionRequest extends GenericModel { | ||
| private final String environmentId; | ||
| private final String collectionId; | ||
|
|
||
| private DeleteCollectionRequest(Builder builder) { | ||
| this.environmentId = builder.environmentId; | ||
| this.collectionId = builder.collectionId; | ||
| } | ||
|
|
||
| public String getEnvironmentId() { | ||
| return environmentId; | ||
| } | ||
|
|
||
| public String getCollectionId() { | ||
| return collectionId; | ||
| } | ||
|
|
||
| public static class Builder { | ||
| private final String environmentId; | ||
| private final String collectionId; | ||
|
|
||
| public Builder(String environmentId, String collectionId) { | ||
| this.environmentId = environmentId; | ||
| this.collectionId = collectionId; | ||
| } | ||
|
|
||
| public DeleteCollectionRequest build() { | ||
| return new DeleteCollectionRequest(this); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
120 max line width
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is 119