示例#1
0
        /// <summary>
        /// Returns an enumerable that iterates through the names of all files in a bucket.
        /// </summary>
        /// <param name="request">The list of file name request to send.</param>
        /// <param name="cacheTTL">An absolute cache expiration time to live (TTL) relative to now.</param>
        /// <exception cref="AuthenticationException">Thrown when authentication fails.</exception>
        /// <exception cref="ApiException">Thrown when an error occurs during client operation.</exception>
        async Task <IEnumerable <FileItem> > IStorageFiles.GetEnumerableAsync
            (ListFileNamesRequest request, TimeSpan cacheTTL)
        {
            var enumerable = new FileNameEnumerable(_client, _logger, request, cacheTTL, _cancellationToken) as IEnumerable <FileItem>;

            return(await Task.FromResult(enumerable).ConfigureAwait(false));
        }
示例#2
0
 /// <summary>
 /// Returns the first file item that satisfies a specified condition.
 /// </summary>
 /// <param name="request">The list of file name request to send.</param>
 /// <param name="predicate">A function to test each element for a condition.</param>
 /// <param name="cacheTTL">An absolute cache expiration time to live (TTL) relative to now.</param>
 /// <exception cref="InvalidOperationException">No element satisfies the condition in predicate or the source sequence is empty.</exception>
 /// <exception cref="AuthenticationException">Thrown when authentication fails.</exception>
 /// <exception cref="ApiException">Thrown when an error occurs during client operation.</exception>
 async Task <FileItem> IStorageFiles.FirstAsync
     (ListFileNamesRequest request, Func <FileItem, bool> predicate, TimeSpan cacheTTL)
 {
     return(await Task.Run(() =>
     {
         var adapter = new FileNameEnumerable(_client, _logger, request, cacheTTL, _cancellationToken) as IEnumerable <FileItem>;
         return adapter.First(predicate);
     }));
 }