@@ -17,7 +17,7 @@ namespace Azure.AI.FormRecognizer.DocumentAnalysis
17
17
/// properties.
18
18
/// </summary>
19
19
/// <remarks>
20
- /// This client only works with <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2022_08_31"/> and up .
20
+ /// This client only works with <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2022_08_31"/> and newer .
21
21
/// If you want to use a lower version, please use the <see cref="Training.FormTrainingClient"/>.
22
22
/// </remarks>
23
23
public class DocumentModelAdministrationClient
@@ -392,7 +392,7 @@ public virtual async Task<Response> DeleteDocumentModelAsync(string modelId, Can
392
392
}
393
393
394
394
/// <summary>
395
- /// Gets a collection of items describing the models available on this Cognitive Services Account .
395
+ /// Gets a collection of items describing the models available on this Form Recognizer resource .
396
396
/// </summary>
397
397
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
398
398
/// <returns>A collection of <see cref="DocumentModelSummary"/> items.</returns>
@@ -436,7 +436,7 @@ Page<DocumentModelSummary> NextPageFunc(string nextLink, int? pageSizeHint)
436
436
}
437
437
438
438
/// <summary>
439
- /// Gets a collection of items describing the models available on this Cognitive Services Account .
439
+ /// Gets a collection of items describing the models available on this Form Recognizer resource .
440
440
/// </summary>
441
441
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
442
442
/// <returns>A collection of <see cref="DocumentModelSummary"/> items.</returns>
@@ -981,6 +981,9 @@ internal static List<ComponentDocumentModelDetails> ConvertToComponentModelDetai
981
981
/// A <see cref="BuildDocumentClassifierOperation"/> to wait on this long-running operation. Its Value upon successful
982
982
/// completion will contain meta-data about the created document classifier.
983
983
/// </returns>
984
+ /// <remarks>
985
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
986
+ /// </remarks>
984
987
public virtual BuildDocumentClassifierOperation BuildDocumentClassifier ( WaitUntil waitUntil , IDictionary < string , ClassifierDocumentTypeDetails > documentTypes , string classifierId = default , string description = default , CancellationToken cancellationToken = default )
985
988
{
986
989
Argument . AssertNotNullOrEmpty ( documentTypes , nameof ( documentTypes ) ) ;
@@ -1031,6 +1034,9 @@ public virtual BuildDocumentClassifierOperation BuildDocumentClassifier(WaitUnti
1031
1034
/// A <see cref="BuildDocumentClassifierOperation"/> to wait on this long-running operation. Its Value upon successful
1032
1035
/// completion will contain meta-data about the created document classifier.
1033
1036
/// </returns>
1037
+ /// <remarks>
1038
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1039
+ /// </remarks>
1034
1040
public virtual async Task < BuildDocumentClassifierOperation > BuildDocumentClassifierAsync ( WaitUntil waitUntil , IDictionary < string , ClassifierDocumentTypeDetails > documentTypes , string classifierId = default , string description = default , CancellationToken cancellationToken = default )
1035
1041
{
1036
1042
Argument . AssertNotNullOrEmpty ( documentTypes , nameof ( documentTypes ) ) ;
@@ -1063,12 +1069,167 @@ public virtual async Task<BuildDocumentClassifierOperation> BuildDocumentClassif
1063
1069
}
1064
1070
}
1065
1071
1072
+ /// <summary>
1073
+ /// Gets information about a document classifier, including the types of documents it can identify.
1074
+ /// </summary>
1075
+ /// <param name="classifierId">The ID of the classifier to retrieve.</param>
1076
+ /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
1077
+ /// <returns>A <see cref="Response{T}"/> representing the result of the operation. It can be cast to a <see cref="DocumentClassifierDetails"/> containing
1078
+ /// information about the requested classifier.</returns>
1079
+ /// <remarks>
1080
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1081
+ /// </remarks>
1082
+ public virtual Response < DocumentClassifierDetails > GetDocumentClassifier ( string classifierId , CancellationToken cancellationToken = default )
1083
+ {
1084
+ Argument . AssertNotNullOrEmpty ( classifierId , nameof ( classifierId ) ) ;
1085
+
1086
+ using DiagnosticScope scope = Diagnostics . CreateScope ( $ "{ nameof ( DocumentModelAdministrationClient ) } .{ nameof ( GetDocumentClassifier ) } ") ;
1087
+ scope . Start ( ) ;
1088
+
1089
+ try
1090
+ {
1091
+ Response < DocumentClassifierDetails > response = ServiceClient . DocumentClassifiersGetClassifier ( classifierId , cancellationToken ) ;
1092
+ return Response . FromValue ( response . Value , response . GetRawResponse ( ) ) ;
1093
+ }
1094
+ catch ( Exception e )
1095
+ {
1096
+ scope . Failed ( e ) ;
1097
+ throw ;
1098
+ }
1099
+ }
1100
+
1101
+ /// <summary>
1102
+ /// Gets information about a document classifier, including the types of documents it can identify.
1103
+ /// </summary>
1104
+ /// <param name="classifierId">The ID of the classifier to retrieve.</param>
1105
+ /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
1106
+ /// <returns>A <see cref="Response{T}"/> representing the result of the operation. It can be cast to a <see cref="DocumentClassifierDetails"/> containing
1107
+ /// information about the requested classifier.</returns>
1108
+ /// <remarks>
1109
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1110
+ /// </remarks>
1111
+ public virtual async Task < Response < DocumentClassifierDetails > > GetDocumentClassifierAsync ( string classifierId , CancellationToken cancellationToken = default )
1112
+ {
1113
+ Argument . AssertNotNullOrEmpty ( classifierId , nameof ( classifierId ) ) ;
1114
+
1115
+ using DiagnosticScope scope = Diagnostics . CreateScope ( $ "{ nameof ( DocumentModelAdministrationClient ) } .{ nameof ( GetDocumentClassifier ) } ") ;
1116
+ scope . Start ( ) ;
1117
+
1118
+ try
1119
+ {
1120
+ Response < DocumentClassifierDetails > response = await ServiceClient . DocumentClassifiersGetClassifierAsync ( classifierId , cancellationToken ) . ConfigureAwait ( false ) ;
1121
+ return Response . FromValue ( response . Value , response . GetRawResponse ( ) ) ;
1122
+ }
1123
+ catch ( Exception e )
1124
+ {
1125
+ scope . Failed ( e ) ;
1126
+ throw ;
1127
+ }
1128
+ }
1129
+
1130
+ /// <summary>
1131
+ /// Gets a collection of items describing the document classifiers available on this Form Recognizer resource.
1132
+ /// </summary>
1133
+ /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
1134
+ /// <returns>A collection of <see cref="DocumentClassifierDetails"/> items.</returns>
1135
+ /// <remarks>
1136
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1137
+ /// </remarks>
1138
+ public virtual Pageable < DocumentClassifierDetails > GetDocumentClassifiers ( CancellationToken cancellationToken = default )
1139
+ {
1140
+ Page < DocumentClassifierDetails > FirstPageFunc ( int ? pageSizeHint )
1141
+ {
1142
+ using DiagnosticScope scope = Diagnostics . CreateScope ( $ "{ nameof ( DocumentModelAdministrationClient ) } .{ nameof ( GetDocumentClassifiers ) } ") ;
1143
+ scope . Start ( ) ;
1144
+
1145
+ try
1146
+ {
1147
+ Response < GetDocumentClassifiersResponse > response = ServiceClient . DocumentClassifiersListClassifiers ( cancellationToken ) ;
1148
+ return Page . FromValues ( response . Value . Value , response . Value . NextLink ? . AbsoluteUri , response . GetRawResponse ( ) ) ;
1149
+ }
1150
+ catch ( Exception e )
1151
+ {
1152
+ scope . Failed ( e ) ;
1153
+ throw ;
1154
+ }
1155
+ }
1156
+
1157
+ Page < DocumentClassifierDetails > NextPageFunc ( string nextLink , int ? pageSizeHint )
1158
+ {
1159
+ using DiagnosticScope scope = Diagnostics . CreateScope ( $ "{ nameof ( DocumentModelAdministrationClient ) } .{ nameof ( GetDocumentClassifiers ) } ") ;
1160
+ scope . Start ( ) ;
1161
+
1162
+ try
1163
+ {
1164
+ Response < GetDocumentClassifiersResponse > response = ServiceClient . DocumentClassifiersListClassifiersNextPage ( nextLink , cancellationToken ) ;
1165
+ return Page . FromValues ( response . Value . Value , response . Value . NextLink ? . AbsoluteUri , response . GetRawResponse ( ) ) ;
1166
+ }
1167
+ catch ( Exception e )
1168
+ {
1169
+ scope . Failed ( e ) ;
1170
+ throw ;
1171
+ }
1172
+ }
1173
+
1174
+ return PageableHelpers . CreateEnumerable ( FirstPageFunc , NextPageFunc ) ;
1175
+ }
1176
+
1177
+ /// <summary>
1178
+ /// Gets a collection of items describing the document classifiers available on this Form Recognizer resource.
1179
+ /// </summary>
1180
+ /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
1181
+ /// <returns>A collection of <see cref="DocumentClassifierDetails"/> items.</returns>
1182
+ /// <remarks>
1183
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1184
+ /// </remarks>
1185
+ public virtual AsyncPageable < DocumentClassifierDetails > GetDocumentClassifiersAsync ( CancellationToken cancellationToken = default )
1186
+ {
1187
+ async Task < Page < DocumentClassifierDetails > > FirstPageFunc ( int ? pageSizeHint )
1188
+ {
1189
+ using DiagnosticScope scope = Diagnostics . CreateScope ( $ "{ nameof ( DocumentModelAdministrationClient ) } .{ nameof ( GetDocumentClassifiers ) } ") ;
1190
+ scope . Start ( ) ;
1191
+
1192
+ try
1193
+ {
1194
+ Response < GetDocumentClassifiersResponse > response = await ServiceClient . DocumentClassifiersListClassifiersAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
1195
+ return Page . FromValues ( response . Value . Value , response . Value . NextLink ? . AbsoluteUri , response . GetRawResponse ( ) ) ;
1196
+ }
1197
+ catch ( Exception e )
1198
+ {
1199
+ scope . Failed ( e ) ;
1200
+ throw ;
1201
+ }
1202
+ }
1203
+
1204
+ async Task < Page < DocumentClassifierDetails > > NextPageFunc ( string nextLink , int ? pageSizeHint )
1205
+ {
1206
+ using DiagnosticScope scope = Diagnostics . CreateScope ( $ "{ nameof ( DocumentModelAdministrationClient ) } .{ nameof ( GetDocumentClassifiers ) } ") ;
1207
+ scope . Start ( ) ;
1208
+
1209
+ try
1210
+ {
1211
+ Response < GetDocumentClassifiersResponse > response = await ServiceClient . DocumentClassifiersListClassifiersNextPageAsync ( nextLink , cancellationToken ) . ConfigureAwait ( false ) ;
1212
+ return Page . FromValues ( response . Value . Value , response . Value . NextLink ? . AbsoluteUri , response . GetRawResponse ( ) ) ;
1213
+ }
1214
+ catch ( Exception e )
1215
+ {
1216
+ scope . Failed ( e ) ;
1217
+ throw ;
1218
+ }
1219
+ }
1220
+
1221
+ return PageableHelpers . CreateAsyncEnumerable ( FirstPageFunc , NextPageFunc ) ;
1222
+ }
1223
+
1066
1224
/// <summary>
1067
1225
/// Deletes the document classifier with the specified classifier ID.
1068
1226
/// </summary>
1069
1227
/// <param name="classifierId">The ID of the document classifier to delete.</param>
1070
1228
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
1071
1229
/// <returns>A <see cref="Response"/> representing the result of the operation.</returns>
1230
+ /// <remarks>
1231
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1232
+ /// </remarks>
1072
1233
public virtual Response DeleteDocumentClassifier ( string classifierId , CancellationToken cancellationToken = default )
1073
1234
{
1074
1235
Argument . AssertNotNullOrEmpty ( classifierId , nameof ( classifierId ) ) ;
@@ -1093,6 +1254,9 @@ public virtual Response DeleteDocumentClassifier(string classifierId, Cancellati
1093
1254
/// <param name="classifierId">The ID of the document classifier to delete.</param>
1094
1255
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
1095
1256
/// <returns>A <see cref="Response"/> representing the result of the operation.</returns>
1257
+ /// <remarks>
1258
+ /// This method is only available for <see cref="DocumentAnalysisClientOptions.ServiceVersion.V2023_02_28_Preview"/> and newer.
1259
+ /// </remarks>
1096
1260
public virtual async Task < Response > DeleteDocumentClassifierAsync ( string classifierId , CancellationToken cancellationToken = default )
1097
1261
{
1098
1262
Argument . AssertNotNullOrEmpty ( classifierId , nameof ( classifierId ) ) ;
0 commit comments