Add cancellation token support for release assets uploading (#2267)

This commit is contained in:
Kato Stølen
2021-02-21 22:08:30 +01:00
committed by GitHub
parent 9e2618f6d1
commit 4fbbe4ca2c
9 changed files with 139 additions and 51 deletions
+14 -7
View File
@@ -148,18 +148,20 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
/// </summary>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns><seealso cref="HttpStatusCode"/>Representing the received HTTP response</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task Post(Uri uri);
Task Post(Uri uri, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
/// </summary>
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri);
Task<T> Post<T>(Uri uri, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
@@ -167,9 +169,10 @@ namespace Octokit
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI of the API resource to get</param>
/// <param name="data">Object that describes the new API resource; this will be serialized and used as the request's body</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri, object data);
Task<T> Post<T>(Uri uri, object data, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
@@ -178,9 +181,10 @@ namespace Octokit
/// <param name="uri">URI of the API resource to get</param>
/// <param name="data">Object that describes the new API resource; this will be serialized and used as the request's body</param>
/// <param name="accepts">Accept header to use for the API request</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri, object data, string accepts);
Task<T> Post<T>(Uri uri, object data, string accepts, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
@@ -190,9 +194,10 @@ namespace Octokit
/// <param name="data">Object that describes the new API resource; this will be serialized and used as the request's body</param>
/// <param name="accepts">Accept header to use for the API request</param>
/// <param name="contentType">Content type of the API request</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType);
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
@@ -203,9 +208,10 @@ namespace Octokit
/// <param name="accepts">Accept header to use for the API request</param>
/// <param name="contentType">Content type of the API request</param>
/// <param name="twoFactorAuthenticationCode">Two Factor Authentication Code</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, string twoFactorAuthenticationCode);
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, string twoFactorAuthenticationCode, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
@@ -216,9 +222,10 @@ namespace Octokit
/// <param name="accepts">Accept header to use for the API request</param>
/// <param name="contentType">Content type of the API request</param>
/// <param name="timeout">Timeout for the request</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests</param>
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, TimeSpan timeout);
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, TimeSpan timeout, CancellationToken cancellationToken = default);
/// <summary>
/// Creates or replaces the API resource at the specified URI