| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Linq; |
| | 5 | | using System.Threading; |
| | 6 | | using System.Threading.Tasks; |
| | 7 | |
|
| | 8 | | namespace Azure.Storage.Files.Shares.Models |
| | 9 | | { |
| | 10 | | internal class GetDirectoryHandlesAsyncCollection : StorageCollectionEnumerator<ShareFileHandle> |
| | 11 | | { |
| | 12 | | private readonly ShareDirectoryClient _client; |
| | 13 | | private readonly bool? _recursive; |
| | 14 | |
|
| 7 | 15 | | public GetDirectoryHandlesAsyncCollection( |
| 7 | 16 | | ShareDirectoryClient client, |
| 7 | 17 | | bool? recursive) |
| | 18 | | { |
| 7 | 19 | | _client = client; |
| 7 | 20 | | _recursive = recursive; |
| 7 | 21 | | } |
| | 22 | |
|
| | 23 | | public override async ValueTask<Page<ShareFileHandle>> GetNextPageAsync( |
| | 24 | | string continuationToken, |
| | 25 | | int? pageSizeHint, |
| | 26 | | bool async, |
| | 27 | | CancellationToken cancellationToken) |
| | 28 | | { |
| 5 | 29 | | Response<StorageHandlesSegment> response = await _client.GetHandlesInternal( |
| 5 | 30 | | continuationToken, |
| 5 | 31 | | pageSizeHint, |
| 5 | 32 | | _recursive, |
| 5 | 33 | | async, |
| 5 | 34 | | cancellationToken).ConfigureAwait(false); |
| | 35 | |
|
| 3 | 36 | | return Page<ShareFileHandle>.FromValues( |
| 3 | 37 | | response.Value.Handles.ToArray(), |
| 3 | 38 | | response.Value.NextMarker, |
| 3 | 39 | | response.GetRawResponse()); |
| 3 | 40 | | } |
| | 41 | | } |
| | 42 | | } |