mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 03:01:31 +00:00
Help POST learn about 2fa codes
This commit is contained in:
@@ -142,8 +142,7 @@ namespace Octokit
|
||||
};
|
||||
|
||||
var endpoint = ApiUrls.Authorizations();
|
||||
|
||||
return ApiConnection.Post<ApplicationAuthorization>(endpoint, requestData, twoFactorAuthenticationCode);
|
||||
return ApiConnection.Post<ApplicationAuthorization>(endpoint, requestData, null, null, twoFactorAuthenticationCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -186,6 +186,32 @@ namespace Octokit
|
||||
return response.Body;
|
||||
}
|
||||
|
||||
/// <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 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="contentType">Content type of the API request</param>
|
||||
/// <param name="twoFactorAuthenticationCode">Two Factor Authentication Code</param>
|
||||
/// <returns>The created API resource.</returns>
|
||||
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
|
||||
public async Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, string twoFactorAuthenticationCode)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
Ensure.ArgumentNotNull(data, "data");
|
||||
Ensure.ArgumentNotNull(twoFactorAuthenticationCode, "twoFactorAuthenticationCode");
|
||||
|
||||
var response = await Connection.Post<T>(
|
||||
uri,
|
||||
data,
|
||||
accepts,
|
||||
contentType).ConfigureAwait(false);
|
||||
return response.Body;
|
||||
}
|
||||
|
||||
|
||||
public async Task<T> Post<T>(Uri uri, object data, string accepts, string contentType, TimeSpan timeout)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
|
||||
@@ -192,6 +192,27 @@ namespace Octokit
|
||||
return SendData<T>(uri, HttpMethod.Post, body, accepts, contentType, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP POST request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type to map the response to</typeparam>
|
||||
/// <param name="uri">URI endpoint to send request to</param>
|
||||
/// <param name="body">The object to serialize as the body of the request</param>
|
||||
/// <param name="accepts">Specifies accepted response media types.</param>
|
||||
/// <param name="contentType">Specifies the media type of the request body</param>
|
||||
/// <param name="twoFactorAuthenticationCode">Two Factor Authentication Code</param>
|
||||
/// <returns><seealso cref="IResponse"/> representing the received HTTP response</returns>
|
||||
public Task<IApiResponse<T>> Post<T>(Uri uri, object body, string accepts, string contentType, string twoFactorAuthenticationCode)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
Ensure.ArgumentNotNull(body, "body");
|
||||
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, "twoFactorAuthenticationCode");
|
||||
|
||||
return SendData<T>(uri, HttpMethod.Post, body, accepts, contentType, CancellationToken.None, twoFactorAuthenticationCode);
|
||||
|
||||
}
|
||||
|
||||
public Task<IApiResponse<T>> Post<T>(Uri uri, object body, string accepts, string contentType, TimeSpan timeout)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
|
||||
@@ -114,6 +114,19 @@ namespace Octokit
|
||||
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
|
||||
Task<T> Post<T>(Uri uri, object data, string accepts, string contentType);
|
||||
|
||||
/// <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 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="contentType">Content type of the API request</param>
|
||||
/// <param name="twoFactorAuthenticationCode">Two Factor Authentication Code</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);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new API resource in the list at the specified URI.
|
||||
/// </summary>
|
||||
|
||||
@@ -85,6 +85,19 @@ namespace Octokit
|
||||
/// <returns><seealso cref="IResponse"/> representing the received HTTP response</returns>
|
||||
Task<IApiResponse<T>> Post<T>(Uri uri, object body, string accepts, string contentType);
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP POST request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type to map the response to</typeparam>
|
||||
/// <param name="uri">URI endpoint to send request to</param>
|
||||
/// <param name="body">The object to serialize as the body of the request</param>
|
||||
/// <param name="accepts">Specifies accepted response media types.</param>
|
||||
/// <param name="contentType">Specifies the media type of the request body</param>
|
||||
/// <param name="twoFactorAuthenticationCode">Two Factor Authentication Code</param>
|
||||
/// <returns><seealso cref="IResponse"/> representing the received HTTP response</returns>
|
||||
Task<IApiResponse<T>> Post<T>(Uri uri, object body, string accepts, string contentType, string twoFactorAuthenticationCode);
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP POST request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
|
||||
Reference in New Issue
Block a user