/// <summary> /// Get the status results for all submitted translation operations. /// </summary> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual Pageable <TranslationStatusResult> GetTranslations(CancellationToken cancellationToken = default) { Page <TranslationStatusResult> FirstPageFunc(int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(DocumentTranslationClient)}.{nameof(GetTranslations)}"); scope.Start(); try { ResponseWithHeaders <BatchStatusResponse, DocumentTranslationGetOperationsHeaders> response = _serviceRestClient.GetOperations(cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <TranslationStatusResult> NextPageFunc(string nextLink, int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(DocumentTranslationClient)}.{nameof(GetTranslations)}"); scope.Start(); try { Response <BatchStatusResponse> response = _serviceRestClient.GetOperationsNextPage(nextLink, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }