/// <summary> /// Initializes a new instance of the <see cref="ReceiptClient"/>. /// </summary> #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. public ReceiptClient(Uri endpoint, AzureKeyCredential credential, FormRecognizerClientOptions options) #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. { _diagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.AuthorizationHeader)); _operations = new ServiceClient(_diagnostics, _pipeline, endpoint.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="FormRecognizerClient"/>. /// </summary> public FormRecognizerClient(Uri endpoint, AzureKeyCredential credential, FormRecognizerClientOptions options) { var diagnostics = new ClientDiagnostics(options); var pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.AuthorizationHeader)); _serviceClient = new ServiceClient(diagnostics, pipeline, endpoint.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="FormRecognizerClient"/> class. /// </summary> /// <param name="endpoint">The endpoint to use for connecting to the Form Recognizer Azure Cognitive Service.</param> /// <param name="credential">A credential used to authenticate to an Azure Service.</param> /// <param name="options">A set of options to apply when configuring the client.</param> /// <remarks> /// The <paramref name="endpoint"/> URI string can be found in the Azure Portal. /// </remarks> /// <seealso href="https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md#authenticate-a-form-recognizer-client"/> public FormRecognizerClient(Uri endpoint, TokenCredential credential, FormRecognizerClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(options, nameof(options)); Diagnostics = new ClientDiagnostics(options); var pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, Constants.DefaultCognitiveScope)); ServiceClient = new ServiceRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri); }
/// <summary> /// Initializes a new instance of the <see cref="FormRecognizerClient"/> class. /// </summary> /// <param name="endpoint">The endpoint to use for connecting to the Form Recognizer Azure Cognitive Service.</param> /// <param name="credential">A credential used to authenticate to an Azure Service.</param> /// <param name="options">A set of options to apply when configuring the client.</param> /// <remarks> /// Both the <paramref name="endpoint"/> URI string and the <paramref name="credential"/> <c>string</c> key /// can be found in the Azure Portal. /// </remarks> /// <seealso href="https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md#authenticate-a-form-recognizer-client"/> public FormRecognizerClient(Uri endpoint, AzureKeyCredential credential, FormRecognizerClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(options, nameof(options)); Diagnostics = new ClientDiagnostics(options); var pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.AuthorizationHeader)); ServiceClient = new ServiceRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri); }
/// <summary> /// Initializes a new instance of the <see cref="FormRecognizerClient"/> class. /// </summary> /// <param name="endpoint">The endpoint to use for connecting to the Form Recognizer Azure Cognitive Service.</param> /// <param name="credential">A credential used to authenticate to an Azure Service.</param> /// <param name="options">A set of options to apply when configuring the client.</param> /// <remarks> /// Both the <paramref name="endpoint"/> URI <c>string</c> and the <paramref name="credential"/> <c>string</c> key /// can be found in the Azure Portal. /// </remarks> /// <seealso href="https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md#authenticate-a-form-recognizer-client"/> public FormRecognizerClient(Uri endpoint, AzureKeyCredential credential, FormRecognizerClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(options, nameof(options)); _endpoint = endpoint; _credential = credential; _options = options.Clone(); Diagnostics = new ClientDiagnostics(_options); var pipeline = HttpPipelineBuilder.Build(_options, new AzureKeyCredentialPolicy(_credential, Constants.AuthorizationHeader)); ServiceClient = new ServiceClient(Diagnostics, pipeline, _endpoint.ToString()); }