-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
PageableOperationOfT.cs
49 lines (44 loc) · 2.17 KB
/
PageableOperationOfT.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.ComponentModel;
using System.Threading;
#nullable enable
namespace Azure
{
/// <summary>
/// Represents a pageable long-running operation that exposes the results
/// in either synchronous or asynchronous format.
/// </summary>
/// <typeparam name="T"></typeparam>
#pragma warning disable SA1649 // File name should match first type name
public abstract class PageableOperation<T> : Operation<AsyncPageable<T>> where T : notnull
#pragma warning restore SA1649 // File name should match first type name
{
/// <summary>
/// Gets the final result of the long-running operation asynchronously.
/// </summary>
/// <remarks>
/// This property can be accessed only after the operation completes successfully (HasValue is true).
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public override AsyncPageable<T> Value => GetValuesAsync();
/// <summary>
/// Gets the final result of the long-running operation asynchronously.
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> used for the periodical service calls.</param>
/// <returns>The final result of the long-running operation asynchronously.</returns>
/// <remarks>
/// Operation must complete successfully (HasValue is true) for it to provide values.
/// </remarks>
public abstract AsyncPageable<T> GetValuesAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Gets the final result of the long-running operation synchronously.
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> used for the periodical service calls.</param>
/// <returns>The final result of the long-running operation synchronously.</returns>
/// <remarks>
/// Operation must complete successfully (HasValue is true) for it to provide values.
/// </remarks>
public abstract Pageable<T> GetValues(CancellationToken cancellationToken = default);
}
}