/// <summary> /// Recognizes values from one or more business cards. /// <para>See <a href="https://aka.ms/formrecognizer/businesscardfields"/> for a list of available fields on a business card.</para> /// </summary> /// <param name="businessCard">The stream containing the one or more business cards to recognize values from.</param> /// <param name="recognizeBusinessCardsOptions">A set of options available for configuring the recognize request.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <returns>A <see cref="RecognizeBusinessCardsOperation"/> to wait on this long-running operation. Its <see cref="RecognizeBusinessCardsOperation.Value"/> upon successful /// completion will contain the extracted business cards.</returns> public virtual RecognizeBusinessCardsOperation StartRecognizeBusinessCards(Stream businessCard, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(businessCard, nameof(businessCard)); recognizeBusinessCardsOptions ??= new RecognizeBusinessCardsOptions(); using DiagnosticScope scope = Diagnostics.CreateScope($"{nameof(FormRecognizerClient)}.{nameof(StartRecognizeBusinessCards)}"); scope.Start(); try { FormContentType contentType = recognizeBusinessCardsOptions.ContentType ?? DetectContentType(businessCard, nameof(businessCard)); Response response = ServiceClient.AnalyzeBusinessCardAsync(contentType, businessCard, recognizeBusinessCardsOptions.IncludeFieldElements, recognizeBusinessCardsOptions.Locale, cancellationToken); string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); return(new RecognizeBusinessCardsOperation(ServiceClient, Diagnostics, location)); } catch (Exception e) { scope.Failed(e); throw; } }