Accepts parameter for Patch

This commit is contained in:
Nigel Sampson
2014-03-26 22:58:37 +13:00
parent 3be869b8d7
commit 90aa5696a0
4 changed files with 49 additions and 0 deletions
+19
View File
@@ -236,6 +236,25 @@ namespace Octokit
return response.BodyAsObject;
}
/// <summary>
/// Updates the API resource at the specified URI.
/// </summary>
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI of the API resource to update</param>
/// <param name="data">Object that describes the 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>
/// <returns>The updated API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
public async Task<T> Patch<T>(Uri uri, object data, string accepts)
{
Ensure.ArgumentNotNull(uri, "uri");
Ensure.ArgumentNotNull(data, "data");
var response = await Connection.PatchAsync<T>(uri, data, accepts).ConfigureAwait(false);
return response.BodyAsObject;
}
/// <summary>
/// Deletes the API object at the specified URI.
/// </summary>
+8
View File
@@ -177,6 +177,14 @@ namespace Octokit
return SendData<T>(uri, HttpVerb.Patch, body, null, null, CancellationToken.None);
}
public Task<IResponse<T>> PatchAsync<T>(Uri uri, object body, string accepts)
{
Ensure.ArgumentNotNull(uri, "uri");
Ensure.ArgumentNotNull(body, "body");
return SendData<T>(uri, HttpVerb.Patch, body, accepts, null, CancellationToken.None);
}
public Task<IResponse<T>> PostAsync<T>(Uri uri, object body, string accepts, string contentType)
{
Ensure.ArgumentNotNull(uri, "uri");
+11
View File
@@ -139,6 +139,17 @@ namespace Octokit
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Patch<T>(Uri uri, object data);
/// <summary>
/// Updates the API resource at the specified URI.
/// </summary>
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI of the API resource to update</param>
/// <param name="data">Object that describes the 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>
/// <returns>The updated API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Patch<T>(Uri uri, object data, string accepts);
/// <summary>
/// Deletes the API object at the specified URI.
/// </summary>
+11
View File
@@ -53,6 +53,17 @@ namespace Octokit
/// <returns><seealso cref="IResponse"/> representing the received HTTP response</returns>
Task<IResponse<T>> PatchAsync<T>(Uri uri, object body);
/// <summary>
/// Performs an asynchronous HTTP PATCH 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>
/// <returns><seealso cref="IResponse"/> representing the received HTTP response</returns>
Task<IResponse<T>> PatchAsync<T>(Uri uri, object body, string accepts);
/// <summary>
/// Performs an asynchronous HTTP POST request.
/// Attempts to map the response body to an object of type <typeparamref name="T"/>