using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace Octokit
{
///
/// A connection for making API requests against URI endpoints.
/// Provides type-friendly convenience methods that wrap methods.
///
public interface IApiConnection
{
///
/// The underlying connection.
///
IConnection Connection { get; }
///
/// Gets the API resource at the specified URI.
///
/// Type of the API resource to get.
/// URI of the API resource to get
/// The API resource.
/// Thrown when an API error occurs.
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
Task Get(Uri uri);
///
/// Gets the API resource at the specified URI.
///
/// Type of the API resource to get.
/// URI of the API resource to get
/// Parameters to add to the API request
/// The API resource.
/// Thrown when an API error occurs.
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "It's fiiiine. It's fine. Trust us.")]
Task Get(Uri uri, IDictionary parameters);
///
/// Gets the API resource at the specified URI.
///
/// Type of the API resource to get.
/// URI of the API resource to get
/// Parameters to add to the API request
/// Accept header to use for the API request
/// The API resource.
/// Thrown when an API error occurs.
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "It's fiiiine. It's fine. Trust us.")]
Task Get(Uri uri, IDictionary parameters, string accepts);
///
/// Gets the HTML content of the API resource at the specified URI.
///
/// URI of the API resource to get
/// Parameters to add to the API request
/// The API resource's HTML content.
/// Thrown when an API error occurs.
Task GetHtml(Uri uri, IDictionary parameters);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// Options for changing the API response
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, ApiOptions options);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// Parameters to add to the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// Accept header to use for the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, string accepts);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// Parameters to add to the API request
/// Options for changing the API response
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters, ApiOptions options);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// Parameters to add to the API request
/// Accept header to use for the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters, string accepts);
///
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
/// URI of the API resource to get
/// Parameters to add to the API request
/// Accept header to use for the API request
/// Options for changing the API response
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters, string accepts, ApiOptions options);
///
/// Creates a new API resource in the list at the specified URI.
///
/// URI endpoint to send request to
/// Representing the received HTTP response
/// Thrown when an API error occurs.
Task Post(Uri uri);
///
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
/// URI endpoint to send request to
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri);
///
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to get
/// Object that describes the new API resource; this will be serialized and used as the request's body
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data);
///
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to get
/// Object that describes the new API resource; this will be serialized and used as the request's body
/// Accept header to use for the API request
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data, string accepts);
///
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to get
/// Object that describes the new API resource; this will be serialized and used as the request's body
/// Accept header to use for the API request
/// Content type of the API request
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data, string accepts, string contentType);
///
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to get
/// Object that describes the new API resource; this will be serialized and used as the request's body
/// Accept header to use for the API request
/// Content type of the API request
/// Two Factor Authentication Code
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data, string accepts, string contentType, string twoFactorAuthenticationCode);
///
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to get
/// Object that describes the new API resource; this will be serialized and used as the request's body
/// Accept header to use for the API request
/// Content type of the API request
/// Timeout for the request
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data, string accepts, string contentType, TimeSpan timeout);
///
/// Creates or replaces the API resource at the specified URI
///
/// URI of the API resource to put
/// A for the request's execution.
Task Put(Uri uri);
///
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to create or replace
/// Object that describes the API resource; this will be serialized and used as the request's body
/// The created API resource.
/// Thrown when an API error occurs.
Task Put(Uri uri, object data);
///
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to create or replace
/// Object that describes the API resource; this will be serialized and used as the request's body
/// The two-factor authentication code in response to the current user's previous challenge
/// The created API resource.
/// Thrown when an API error occurs.
Task Put(Uri uri, object data, string twoFactorAuthenticationCode);
///
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to create or replace
/// Object that describes the API resource; this will be serialized and used as the request's body
/// The two-factor authentication code in response to the current user's previous challenge
/// Accept header to use for the API request
/// The created API resource.
/// Thrown when an API error occurs.
Task Put(Uri uri, object data, string twoFactorAuthenticationCode, string accepts);
///
/// Updates the API resource at the specified URI.
///
/// URI of the API resource to patch
/// A for the request's execution.
Task Patch(Uri uri);
///
/// Updates the API resource at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to update
/// Object that describes the API resource; this will be serialized and used as the request's body
/// The updated API resource.
/// Thrown when an API error occurs.
Task Patch(Uri uri, object data);
///
/// Updates the API resource at the specified URI.
///
/// The API resource's type.
/// URI of the API resource to update
/// Object that describes the API resource; this will be serialized and used as the request's body
/// Accept header to use for the API request
/// The updated API resource.
/// Thrown when an API error occurs.
Task Patch(Uri uri, object data, string accepts);
///
/// Deletes the API object at the specified URI.
///
/// URI of the API resource to delete
/// A for the request's execution.
Task Delete(Uri uri);
///
/// Deletes the API object at the specified URI.
///
/// URI of the API resource to delete
/// Two Factor Code
/// A for the request's execution.
Task Delete(Uri uri, string twoFactorAuthenticationCode);
///
/// Deletes the API object at the specified URI.
///
/// URI of the API resource to delete
/// Object that describes the API resource; this will be serialized and used as the request's body
/// A for the request's execution.
Task Delete(Uri uri, object data);
///
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
///
/// URI endpoint to send request to
/// The object to serialize as the body of the request
/// Specifies accept response media type
/// The returned
Task Delete(Uri uri, object data, string accepts);
///
/// Executes a GET to the API object at the specified URI. This operation is appropriate for
/// API calls which wants to return the redirect URL.
/// It expects the API to respond with a 302 Found.
///
/// URI of the API resource to get
/// The URL returned by the API in the Location header
/// Thrown when an API error occurs, or the API does not respond with a 302 Found
[Obsolete("Octokit's HTTP library now follows redirects by default - this API will be removed in a future release")]
Task GetRedirect(Uri uri);
///
/// Executes a GET to the API object at the specified URI. This operation is appropriate for API calls which
/// queue long running calculations and return a collection of a resource.
/// It expects the API to respond with an initial 202 Accepted, and queries again until a 200 OK is received.
/// It returns an empty collection if it receives a 204 No Content response.
///
/// The API resource's type.
/// URI of the API resource to update
/// A token used to cancel this potentially long running request
/// The updated API resource.
/// Thrown when an API error occurs.
Task> GetQueuedOperation(Uri uri, CancellationToken cancellationToken);
}
}