| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.FormRecognizer |
| | 12 | | { |
| | 13 | | using Models; |
| | 14 | | using System.Collections; |
| | 15 | | using System.Collections.Generic; |
| | 16 | | using System.IO; |
| | 17 | | using System.Threading; |
| | 18 | | using System.Threading.Tasks; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Extension methods for FormRecognizerClient. |
| | 22 | | /// </summary> |
| | 23 | | public static partial class FormRecognizerClientExtensions |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Train Model |
| | 27 | | /// </summary> |
| | 28 | | /// <remarks> |
| | 29 | | /// Create and train a custom model. The train request must include a source |
| | 30 | | /// parameter that is either an externally accessible Azure Storage blob |
| | 31 | | /// container Uri (preferably a Shared Access Signature Uri) or valid path to a |
| | 32 | | /// data folder in a locally mounted drive. When local paths are specified, |
| | 33 | | /// they must follow the Linux/Unix path format and be an absolute path rooted |
| | 34 | | /// to the input mount configuration |
| | 35 | | /// setting value e.g., if '{Mounts:Input}' configuration setting value is |
| | 36 | | /// '/input' then a valid source path would be '/input/contosodataset'. All |
| | 37 | | /// data to be trained is expected to be directly under the source folder. |
| | 38 | | /// Subfolders are not supported. Models are trained using documents that are |
| | 39 | | /// of the following content type - 'application/pdf', 'image/jpeg' and |
| | 40 | | /// 'image/png'." |
| | 41 | | /// Other type of content is ignored. |
| | 42 | | /// </remarks> |
| | 43 | | /// <param name='operations'> |
| | 44 | | /// The operations group for this extension method. |
| | 45 | | /// </param> |
| | 46 | | /// <param name='trainRequest'> |
| | 47 | | /// Request object for training. |
| | 48 | | /// </param> |
| | 49 | | /// <param name='cancellationToken'> |
| | 50 | | /// The cancellation token. |
| | 51 | | /// </param> |
| | 52 | | public static async Task<TrainResult> TrainCustomModelAsync(this IFormRecognizerClient operations, TrainRequ |
| | 53 | | { |
| 0 | 54 | | using (var _result = await operations.TrainCustomModelWithHttpMessagesAsync(trainRequest, null, cancella |
| | 55 | | { |
| 0 | 56 | | return _result.Body; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Get Keys |
| | 62 | | /// </summary> |
| | 63 | | /// <remarks> |
| | 64 | | /// Retrieve the keys that were |
| | 65 | | /// extracted during the training of the specified model. |
| | 66 | | /// </remarks> |
| | 67 | | /// <param name='operations'> |
| | 68 | | /// The operations group for this extension method. |
| | 69 | | /// </param> |
| | 70 | | /// <param name='id'> |
| | 71 | | /// Model identifier. |
| | 72 | | /// </param> |
| | 73 | | /// <param name='cancellationToken'> |
| | 74 | | /// The cancellation token. |
| | 75 | | /// </param> |
| | 76 | | public static async Task<KeysResult> GetExtractedKeysAsync(this IFormRecognizerClient operations, System.Gui |
| | 77 | | { |
| 0 | 78 | | using (var _result = await operations.GetExtractedKeysWithHttpMessagesAsync(id, null, cancellationToken) |
| | 79 | | { |
| 0 | 80 | | return _result.Body; |
| | 81 | | } |
| 0 | 82 | | } |
| | 83 | |
|
| | 84 | | /// <summary> |
| | 85 | | /// Get Models |
| | 86 | | /// </summary> |
| | 87 | | /// <remarks> |
| | 88 | | /// Get information about all trained custom models |
| | 89 | | /// </remarks> |
| | 90 | | /// <param name='operations'> |
| | 91 | | /// The operations group for this extension method. |
| | 92 | | /// </param> |
| | 93 | | /// <param name='cancellationToken'> |
| | 94 | | /// The cancellation token. |
| | 95 | | /// </param> |
| | 96 | | public static async Task<ModelsResult> GetCustomModelsAsync(this IFormRecognizerClient operations, Cancellat |
| | 97 | | { |
| 0 | 98 | | using (var _result = await operations.GetCustomModelsWithHttpMessagesAsync(null, cancellationToken).Conf |
| | 99 | | { |
| 0 | 100 | | return _result.Body; |
| | 101 | | } |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> |
| | 105 | | /// Get Model |
| | 106 | | /// </summary> |
| | 107 | | /// <remarks> |
| | 108 | | /// Get information about a model. |
| | 109 | | /// </remarks> |
| | 110 | | /// <param name='operations'> |
| | 111 | | /// The operations group for this extension method. |
| | 112 | | /// </param> |
| | 113 | | /// <param name='id'> |
| | 114 | | /// Model identifier. |
| | 115 | | /// </param> |
| | 116 | | /// <param name='cancellationToken'> |
| | 117 | | /// The cancellation token. |
| | 118 | | /// </param> |
| | 119 | | public static async Task<ModelResult> GetCustomModelAsync(this IFormRecognizerClient operations, System.Guid |
| | 120 | | { |
| 0 | 121 | | using (var _result = await operations.GetCustomModelWithHttpMessagesAsync(id, null, cancellationToken).C |
| | 122 | | { |
| 0 | 123 | | return _result.Body; |
| | 124 | | } |
| 0 | 125 | | } |
| | 126 | |
|
| | 127 | | /// <summary> |
| | 128 | | /// Delete Model |
| | 129 | | /// </summary> |
| | 130 | | /// <remarks> |
| | 131 | | /// Delete model artifacts. |
| | 132 | | /// </remarks> |
| | 133 | | /// <param name='operations'> |
| | 134 | | /// The operations group for this extension method. |
| | 135 | | /// </param> |
| | 136 | | /// <param name='id'> |
| | 137 | | /// The identifier of the model to delete. |
| | 138 | | /// </param> |
| | 139 | | /// <param name='cancellationToken'> |
| | 140 | | /// The cancellation token. |
| | 141 | | /// </param> |
| | 142 | | public static async Task DeleteCustomModelAsync(this IFormRecognizerClient operations, System.Guid id, Cance |
| | 143 | | { |
| 0 | 144 | | (await operations.DeleteCustomModelWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(fal |
| 0 | 145 | | } |
| | 146 | |
|
| | 147 | | /// <summary> |
| | 148 | | /// Analyze Form |
| | 149 | | /// </summary> |
| | 150 | | /// <remarks> |
| | 151 | | /// Extract key-value pairs from a given document. The input document must be |
| | 152 | | /// of one of the supported content types - 'application/pdf', 'image/jpeg' or |
| | 153 | | /// 'image/png'. A success response is returned in JSON. |
| | 154 | | /// </remarks> |
| | 155 | | /// <param name='operations'> |
| | 156 | | /// The operations group for this extension method. |
| | 157 | | /// </param> |
| | 158 | | /// <param name='id'> |
| | 159 | | /// Model Identifier to analyze the document with. |
| | 160 | | /// </param> |
| | 161 | | /// <param name='formStream'> |
| | 162 | | /// A pdf document or image (jpg,png) file to analyze. |
| | 163 | | /// </param> |
| | 164 | | /// <param name='keys'> |
| | 165 | | /// An optional list of known keys to extract the values for. |
| | 166 | | /// </param> |
| | 167 | | /// <param name='cancellationToken'> |
| | 168 | | /// The cancellation token. |
| | 169 | | /// </param> |
| | 170 | | public static async Task<AnalyzeResult> AnalyzeWithCustomModelAsync(this IFormRecognizerClient operations, S |
| | 171 | | { |
| 0 | 172 | | using (var _result = await operations.AnalyzeWithCustomModelWithHttpMessagesAsync(id, formStream, keys, |
| | 173 | | { |
| 0 | 174 | | return _result.Body; |
| | 175 | | } |
| 0 | 176 | | } |
| | 177 | |
|
| | 178 | | /// <summary> |
| | 179 | | /// Batch Read Receipt operation. The response contains a field called |
| | 180 | | /// 'Operation-Location', which contains the URL that you must use for your |
| | 181 | | /// 'Get Read Receipt Result' operation. |
| | 182 | | /// </summary> |
| | 183 | | /// <param name='operations'> |
| | 184 | | /// The operations group for this extension method. |
| | 185 | | /// </param> |
| | 186 | | /// <param name='url'> |
| | 187 | | /// Publicly reachable URL of an image. |
| | 188 | | /// </param> |
| | 189 | | /// <param name='cancellationToken'> |
| | 190 | | /// The cancellation token. |
| | 191 | | /// </param> |
| | 192 | | public static async Task<BatchReadReceiptHeaders> BatchReadReceiptAsync(this IFormRecognizerClient operation |
| | 193 | | { |
| 0 | 194 | | using (var _result = await operations.BatchReadReceiptWithHttpMessagesAsync(url, null, cancellationToken |
| | 195 | | { |
| 0 | 196 | | return _result.Headers; |
| | 197 | | } |
| 0 | 198 | | } |
| | 199 | |
|
| | 200 | | /// <summary> |
| | 201 | | /// This interface is used for getting the analysis results of a 'Batch Read |
| | 202 | | /// Receipt' operation. The URL to this interface should be retrieved from the |
| | 203 | | /// 'Operation-Location' field returned from the 'Batch Read Receipt' |
| | 204 | | /// operation. |
| | 205 | | /// </summary> |
| | 206 | | /// <param name='operations'> |
| | 207 | | /// The operations group for this extension method. |
| | 208 | | /// </param> |
| | 209 | | /// <param name='operationId'> |
| | 210 | | /// Id of read operation returned in the response of a 'Batch Read Receipt' |
| | 211 | | /// operation. |
| | 212 | | /// </param> |
| | 213 | | /// <param name='cancellationToken'> |
| | 214 | | /// The cancellation token. |
| | 215 | | /// </param> |
| | 216 | | public static async Task<ReadReceiptResult> GetReadReceiptResultAsync(this IFormRecognizerClient operations, |
| | 217 | | { |
| 0 | 218 | | using (var _result = await operations.GetReadReceiptResultWithHttpMessagesAsync(operationId, null, cance |
| | 219 | | { |
| 0 | 220 | | return _result.Body; |
| | 221 | | } |
| 0 | 222 | | } |
| | 223 | |
|
| | 224 | | /// <summary> |
| | 225 | | /// Read Receipt operation. When you use the 'Batch Read Receipt' interface, |
| | 226 | | /// the response contains a field called 'Operation-Location'. The |
| | 227 | | /// 'Operation-Location' field contains the URL that you must use for your 'Get |
| | 228 | | /// Read Receipt Result' operation. |
| | 229 | | /// </summary> |
| | 230 | | /// <param name='operations'> |
| | 231 | | /// The operations group for this extension method. |
| | 232 | | /// </param> |
| | 233 | | /// <param name='image'> |
| | 234 | | /// An image stream. |
| | 235 | | /// </param> |
| | 236 | | /// <param name='cancellationToken'> |
| | 237 | | /// The cancellation token. |
| | 238 | | /// </param> |
| | 239 | | public static async Task<BatchReadReceiptInStreamHeaders> BatchReadReceiptInStreamAsync(this IFormRecognizer |
| | 240 | | { |
| 0 | 241 | | using (var _result = await operations.BatchReadReceiptInStreamWithHttpMessagesAsync(image, null, cancell |
| | 242 | | { |
| 0 | 243 | | return _result.Headers; |
| | 244 | | } |
| 0 | 245 | | } |
| | 246 | |
|
| | 247 | | } |
| | 248 | | } |