Skip to content

Commit 5b1fc8a

Browse files
author
SDKAuto
committed
CodeGen from PR 31595 in Azure/azure-rest-api-specs
Merge 999478bbe5d920be2dc83ec8f2bb54ad652faab0 into 72de3f32ff4723c19e9868eb498f65c40a480fc9
1 parent 49f10a7 commit 5b1fc8a

File tree

7 files changed

+292
-60
lines changed

7 files changed

+292
-60
lines changed

sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationAsyncClient.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions;
1010
import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions;
1111
import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization;
12-
import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest;
12+
import com.azure.ai.documentintelligence.models.ComposeDocumentModelOptions;
1313
import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails;
1414
import com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails;
1515
import com.azure.ai.documentintelligence.models.DocumentClassifierDetails;
@@ -817,27 +817,6 @@ public Mono<Response<Void>> deleteClassifierWithResponse(String classifierId, Re
817817
return serviceClient.beginBuildDocumentModelWithModelAsync(BinaryData.fromObject(buildRequest), requestOptions);
818818
}
819819

820-
/**
821-
* Creates a new document model from document types of existing document models.
822-
*
823-
* @param composeRequest Compose request parameters.
824-
* @throws IllegalArgumentException thrown if parameters fail the validation.
825-
* @throws HttpResponseException thrown if the request is rejected by server.
826-
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
827-
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
828-
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
829-
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
830-
* @return the {@link PollerFlux} for polling of long-running operation.
831-
*/
832-
@Generated
833-
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
834-
public PollerFlux<DocumentModelComposeOperationDetails, DocumentModelDetails>
835-
beginComposeModel(ComposeDocumentModelRequest composeRequest) {
836-
// Generated convenience method for beginComposeModelWithModel
837-
RequestOptions requestOptions = new RequestOptions();
838-
return serviceClient.beginComposeModelWithModelAsync(BinaryData.fromObject(composeRequest), requestOptions);
839-
}
840-
841820
/**
842821
* Generates authorization to copy a document model to this location with
843822
* specified modelId and optional description.
@@ -1168,4 +1147,25 @@ public Mono<Void> deleteClassifier(String classifierId) {
11681147
RequestOptions requestOptions = new RequestOptions();
11691148
return deleteClassifierWithResponse(classifierId, requestOptions).flatMap(FluxUtil::toMono);
11701149
}
1150+
1151+
/**
1152+
* Creates a new document model from document types of existing document models.
1153+
*
1154+
* @param composeRequest Compose request parameters.
1155+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1156+
* @throws HttpResponseException thrown if the request is rejected by server.
1157+
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
1158+
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
1159+
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
1160+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1161+
* @return the {@link PollerFlux} for polling of long-running operation.
1162+
*/
1163+
@Generated
1164+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
1165+
public PollerFlux<DocumentModelComposeOperationDetails, DocumentModelDetails>
1166+
beginComposeModel(ComposeDocumentModelOptions composeRequest) {
1167+
// Generated convenience method for beginComposeModelWithModel
1168+
RequestOptions requestOptions = new RequestOptions();
1169+
return serviceClient.beginComposeModelWithModelAsync(BinaryData.fromObject(composeRequest), requestOptions);
1170+
}
11711171
}

sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClient.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions;
1010
import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions;
1111
import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization;
12-
import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest;
12+
import com.azure.ai.documentintelligence.models.ComposeDocumentModelOptions;
1313
import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails;
1414
import com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails;
1515
import com.azure.ai.documentintelligence.models.DocumentClassifierDetails;
@@ -809,27 +809,6 @@ public Response<Void> deleteClassifierWithResponse(String classifierId, RequestO
809809
return serviceClient.beginBuildDocumentModelWithModel(BinaryData.fromObject(buildRequest), requestOptions);
810810
}
811811

812-
/**
813-
* Creates a new document model from document types of existing document models.
814-
*
815-
* @param composeRequest Compose request parameters.
816-
* @throws IllegalArgumentException thrown if parameters fail the validation.
817-
* @throws HttpResponseException thrown if the request is rejected by server.
818-
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
819-
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
820-
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
821-
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
822-
* @return the {@link SyncPoller} for polling of long-running operation.
823-
*/
824-
@Generated
825-
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
826-
public SyncPoller<DocumentModelComposeOperationDetails, DocumentModelDetails>
827-
beginComposeModel(ComposeDocumentModelRequest composeRequest) {
828-
// Generated convenience method for beginComposeModelWithModel
829-
RequestOptions requestOptions = new RequestOptions();
830-
return serviceClient.beginComposeModelWithModel(BinaryData.fromObject(composeRequest), requestOptions);
831-
}
832-
833812
/**
834813
* Generates authorization to copy a document model to this location with
835814
* specified modelId and optional description.
@@ -1119,4 +1098,25 @@ public void deleteClassifier(String classifierId) {
11191098
RequestOptions requestOptions = new RequestOptions();
11201099
deleteClassifierWithResponse(classifierId, requestOptions).getValue();
11211100
}
1101+
1102+
/**
1103+
* Creates a new document model from document types of existing document models.
1104+
*
1105+
* @param composeRequest Compose request parameters.
1106+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1107+
* @throws HttpResponseException thrown if the request is rejected by server.
1108+
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
1109+
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
1110+
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
1111+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1112+
* @return the {@link SyncPoller} for polling of long-running operation.
1113+
*/
1114+
@Generated
1115+
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
1116+
public SyncPoller<DocumentModelComposeOperationDetails, DocumentModelDetails>
1117+
beginComposeModel(ComposeDocumentModelOptions composeRequest) {
1118+
// Generated convenience method for beginComposeModelWithModel
1119+
RequestOptions requestOptions = new RequestOptions();
1120+
return serviceClient.beginComposeModelWithModel(BinaryData.fromObject(composeRequest), requestOptions);
1121+
}
11221122
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) TypeSpec Code Generator.
4+
5+
package com.azure.ai.documentintelligence.models;
6+
7+
import com.azure.core.annotation.Fluent;
8+
import com.azure.core.annotation.Generated;
9+
import com.azure.json.JsonReader;
10+
import com.azure.json.JsonSerializable;
11+
import com.azure.json.JsonToken;
12+
import com.azure.json.JsonWriter;
13+
import java.io.IOException;
14+
import java.util.Map;
15+
16+
/**
17+
* Request body to create a composed document model from component document models.
18+
*/
19+
@Fluent
20+
public final class ComposeDocumentModelOptions implements JsonSerializable<ComposeDocumentModelOptions> {
21+
/*
22+
* Unique document model name.
23+
*/
24+
@Generated
25+
private final String modelId;
26+
27+
/*
28+
* Document model description.
29+
*/
30+
@Generated
31+
private String description;
32+
33+
/*
34+
* Custom classifier to split and classify the input file.
35+
*/
36+
@Generated
37+
private final String classifierId;
38+
39+
/*
40+
* File splitting behavior.
41+
*/
42+
@Generated
43+
private SplitMode split;
44+
45+
/*
46+
* Dictionary mapping supported docTypes to the corresponding document models.
47+
*/
48+
@Generated
49+
private final Map<String, DocumentTypeDetails> documentTypes;
50+
51+
/*
52+
* List of key-value tag attributes associated with the document model.
53+
*/
54+
@Generated
55+
private Map<String, String> tags;
56+
57+
/**
58+
* Creates an instance of ComposeDocumentModelOptions class.
59+
*
60+
* @param modelId the modelId value to set.
61+
* @param classifierId the classifierId value to set.
62+
* @param documentTypes the documentTypes value to set.
63+
*/
64+
@Generated
65+
public ComposeDocumentModelOptions(String modelId, String classifierId,
66+
Map<String, DocumentTypeDetails> documentTypes) {
67+
this.modelId = modelId;
68+
this.classifierId = classifierId;
69+
this.documentTypes = documentTypes;
70+
}
71+
72+
/**
73+
* Get the modelId property: Unique document model name.
74+
*
75+
* @return the modelId value.
76+
*/
77+
@Generated
78+
public String getModelId() {
79+
return this.modelId;
80+
}
81+
82+
/**
83+
* Get the description property: Document model description.
84+
*
85+
* @return the description value.
86+
*/
87+
@Generated
88+
public String getDescription() {
89+
return this.description;
90+
}
91+
92+
/**
93+
* Set the description property: Document model description.
94+
*
95+
* @param description the description value to set.
96+
* @return the ComposeDocumentModelOptions object itself.
97+
*/
98+
@Generated
99+
public ComposeDocumentModelOptions setDescription(String description) {
100+
this.description = description;
101+
return this;
102+
}
103+
104+
/**
105+
* Get the classifierId property: Custom classifier to split and classify the input file.
106+
*
107+
* @return the classifierId value.
108+
*/
109+
@Generated
110+
public String getClassifierId() {
111+
return this.classifierId;
112+
}
113+
114+
/**
115+
* Get the split property: File splitting behavior.
116+
*
117+
* @return the split value.
118+
*/
119+
@Generated
120+
public SplitMode getSplit() {
121+
return this.split;
122+
}
123+
124+
/**
125+
* Set the split property: File splitting behavior.
126+
*
127+
* @param split the split value to set.
128+
* @return the ComposeDocumentModelOptions object itself.
129+
*/
130+
@Generated
131+
public ComposeDocumentModelOptions setSplit(SplitMode split) {
132+
this.split = split;
133+
return this;
134+
}
135+
136+
/**
137+
* Get the documentTypes property: Dictionary mapping supported docTypes to the corresponding document models.
138+
*
139+
* @return the documentTypes value.
140+
*/
141+
@Generated
142+
public Map<String, DocumentTypeDetails> getDocumentTypes() {
143+
return this.documentTypes;
144+
}
145+
146+
/**
147+
* Get the tags property: List of key-value tag attributes associated with the document model.
148+
*
149+
* @return the tags value.
150+
*/
151+
@Generated
152+
public Map<String, String> getTags() {
153+
return this.tags;
154+
}
155+
156+
/**
157+
* Set the tags property: List of key-value tag attributes associated with the document model.
158+
*
159+
* @param tags the tags value to set.
160+
* @return the ComposeDocumentModelOptions object itself.
161+
*/
162+
@Generated
163+
public ComposeDocumentModelOptions setTags(Map<String, String> tags) {
164+
this.tags = tags;
165+
return this;
166+
}
167+
168+
/**
169+
* {@inheritDoc}
170+
*/
171+
@Generated
172+
@Override
173+
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
174+
jsonWriter.writeStartObject();
175+
jsonWriter.writeStringField("modelId", this.modelId);
176+
jsonWriter.writeStringField("classifierId", this.classifierId);
177+
jsonWriter.writeMapField("docTypes", this.documentTypes, (writer, element) -> writer.writeJson(element));
178+
jsonWriter.writeStringField("description", this.description);
179+
jsonWriter.writeStringField("split", this.split == null ? null : this.split.toString());
180+
jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
181+
return jsonWriter.writeEndObject();
182+
}
183+
184+
/**
185+
* Reads an instance of ComposeDocumentModelOptions from the JsonReader.
186+
*
187+
* @param jsonReader The JsonReader being read.
188+
* @return An instance of ComposeDocumentModelOptions if the JsonReader was pointing to an instance of it, or null
189+
* if it was pointing to JSON null.
190+
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
191+
* @throws IOException If an error occurs while reading the ComposeDocumentModelOptions.
192+
*/
193+
@Generated
194+
public static ComposeDocumentModelOptions fromJson(JsonReader jsonReader) throws IOException {
195+
return jsonReader.readObject(reader -> {
196+
String modelId = null;
197+
String classifierId = null;
198+
Map<String, DocumentTypeDetails> documentTypes = null;
199+
String description = null;
200+
SplitMode split = null;
201+
Map<String, String> tags = null;
202+
while (reader.nextToken() != JsonToken.END_OBJECT) {
203+
String fieldName = reader.getFieldName();
204+
reader.nextToken();
205+
206+
if ("modelId".equals(fieldName)) {
207+
modelId = reader.getString();
208+
} else if ("classifierId".equals(fieldName)) {
209+
classifierId = reader.getString();
210+
} else if ("docTypes".equals(fieldName)) {
211+
documentTypes = reader.readMap(reader1 -> DocumentTypeDetails.fromJson(reader1));
212+
} else if ("description".equals(fieldName)) {
213+
description = reader.getString();
214+
} else if ("split".equals(fieldName)) {
215+
split = SplitMode.fromString(reader.getString());
216+
} else if ("tags".equals(fieldName)) {
217+
tags = reader.readMap(reader1 -> reader1.getString());
218+
} else {
219+
reader.skipChildren();
220+
}
221+
}
222+
ComposeDocumentModelOptions deserializedComposeDocumentModelOptions
223+
= new ComposeDocumentModelOptions(modelId, classifierId, documentTypes);
224+
deserializedComposeDocumentModelOptions.description = description;
225+
deserializedComposeDocumentModelOptions.split = split;
226+
deserializedComposeDocumentModelOptions.tags = tags;
227+
228+
return deserializedComposeDocumentModelOptions;
229+
});
230+
}
231+
}

0 commit comments

Comments
 (0)