Skip to content

Commit 53964b3

Browse files
authored
Merge pull request #505 from maniax89/discovery
Discovery merged
2 parents f1a947d + cdaf273 commit 53964b3

File tree

91 files changed

+5430
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+5430
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ APIs and SDKs that use cognitive computing to solve complex problems.
2121
* [Concept Insights](alchemy)
2222
* [Conversation](conversation)
2323
* [Dialog](dialog)
24+
* [Discovery](discovery)
2425
* [Document Conversion](document-conversion)
2526
* [Language Translation](language-translation)
2627
* [Language Translator](language-translator)

all/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<artifactId>dialog</artifactId>
2828
<version>${project.version}</version>
2929
</dependency>
30+
<dependency>
31+
<groupId>${project.groupId}</groupId>
32+
<artifactId>discovery</artifactId>
33+
<version>${project.version}</version>
34+
</dependency>
3035
<dependency>
3136
<groupId>${project.groupId}</groupId>
3237
<artifactId>document-conversion</artifactId>

discovery/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Discovery
2+
3+
## Installation
4+
5+
##### Maven
6+
```xml
7+
<dependency>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>discovery</artifactId>
10+
<version>3.5.3</version>
11+
</dependency>
12+
```
13+
14+
##### Gradle
15+
```gradle
16+
'com.ibm.watson.developer_cloud:discovery:3.5.3'
17+
```
18+
19+
## Usage
20+
The [Discovery][discovery] wraps the environment, collection, configuration, document, and query operations of the Discovery service.
21+
22+
```java
23+
Discovery service = new Discovery("2016-12-15");
24+
service.setEndpoint("https://gateway.watsonplatform.net/discovery/api/");
25+
service.setUsernameAndPassword("<username>", "<password>");
26+
27+
//TODO add service
28+
```
29+
30+
[discovery]: http://www.ibm.com/watson/developercloud/doc/discovery/

discovery/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<parent>
4+
<artifactId>parent</artifactId>
5+
<groupId>com.ibm.watson.developer_cloud</groupId>
6+
<version>3.5.3-SNAPSHOT</version>
7+
</parent>
8+
<modelVersion>4.0.0</modelVersion>
9+
10+
<artifactId>discovery</artifactId>
11+
<name>Discovery</name>
12+
13+
<dependencies>
14+
<dependency>
15+
<groupId>${project.groupId}</groupId>
16+
<artifactId>core</artifactId>
17+
<version>${project.version}</version>
18+
</dependency>
19+
</dependencies>
20+
</project>

discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/Discovery.java

Lines changed: 435 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright 2016 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.developer_cloud.discovery.v1.model.collection;
15+
16+
import com.google.gson.annotations.SerializedName;
17+
import com.ibm.watson.developer_cloud.discovery.v1.model.common.Status;
18+
import com.ibm.watson.developer_cloud.service.model.GenericModel;
19+
20+
import java.util.Date;
21+
22+
/**
23+
* A Collection holds the documents that have been ingested and allows querying against it.
24+
*/
25+
public class Collection extends GenericModel {
26+
@SerializedName(CollectionManager.ID)
27+
private String collectionId;
28+
@SerializedName(CollectionManager.NAME)
29+
private String name;
30+
@SerializedName(CollectionManager.STATUS)
31+
private Status status;
32+
@SerializedName(CollectionManager.CREATED)
33+
private Date created;
34+
@SerializedName(CollectionManager.UPDATED)
35+
private Date updated;
36+
@SerializedName(CollectionManager.DESCRIPTION)
37+
private String description;
38+
@SerializedName(CollectionManager.CONFIGURATION_ID)
39+
private String configurationId;
40+
@SerializedName(CollectionManager.LANGUAGE)
41+
private String language;
42+
@SerializedName(CollectionManager.DOCUMENT_COUNTS)
43+
private DocumentCounts documentCounts;
44+
45+
public String getCollectionId() {
46+
return collectionId;
47+
}
48+
49+
public String getName() {
50+
return name;
51+
}
52+
53+
public Status getStatus() {
54+
return status;
55+
}
56+
57+
public Date getCreated() {
58+
return created;
59+
}
60+
61+
public Date getUpdated() {
62+
return updated;
63+
}
64+
65+
public String getDescription() {
66+
return description;
67+
}
68+
69+
public String getConfigurationId() {
70+
return configurationId;
71+
}
72+
73+
public String getLanguage() {
74+
return language;
75+
}
76+
77+
public DocumentCounts getDocumentCounts() {
78+
return documentCounts;
79+
}
80+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Copyright 2016 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.developer_cloud.discovery.v1.model.collection;
15+
16+
import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.GetCollectionFieldsRequest;
17+
import com.ibm.watson.developer_cloud.http.ServiceCall;
18+
import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.GetCollectionFieldsResponse;
19+
import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.Field;
20+
21+
/**
22+
* Interface defining the constants and methods associated with Collections.
23+
*
24+
* @see Collection
25+
*/
26+
public interface CollectionManager {
27+
String COLLECTIONS = "collections";
28+
29+
//Collection
30+
String ID = "collection_id";
31+
String NAME = "name";
32+
String DESCRIPTION = "description";
33+
String CREATED = "created";
34+
String UPDATED = "update";
35+
String STATUS = "status";
36+
String CONFIGURATION_ID = "configuration_id";
37+
String LANGUAGE = "language";
38+
String DOCUMENT_COUNTS = "document_counts";
39+
40+
//Document Counts
41+
String AVAILABLE = "available";
42+
String PROCESSING = "processing";
43+
String FAILED = "failed";
44+
45+
//Fields
46+
String FIELDS = "fields";
47+
String FIELD = "field";
48+
String TYPE = "type";
49+
50+
/**
51+
* Gets a list of {@link Collection}. An optional parameter of name can be provided to filter by name.
52+
*
53+
* @param getRequest options for getting the {@link Collection}s
54+
* @return a {@link GetCollectionsResponse} containing the result of {@link GetCollectionsRequest}
55+
*/
56+
ServiceCall<GetCollectionsResponse> getCollections(GetCollectionsRequest getRequest);
57+
58+
/**
59+
* Gets a {@link Collection}.
60+
*
61+
* @param getRequest options for getting the {@link Collection}
62+
* @return a {@link GetCollectionResponse} containing the result of {@link GetCollectionRequest}
63+
*/
64+
ServiceCall<GetCollectionResponse> getCollection(GetCollectionRequest getRequest);
65+
66+
/**
67+
* Creates a {@link Collection}.
68+
*
69+
* @param createRequest options for creating a {@link Collection}
70+
* @return a {@link CreateCollectionResponse} containing the result of {@link CreateCollectionRequest}
71+
*/
72+
ServiceCall<CreateCollectionResponse> createCollection(CreateCollectionRequest createRequest);
73+
74+
/**
75+
* Deletes a {@link Collection}.
76+
*
77+
* @param deleteRequest options for deleting a {@link Collection}
78+
* @return a {@link DeleteCollectionResponse} containing the result of {@link DeleteCollectionRequest}
79+
*/
80+
ServiceCall<DeleteCollectionResponse> deleteCollection(DeleteCollectionRequest deleteRequest);
81+
82+
/**
83+
* Gets a list of unique {@link Field}s from a {@link Collection}.
84+
*
85+
* @param getRequest options for getting a unique fields from a {@link Collection}
86+
* @return a {@link GetCollectionFieldsResponse} containing the result of {@link GetCollectionFieldsRequest}
87+
*/
88+
ServiceCall<GetCollectionFieldsResponse> getCollectionFields(GetCollectionFieldsRequest getRequest);
89+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright 2016 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.developer_cloud.discovery.v1.model.collection;
15+
16+
import com.ibm.watson.developer_cloud.service.model.GenericModel;
17+
18+
/**
19+
* Request to create a {@link Collection}.
20+
*/
21+
public class CreateCollectionRequest extends GenericModel {
22+
private final String environmentId;
23+
private final String name;
24+
private final String description;
25+
private final String configurationId;
26+
private final String language;
27+
28+
private CreateCollectionRequest(Builder builder) {
29+
this.environmentId = builder.environmentId;
30+
this.name = builder.name;
31+
this.description = builder.description;
32+
this.configurationId = builder.configurationId;
33+
this.language = builder.language;
34+
}
35+
36+
public String getEnvironmentId() {
37+
return environmentId;
38+
}
39+
40+
public String getName() {
41+
return name;
42+
}
43+
44+
public String getDescription() {
45+
return description;
46+
}
47+
48+
public String getConfigurationId() {
49+
return configurationId;
50+
}
51+
52+
public String getLanguage() {
53+
return language;
54+
}
55+
56+
public static class Builder {
57+
private final String environmentId;
58+
private final String name;
59+
private final String configurationId;
60+
private String description;
61+
private String language;
62+
63+
public Builder(String environmentId, String configurationId, String name) {
64+
this.environmentId = environmentId;
65+
this.configurationId = configurationId;
66+
this.name = name;
67+
}
68+
69+
public Builder description(String description) {
70+
this.description = description;
71+
return this;
72+
}
73+
74+
public Builder language(String language) {
75+
this.language = language;
76+
return this;
77+
}
78+
79+
public CreateCollectionRequest build() {
80+
return new CreateCollectionRequest(this);
81+
}
82+
}
83+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2016 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.developer_cloud.discovery.v1.model.collection;
15+
16+
/**
17+
* Response from {@link CreateCollectionRequest}.
18+
*/
19+
public class CreateCollectionResponse extends Collection {
20+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2016 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.developer_cloud.discovery.v1.model.collection;
15+
16+
import com.ibm.watson.developer_cloud.service.model.GenericModel;
17+
18+
/**
19+
* Request to delete a {@link Collection}.
20+
*/
21+
public class DeleteCollectionRequest extends GenericModel {
22+
private final String environmentId;
23+
private final String collectionId;
24+
25+
private DeleteCollectionRequest(Builder builder) {
26+
this.environmentId = builder.environmentId;
27+
this.collectionId = builder.collectionId;
28+
}
29+
30+
public String getEnvironmentId() {
31+
return environmentId;
32+
}
33+
34+
public String getCollectionId() {
35+
return collectionId;
36+
}
37+
38+
public static class Builder {
39+
private final String environmentId;
40+
private final String collectionId;
41+
42+
public Builder(String environmentId, String collectionId) {
43+
this.environmentId = environmentId;
44+
this.collectionId = collectionId;
45+
}
46+
47+
public DeleteCollectionRequest build() {
48+
return new DeleteCollectionRequest(this);
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)