|
| 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