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 {
@@ -71,7 +68,7 @@ public final class DocumentRequest<O extends Options> extends Request {
7168 */
7269 private final String contentType ;
7370
74- /**
71+ /** @deprecated
7572 * @return request genre
7673 */
7774 private final String genre ;
@@ -81,13 +78,29 @@ public final class DocumentRequest<O extends Options> extends Request {
8178 */
8279 private final O options ;
8380
81+
82+ public DocumentRequest (String profileId ,
83+ LanguageCode language ,
84+ Object content ,
85+ String contentUri ,
86+ String contentType ,
87+ O options ) {
88+ super (profileId );
89+ this .language = language ;
90+ this .content = content ;
91+ this .contentUri = contentUri ;
92+ this .contentType = contentType ;
93+ this .genre = null ;
94+ this .options = options ;
95+ }
96+
8497 @ Builder // workaround for inheritance https://github.com/rzwitserloot/lombok/issues/853
8598 public DocumentRequest (String profileId ,
8699 LanguageCode language ,
87100 Object content ,
88101 String contentUri ,
89102 String contentType ,
90- String genre ,
103+ @ Deprecated String genre ,
91104 O options ) {
92105 super (profileId );
93106 this .language = language ;
@@ -100,6 +113,7 @@ public DocumentRequest(String profileId,
100113
101114 /**
102115 * get content to process if it's a String.
116+ *
103117 * @return the content if a String, else null.
104118 */
105119 public String getContent () {
@@ -112,18 +126,20 @@ public String getContent() {
112126
113127 /**
114128 * get the content as an array of bytes
129+ *
115130 * @return the content as bytes
116131 */
117132 public InputStream getContentBytes () {
118133 if (content instanceof InputStream ) {
119- return (InputStream )content ;
134+ return (InputStream ) content ;
120135 } else {
121136 return null ;
122137 }
123138 }
124139
125140 /**
126141 * get content as an object
142+ *
127143 * @return the content as object
128144 */
129145 public Object getRawContent () {
@@ -134,6 +150,7 @@ public Object getRawContent() {
134150 public static class DocumentRequestBuilder <O extends Options > {
135151 /**
136152 * Specify the content as String. Use this for plain text.
153+ *
137154 * @param data The data.
138155 * @return this.
139156 */
@@ -145,7 +162,8 @@ public DocumentRequestBuilder<O> content(String data) {
145162 /**
146163 * Specify the content as bytes with a content type. Use this for
147164 * formats other than plain text.
148- * @param bytes The data.
165+ *
166+ * @param bytes The data.
149167 * @param contentType the content type.
150168 * @return this.
151169 */
@@ -158,7 +176,8 @@ public DocumentRequestBuilder<O> content(byte[] bytes, String contentType) {
158176 /**
159177 * Specify the content as bytes with a content type. Use this for
160178 * formats other than plain text.
161- * @param bytes The data.
179+ *
180+ * @param bytes The data.
162181 * @param contentType the content type.
163182 * @return this.
164183 */
0 commit comments