11/*
2- * Copyright 2017 Basis Technology Corp.
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
2+ * Copyright 2017 Basis Technology Corp.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
1616
1717package com .basistech .rosette .apimodel ;
1818
4444 * In this object the 'content' item is an {@link Object}; it contains a {@link String}
4545 * for plain text, or an {@link java.io.InputStream} for binary data. {@link DocumentRequest.DocumentRequestBuilder}
4646 * provides several alternative methods for setting this information.
47- *
48- * This class includes a 'genre' field. If no genre is specified, then the system
49- * applies generic processing. Valid values for genre are specified in the API documentation.
5047 */
5148@ Value
5249public final class DocumentRequest <O extends Options > extends Request {
@@ -74,20 +71,37 @@ public final class DocumentRequest<O extends Options> extends Request {
7471 /**
7572 * @return request genre
7673 */
74+ @ Deprecated
7775 private final String genre ;
7876
7977 /**
8078 * @return request options
8179 */
8280 private final O options ;
8381
82+
83+ public DocumentRequest (String profileId ,
84+ LanguageCode language ,
85+ Object content ,
86+ String contentUri ,
87+ String contentType ,
88+ O options ) {
89+ super (profileId );
90+ this .language = language ;
91+ this .content = content ;
92+ this .contentUri = contentUri ;
93+ this .contentType = contentType ;
94+ this .genre = null ;
95+ this .options = options ;
96+ }
97+
8498 @ Builder // workaround for inheritance https://github.com/rzwitserloot/lombok/issues/853
8599 public DocumentRequest (String profileId ,
86100 LanguageCode language ,
87101 Object content ,
88102 String contentUri ,
89103 String contentType ,
90- String genre ,
104+ @ Deprecated String genre ,
91105 O options ) {
92106 super (profileId );
93107 this .language = language ;
@@ -100,6 +114,7 @@ public DocumentRequest(String profileId,
100114
101115 /**
102116 * get content to process if it's a String.
117+ *
103118 * @return the content if a String, else null.
104119 */
105120 public String getContent () {
@@ -112,18 +127,20 @@ public String getContent() {
112127
113128 /**
114129 * get the content as an array of bytes
130+ *
115131 * @return the content as bytes
116132 */
117133 public InputStream getContentBytes () {
118134 if (content instanceof InputStream ) {
119- return (InputStream )content ;
135+ return (InputStream ) content ;
120136 } else {
121137 return null ;
122138 }
123139 }
124140
125141 /**
126142 * get content as an object
143+ *
127144 * @return the content as object
128145 */
129146 public Object getRawContent () {
@@ -134,6 +151,7 @@ public Object getRawContent() {
134151 public static class DocumentRequestBuilder <O extends Options > {
135152 /**
136153 * Specify the content as String. Use this for plain text.
154+ *
137155 * @param data The data.
138156 * @return this.
139157 */
@@ -145,7 +163,8 @@ public DocumentRequestBuilder<O> content(String data) {
145163 /**
146164 * Specify the content as bytes with a content type. Use this for
147165 * formats other than plain text.
148- * @param bytes The data.
166+ *
167+ * @param bytes The data.
149168 * @param contentType the content type.
150169 * @return this.
151170 */
@@ -158,7 +177,8 @@ public DocumentRequestBuilder<O> content(byte[] bytes, String contentType) {
158177 /**
159178 * Specify the content as bytes with a content type. Use this for
160179 * formats other than plain text.
161- * @param bytes The data.
180+ *
181+ * @param bytes The data.
162182 * @param contentType the content type.
163183 * @return this.
164184 */
0 commit comments