internal static Uri Scan(this Uri @this, ScanOptions scanOptions)
        {
            if (scanOptions == null)
                return @this;

            var parts = new List<string>();

            if (!scanOptions.Next.IsNullOrWhitespace())
                parts.Add($"_next={Uri.EscapeUriString(scanOptions.Next)}");

            if (scanOptions.Limit > 0)
                parts.Add($"_limit={scanOptions.Limit}");

            return parts.Any()
                ? WithQuery(@this, parts)
                : @this;
        }
        public async Task<ScanResponse<File>> ListFilesAsync(string account, string workspace, string bucket,
            ScanOptions scanOptions, bool includeContent, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(account))
                throw new ArgumentNullException(nameof(account));

            if (string.IsNullOrWhiteSpace(workspace))
                throw new ArgumentNullException(nameof(workspace));

            if (string.IsNullOrWhiteSpace(bucket))
                throw new ArgumentNullException(nameof(bucket));

            if (scanOptions == null)
                throw new ArgumentNullException(nameof(scanOptions));

            try
            {
                var path = includeContent
                    ? Routes.Files(account, workspace, bucket, true)
                    : Routes.Files(account, workspace, bucket);
                return await _connector.GetJsonAsync<ScanResponse<File>>(path.Scan(scanOptions), null, cancellationToken)
                    .ConfigureAwait(false);
            }
            catch (ResourceNotFoundException e)
            {
                throw e.With(account, workspace);
            }
        }
 public Task<ScanResponse<File>> ListFilesAsync(string account, string workspace, string bucket,
     ScanOptions scanOptions, CancellationToken cancellationToken)
     => ListFilesAsync(account, workspace, bucket, scanOptions, false, cancellationToken);