mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-21 06:35:11 +00:00
modified XML docs
This commit is contained in:
@@ -5,11 +5,21 @@ using Octokit.Reactive.Internal;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Repository Webhooks API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/hooks/">Webhooks API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
public class ObservableRepositoryHooksClient : IObservableRepositoryHooksClient
|
||||
{
|
||||
readonly IRepositoryHooksClient _client;
|
||||
readonly IConnection _connection;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new GitHub Webhooks API client.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
public ObservableRepositoryHooksClient(IGitHubClient client)
|
||||
{
|
||||
Ensure.ArgumentNotNull(client, "client");
|
||||
@@ -21,118 +31,134 @@ namespace Octokit.Reactive
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="repositoryName">The repository's name</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<RepositoryHook> GetAll(string owner, string repositoryName)
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <returns>A <see cref="IObservable{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
public IObservable<RepositoryHook> GetAll(string owner, string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return GetAll(owner, repositoryName, ApiOptions.None);
|
||||
return GetAll(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="repositoryName">The repository's name</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<RepositoryHook> GetAll(string owner, string repositoryName, ApiOptions options)
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <returns>A <see cref="IObservable{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
public IObservable<RepositoryHook> GetAll(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<RepositoryHook>(ApiUrls.RepositoryHooks(owner, repositoryName), options);
|
||||
return _connection.GetAndFlattenAllPages<RepositoryHook>(ApiUrls.RepositoryHooks(owner, name), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook defined for a repository by id
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="hookId">The repository's hook id</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#get-single-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
public IObservable<RepositoryHook> Get(string owner, string repositoryName, int hookId)
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing hook for specified hook id</returns>
|
||||
public IObservable<RepositoryHook> Get(string owner, string name, int hookId)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _client.Get(owner, repositoryName, hookId).ToObservable();
|
||||
return _client.Get(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="hook">The hook's parameters</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#create-a-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
public IObservable<RepositoryHook> Create(string owner, string repositoryName, NewRepositoryHook hook)
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
public IObservable<RepositoryHook> Create(string owner, string name, NewRepositoryHook hook)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(hook, "hook");
|
||||
|
||||
return _client.Create(owner, repositoryName, hook).ToObservable();
|
||||
return _client.Create(owner, name, hook).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="hookId">The repository's hook id</param>
|
||||
/// <param name="hook">The requested changes to an edit repository hook</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#edit-a-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
public IObservable<RepositoryHook> Edit(string owner, string repositoryName, int hookId, EditRepositoryHook hook)
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
public IObservable<RepositoryHook> Edit(string owner, string name, int hookId, EditRepositoryHook hook)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(hook, "hook");
|
||||
|
||||
return _client.Edit(owner, repositoryName, hookId, hook).ToObservable();
|
||||
return _client.Edit(owner, name, hookId, hook).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="hookId">The repository's hook id</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#test-a-hook">API documentation</a> for more information.
|
||||
/// This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook
|
||||
/// is not subscribed to push events, the server will respond with 204 but no test POST will be generated.</remarks>
|
||||
/// <returns></returns>
|
||||
public IObservable<Unit> Test(string owner, string repositoryName, int hookId)
|
||||
public IObservable<Unit> Test(string owner, string name, int hookId)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _client.Test(owner, repositoryName, hookId).ToObservable();
|
||||
return _client.Test(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="hookId">The repository's hook id</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#edit-a-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
public IObservable<Unit> Ping(string owner, string repositoryName, int hookId)
|
||||
public IObservable<Unit> Ping(string owner, string name, int hookId)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _client.Ping(owner, repositoryName, hookId).ToObservable();
|
||||
return _client.Ping(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="repositoryName"></param>
|
||||
/// <param name="hookId"></param>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="hookId">The repository's hook id</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#delete-a-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
public IObservable<Unit> Delete(string owner, string repositoryName, int hookId)
|
||||
public IObservable<Unit> Delete(string owner, string name, int hookId)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _client.Delete(owner, repositoryName, hookId).ToObservable();
|
||||
return _client.Delete(owner, name, hookId).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user