Пример #1
0
        public virtual Pageable <ProviderInfo> GetTenantProviders(int?top = null, string expand = null, CancellationToken cancellationToken = default)
        {
            Page <ProviderInfo> FirstPageFunc(int?pageSizeHint)
            {
                using var scope0 = _providersClientDiagnostics.CreateScope("Tenant.GetTenantProviders");
                scope0.Start();
                try
                {
                    var response = _providersRestClient.ListAtTenantScope(top, expand, cancellationToken: cancellationToken);
                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope0.Failed(e);
                    throw;
                }
            }

            Page <ProviderInfo> NextPageFunc(string nextLink, int?pageSizeHint)
            {
                using var scope0 = _providersClientDiagnostics.CreateScope("Tenant.GetTenantProviders");
                scope0.Start();
                try
                {
                    var response = _providersRestClient.ListAtTenantScopeNextPage(nextLink, top, expand, cancellationToken: cancellationToken);
                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope0.Failed(e);
                    throw;
                }
            }

            return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc));
        }