using System; using System.Collections.Generic; using System.Net; using System.Threading; using System.Threading.Tasks; using Octokit.Internal; namespace Octokit { /// /// A connection for making HTTP requests against URI endpoints. /// public interface IConnection : IApiInfoProvider { /// /// Performs an asynchronous HTTP GET request that expects a containing HTML. /// /// URI endpoint to send request to /// Querystring parameters for the request /// representing the received HTTP response Task> GetHtml(Uri uri, IDictionary parameters); /// /// Performs an asynchronous HTTP GET request. /// Attempts to map the response to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// Querystring parameters for the request /// Specifies accepted response media types. /// representing the received HTTP response [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] Task> Get(Uri uri, IDictionary parameters, string accepts); /// /// Performs an asynchronous HTTP GET request. /// Attempts to map the response to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// Querystring parameters for the request /// Specifies accepted response media types. /// A token used to cancel the Get request /// representing the received HTTP response [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] Task> Get(Uri uri, IDictionary parameters, string accepts, CancellationToken cancellationToken); /// /// Performs an asynchronous HTTP GET request. /// Attempts to map the response to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// Expiration time of the request /// representing the received HTTP response [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] Task> Get(Uri uri, TimeSpan timeout); /// /// Performs an asynchronous HTTP PATCH request. /// /// URI endpoint to send request to /// representing the received HTTP response Task Patch(Uri uri); /// /// Performs an asynchronous HTTP PATCH request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// representing the received HTTP response Task> Patch(Uri uri, object body); /// /// Performs an asynchronous HTTP PATCH request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Specifies accepted response media types. /// representing the received HTTP response Task> Patch(Uri uri, object body, string accepts); /// /// Performs an asynchronous HTTP POST request. /// /// URI endpoint to send request to /// representing the received HTTP response Task Post(Uri uri); /// /// Performs an asynchronous HTTP POST request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// representing the received HTTP response Task> Post(Uri uri); /// /// Performs an asynchronous HTTP POST request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Specifies accepted response media types. /// Specifies the media type of the request body /// representing the received HTTP response Task> Post(Uri uri, object body, string accepts, string contentType); /// /// Performs an asynchronous HTTP POST request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Specifies accepted response media types. /// Specifies the media type of the request body /// Two Factor Authentication Code /// representing the received HTTP response Task> Post(Uri uri, object body, string accepts, string contentType, string twoFactorAuthenticationCode); /// /// Performs an asynchronous HTTP POST request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Specifies accepted response media types. /// Specifies the media type of the request body /// /// representing the received HTTP response Task> Post(Uri uri, object body, string accepts, string contentType, TimeSpan timeout); /// /// Performs an asynchronous HTTP POST request. /// Attempts to map the response body to an object of type /// /// /// We have one case where we need to override the BaseAddress. This overload is for that case. /// https://developer.github.com/v3/oauth/#web-application-flow /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Specifies accepted response media types. /// Specifies the media type of the request body /// Allows overriding the base address for a post. /// representing the received HTTP response Task> Post(Uri uri, object body, string accepts, string contentType, Uri baseAddress); /// /// Performs an asynchronous HTTP PUT request. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The body of the request /// representing the received HTTP response Task> Put(Uri uri, object body); /// /// Performs an asynchronous HTTP PUT request using the provided two factor authentication code. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Two factory authentication code to use /// representing the received HTTP response Task> Put(Uri uri, object body, string twoFactorAuthenticationCode); /// /// Performs an asynchronous HTTP PUT request using the provided two factor authentication code. /// Attempts to map the response body to an object of type /// /// The type to map the response to /// URI endpoint to send request to /// The object to serialize as the body of the request /// Two factory authentication code to use /// Specifies accepted response media types. /// representing the received HTTP response Task> Put(Uri uri, object body, string twoFactorAuthenticationCode, string accepts); /// /// Performs an asynchronous HTTP PUT request that expects an empty response. /// /// URI endpoint to send request to /// The returned Task Put(Uri uri); /// /// Performs an asynchronous HTTP DELETE request that expects an empty response. /// /// URI endpoint to send request to /// The returned Task Delete(Uri uri); /// /// Performs an asynchronous HTTP DELETE request that expects an empty response. /// /// URI endpoint to send request to /// Two Factor Code /// The returned Task Delete(Uri uri, string twoFactorAuthenticationCode); /// /// 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 /// The returned 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); /// /// Base address for the connection. /// Uri BaseAddress { get; } /// /// Gets the used to provide credentials for the connection. /// ICredentialStore CredentialStore { get; } /// /// Gets or sets the credentials used by the connection. /// /// /// You can use this property if you only have a single hard-coded credential. Otherwise, pass in an /// to the constructor. /// Setting this property will change the to use /// the default with just these credentials. /// Credentials Credentials { get; set; } } }