/// <summary> /// Starts a translation operation which translates the document(s) in your source container /// to your <see cref="TranslationTarget"/>(s) in the given language. /// <para>For document length limits, maximum batch size, and supported document formats, see /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview"/>.</para> /// </summary> /// <param name="inputs">Sets the inputs for the translation operation /// including source and target containers for documents to be translated. </param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <exception cref="RequestFailedException">Service returned a non-success status code. </exception> public virtual DocumentTranslationOperation StartTranslation(IEnumerable <DocumentTranslationInput> inputs, CancellationToken cancellationToken = default) { var request = new BatchSubmissionRequest(inputs); using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(DocumentTranslationClient)}.{nameof(StartTranslation)}"); scope.Start(); try { ResponseWithHeaders <DocumentTranslationSubmitBatchRequestHeaders> job = _serviceRestClient.SubmitBatchRequest(request, cancellationToken); return(new DocumentTranslationOperation(_serviceRestClient, _clientDiagnostics, job.Headers.OperationLocation)); } catch (Exception e) { scope.Failed(e); throw; } }