| | 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 GetFileHandlesAsyncCollection : StorageCollectionEnumerator<ShareFileHandle> |
| | 11 | | { |
| | 12 | | private readonly ShareFileClient _client; |
| | 13 | |
|
| 6 | 14 | | public GetFileHandlesAsyncCollection( |
| 6 | 15 | | ShareFileClient client) |
| | 16 | | { |
| 6 | 17 | | _client = client; |
| 6 | 18 | | } |
| | 19 | |
|
| | 20 | | public override async ValueTask<Page<ShareFileHandle>> GetNextPageAsync( |
| | 21 | | string continuationToken, |
| | 22 | | int? pageSizeHint, |
| | 23 | | bool async, |
| | 24 | | CancellationToken cancellationToken) |
| | 25 | | { |
| 6 | 26 | | Response<StorageHandlesSegment> response = await _client.GetHandlesInternal( |
| 6 | 27 | | continuationToken, |
| 6 | 28 | | pageSizeHint, |
| 6 | 29 | | async, |
| 6 | 30 | | cancellationToken).ConfigureAwait(false); |
| | 31 | |
|
| 4 | 32 | | return Page<ShareFileHandle>.FromValues( |
| 4 | 33 | | response.Value.Handles.ToArray(), |
| 4 | 34 | | response.Value.NextMarker, |
| 4 | 35 | | response.GetRawResponse()); |
| 4 | 36 | | } |
| | 37 | | } |
| | 38 | | } |