Skip to content

Commit 7533837

Browse files
committed
feat: Add initial generation of Visual Recognition v4
1 parent f36c5a1 commit 7533837

40 files changed

+4566
-0
lines changed

visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java

Lines changed: 591 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2019.
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+
package com.ibm.watson.visual_recognition.v4.model;
14+
15+
import java.util.ArrayList;
16+
import java.util.List;
17+
18+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
19+
20+
/**
21+
* The addImageTrainingData options.
22+
*/
23+
public class AddImageTrainingDataOptions extends GenericModel {
24+
25+
private String collectionId;
26+
private String imageId;
27+
private List<BaseObject> objects;
28+
29+
/**
30+
* Builder.
31+
*/
32+
public static class Builder {
33+
private String collectionId;
34+
private String imageId;
35+
private List<BaseObject> objects;
36+
37+
private Builder(AddImageTrainingDataOptions addImageTrainingDataOptions) {
38+
this.collectionId = addImageTrainingDataOptions.collectionId;
39+
this.imageId = addImageTrainingDataOptions.imageId;
40+
this.objects = addImageTrainingDataOptions.objects;
41+
}
42+
43+
/**
44+
* Instantiates a new builder.
45+
*/
46+
public Builder() {
47+
}
48+
49+
/**
50+
* Instantiates a new builder with required properties.
51+
*
52+
* @param collectionId the collectionId
53+
* @param imageId the imageId
54+
*/
55+
public Builder(String collectionId, String imageId) {
56+
this.collectionId = collectionId;
57+
this.imageId = imageId;
58+
}
59+
60+
/**
61+
* Builds a AddImageTrainingDataOptions.
62+
*
63+
* @return the addImageTrainingDataOptions
64+
*/
65+
public AddImageTrainingDataOptions build() {
66+
return new AddImageTrainingDataOptions(this);
67+
}
68+
69+
/**
70+
* Adds an objects to objects.
71+
*
72+
* @param objects the new objects
73+
* @return the AddImageTrainingDataOptions builder
74+
*/
75+
public Builder addObjects(BaseObject objects) {
76+
com.ibm.cloud.sdk.core.util.Validator.notNull(objects,
77+
"objects cannot be null");
78+
if (this.objects == null) {
79+
this.objects = new ArrayList<BaseObject>();
80+
}
81+
this.objects.add(objects);
82+
return this;
83+
}
84+
85+
/**
86+
* Set the collectionId.
87+
*
88+
* @param collectionId the collectionId
89+
* @return the AddImageTrainingDataOptions builder
90+
*/
91+
public Builder collectionId(String collectionId) {
92+
this.collectionId = collectionId;
93+
return this;
94+
}
95+
96+
/**
97+
* Set the imageId.
98+
*
99+
* @param imageId the imageId
100+
* @return the AddImageTrainingDataOptions builder
101+
*/
102+
public Builder imageId(String imageId) {
103+
this.imageId = imageId;
104+
return this;
105+
}
106+
107+
/**
108+
* Set the objects.
109+
* Existing objects will be replaced.
110+
*
111+
* @param objects the objects
112+
* @return the AddImageTrainingDataOptions builder
113+
*/
114+
public Builder objects(List<BaseObject> objects) {
115+
this.objects = objects;
116+
return this;
117+
}
118+
}
119+
120+
private AddImageTrainingDataOptions(Builder builder) {
121+
com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId,
122+
"collectionId cannot be empty");
123+
com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.imageId,
124+
"imageId cannot be empty");
125+
collectionId = builder.collectionId;
126+
imageId = builder.imageId;
127+
objects = builder.objects;
128+
}
129+
130+
/**
131+
* New builder.
132+
*
133+
* @return a AddImageTrainingDataOptions builder
134+
*/
135+
public Builder newBuilder() {
136+
return new Builder(this);
137+
}
138+
139+
/**
140+
* Gets the collectionId.
141+
*
142+
* The identifier of the collection.
143+
*
144+
* @return the collectionId
145+
*/
146+
public String collectionId() {
147+
return collectionId;
148+
}
149+
150+
/**
151+
* Gets the imageId.
152+
*
153+
* The identifier of the image.
154+
*
155+
* @return the imageId
156+
*/
157+
public String imageId() {
158+
return imageId;
159+
}
160+
161+
/**
162+
* Gets the objects.
163+
*
164+
* Training data for specific objects.
165+
*
166+
* @return the objects
167+
*/
168+
public List<BaseObject> objects() {
169+
return objects;
170+
}
171+
}
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2019.
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+
package com.ibm.watson.visual_recognition.v4.model;
14+
15+
import java.util.ArrayList;
16+
import java.util.List;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
20+
21+
/**
22+
* The addImages options.
23+
*/
24+
public class AddImagesOptions extends GenericModel {
25+
26+
private String collectionId;
27+
private List<FileWithMetadata> imagesFile;
28+
private List<String> imageUrl;
29+
private String trainingData;
30+
31+
/**
32+
* Builder.
33+
*/
34+
public static class Builder {
35+
private String collectionId;
36+
private List<FileWithMetadata> imagesFile;
37+
private List<String> imageUrl;
38+
private String trainingData;
39+
40+
private Builder(AddImagesOptions addImagesOptions) {
41+
this.collectionId = addImagesOptions.collectionId;
42+
this.imagesFile = addImagesOptions.imagesFile;
43+
this.imageUrl = addImagesOptions.imageUrl;
44+
this.trainingData = addImagesOptions.trainingData;
45+
}
46+
47+
/**
48+
* Instantiates a new builder.
49+
*/
50+
public Builder() {
51+
}
52+
53+
/**
54+
* Instantiates a new builder with required properties.
55+
*
56+
* @param collectionId the collectionId
57+
*/
58+
public Builder(String collectionId) {
59+
this.collectionId = collectionId;
60+
}
61+
62+
/**
63+
* Builds a AddImagesOptions.
64+
*
65+
* @return the addImagesOptions
66+
*/
67+
public AddImagesOptions build() {
68+
return new AddImagesOptions(this);
69+
}
70+
71+
/**
72+
* Adds an imagesFile to imagesFile.
73+
*
74+
* @param imagesFile the new imagesFile
75+
* @return the AddImagesOptions builder
76+
*/
77+
public Builder addImagesFile(FileWithMetadata imagesFile) {
78+
com.ibm.cloud.sdk.core.util.Validator.notNull(imagesFile,
79+
"imagesFile cannot be null");
80+
if (this.imagesFile == null) {
81+
this.imagesFile = new ArrayList<FileWithMetadata>();
82+
}
83+
this.imagesFile.add(imagesFile);
84+
return this;
85+
}
86+
87+
/**
88+
* Adds an imageUrl to imageUrl.
89+
*
90+
* @param imageUrl the new imageUrl
91+
* @return the AddImagesOptions builder
92+
*/
93+
public Builder addImageUrl(String imageUrl) {
94+
com.ibm.cloud.sdk.core.util.Validator.notNull(imageUrl,
95+
"imageUrl cannot be null");
96+
if (this.imageUrl == null) {
97+
this.imageUrl = new ArrayList<String>();
98+
}
99+
this.imageUrl.add(imageUrl);
100+
return this;
101+
}
102+
103+
/**
104+
* Set the collectionId.
105+
*
106+
* @param collectionId the collectionId
107+
* @return the AddImagesOptions builder
108+
*/
109+
public Builder collectionId(String collectionId) {
110+
this.collectionId = collectionId;
111+
return this;
112+
}
113+
114+
/**
115+
* Set the imagesFile.
116+
* Existing imagesFile will be replaced.
117+
*
118+
* @param imagesFile the imagesFile
119+
* @return the AddImagesOptions builder
120+
*/
121+
public Builder imagesFile(List<FileWithMetadata> imagesFile) {
122+
this.imagesFile = imagesFile;
123+
return this;
124+
}
125+
126+
/**
127+
* Set the imageUrl.
128+
* Existing imageUrl will be replaced.
129+
*
130+
* @param imageUrl the imageUrl
131+
* @return the AddImagesOptions builder
132+
*/
133+
public Builder imageUrl(List<String> imageUrl) {
134+
this.imageUrl = imageUrl;
135+
return this;
136+
}
137+
138+
/**
139+
* Set the trainingData.
140+
*
141+
* @param trainingData the trainingData
142+
* @return the AddImagesOptions builder
143+
*/
144+
public Builder trainingData(String trainingData) {
145+
this.trainingData = trainingData;
146+
return this;
147+
}
148+
}
149+
150+
private AddImagesOptions(Builder builder) {
151+
com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId,
152+
"collectionId cannot be empty");
153+
collectionId = builder.collectionId;
154+
imagesFile = builder.imagesFile;
155+
imageUrl = builder.imageUrl;
156+
trainingData = builder.trainingData;
157+
}
158+
159+
/**
160+
* New builder.
161+
*
162+
* @return a AddImagesOptions builder
163+
*/
164+
public Builder newBuilder() {
165+
return new Builder(this);
166+
}
167+
168+
/**
169+
* Gets the collectionId.
170+
*
171+
* The identifier of the collection.
172+
*
173+
* @return the collectionId
174+
*/
175+
public String collectionId() {
176+
return collectionId;
177+
}
178+
179+
/**
180+
* Gets the imagesFile.
181+
*
182+
* An array of image files (.jpg or .png) or .zip files with images.
183+
* - Include a maximum of 20 images in a request.
184+
* - Limit the .zip file to 100 MB.
185+
* - Limit each image file to 10 MB.
186+
*
187+
* You can also include an image with the **image_url** parameter.
188+
*
189+
* @return the imagesFile
190+
*/
191+
public List<FileWithMetadata> imagesFile() {
192+
return imagesFile;
193+
}
194+
195+
/**
196+
* Gets the imageUrl.
197+
*
198+
* The array of URLs of image files (.jpg or .png).
199+
* - Include a maximum of 20 images in a request.
200+
* - Limit each image file to 10 MB.
201+
* - Minimum width and height is 30 pixels, but the service tends to perform better with images that are at least 300
202+
* x 300 pixels. Maximum is 5400 pixels for either height or width.
203+
*
204+
* You can also include images with the **images_file** parameter.
205+
*
206+
* @return the imageUrl
207+
*/
208+
public List<String> imageUrl() {
209+
return imageUrl;
210+
}
211+
212+
/**
213+
* Gets the trainingData.
214+
*
215+
* Training data for a single image. Include training data only if you add one image with the request.
216+
*
217+
* The `object` property can contain alphanumeric, underscore, hyphen, space, and dot characters. It cannot begin with
218+
* the reserved prefix `sys-` and must be no longer than 32 characters.
219+
*
220+
* @return the trainingData
221+
*/
222+
public String trainingData() {
223+
return trainingData;
224+
}
225+
}

0 commit comments

Comments
 (0)