mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-21 14:45:11 +00:00
added new overloads
This commit is contained in:
@@ -21,6 +21,14 @@ namespace Octokit.Reactive
|
||||
/// <returns>A <see cref="IObservable{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
IObservable<RepositoryHook> GetAll(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>
|
||||
IObservable<RepositoryHook> GetAll(int repositoryId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
@@ -31,6 +39,15 @@ namespace Octokit.Reactive
|
||||
/// <returns>A <see cref="IObservable{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
IObservable<RepositoryHook> GetAll(string owner, string name, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</param>
|
||||
/// <param name="options">Options for changing the API response</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>
|
||||
IObservable<RepositoryHook> GetAll(int repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
@@ -42,6 +59,16 @@ namespace Octokit.Reactive
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "This is ok; we're matching HTTP verbs not keyworks")]
|
||||
IObservable<RepositoryHook> Get(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>A <see cref="RepositoryHook"/> representing hook for specified hook id</returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "This is ok; we're matching HTTP verbs not keyworks")]
|
||||
IObservable<RepositoryHook> Get(int repositoryId, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
@@ -52,6 +79,15 @@ namespace Octokit.Reactive
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
IObservable<RepositoryHook> Create(string owner, string name, NewRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
IObservable<RepositoryHook> Create(int repositoryId, NewRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
@@ -63,6 +99,16 @@ namespace Octokit.Reactive
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
IObservable<RepositoryHook> Edit(string owner, string name, int hookId, EditRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
IObservable<RepositoryHook> Edit(int repositoryId, int hookId, EditRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
@@ -75,6 +121,17 @@ namespace Octokit.Reactive
|
||||
/// <returns></returns>
|
||||
IObservable<Unit> Test(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>
|
||||
IObservable<Unit> Test(int repositoryId, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
@@ -85,6 +142,15 @@ namespace Octokit.Reactive
|
||||
/// <returns></returns>
|
||||
IObservable<Unit> Ping(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>
|
||||
IObservable<Unit> Ping(int repositoryId, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
@@ -94,5 +160,14 @@ namespace Octokit.Reactive
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#delete-a-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
IObservable<Unit> Delete(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>
|
||||
IObservable<Unit> Delete(int repositoryId, int hookId);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,17 @@ namespace Octokit.Reactive
|
||||
return GetAll(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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(int repositoryId)
|
||||
{
|
||||
return GetAll(repositoryId, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
@@ -60,6 +71,20 @@ namespace Octokit.Reactive
|
||||
return _connection.GetAndFlattenAllPages<RepositoryHook>(ApiUrls.RepositoryHooks(owner, name), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</param>
|
||||
/// <param name="options">Options for changing the API response</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(int repositoryId, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<RepositoryHook>(ApiUrls.RepositoryHooks(repositoryId), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
@@ -76,6 +101,18 @@ namespace Octokit.Reactive
|
||||
return _client.Get(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>A <see cref="RepositoryHook"/> representing hook for specified hook id</returns>
|
||||
public IObservable<RepositoryHook> Get(int repositoryId, int hookId)
|
||||
{
|
||||
return _client.Get(repositoryId, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
@@ -93,6 +130,20 @@ namespace Octokit.Reactive
|
||||
return _client.Create(owner, name, hook).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
public IObservable<RepositoryHook> Create(int repositoryId, NewRepositoryHook hook)
|
||||
{
|
||||
Ensure.ArgumentNotNull(hook, "hook");
|
||||
|
||||
return _client.Create(repositoryId, hook).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
@@ -111,6 +162,21 @@ namespace Octokit.Reactive
|
||||
return _client.Edit(owner, name, hookId, hook).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
public IObservable<RepositoryHook> Edit(int repositoryId, int hookId, EditRepositoryHook hook)
|
||||
{
|
||||
Ensure.ArgumentNotNull(hook, "hook");
|
||||
|
||||
return _client.Edit(repositoryId, hookId, hook).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
@@ -129,6 +195,20 @@ namespace Octokit.Reactive
|
||||
return _client.Test(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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(int repositoryId, int hookId)
|
||||
{
|
||||
return _client.Test(repositoryId, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
@@ -145,6 +225,18 @@ namespace Octokit.Reactive
|
||||
return _client.Ping(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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(int repositoryId, int hookId)
|
||||
{
|
||||
return _client.Ping(repositoryId, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
@@ -160,5 +252,17 @@ namespace Octokit.Reactive
|
||||
|
||||
return _client.Delete(owner, name, hookId).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's owner</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(int repositoryId, int hookId)
|
||||
{
|
||||
return _client.Delete(repositoryId, hookId).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,14 @@ namespace Octokit
|
||||
/// <returns>A <see cref="IReadOnlyList{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
Task<IReadOnlyList<RepositoryHook>> GetAll(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <returns>A <see cref="IReadOnlyList{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
Task<IReadOnlyList<RepositoryHook>> GetAll(int repositoryId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
@@ -31,6 +39,15 @@ namespace Octokit
|
||||
/// <returns>A <see cref="IReadOnlyList{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
Task<IReadOnlyList<RepositoryHook>> GetAll(string owner, string name, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <returns>A <see cref="IReadOnlyList{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
Task<IReadOnlyList<RepositoryHook>> GetAll(int repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
@@ -42,6 +59,16 @@ namespace Octokit
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "This is ok; we're matching HTTP verbs not keywords")]
|
||||
Task<RepositoryHook> Get(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>A <see cref="RepositoryHook"/> representing hook for specified hook id</returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "This is ok; we're matching HTTP verbs not keywords")]
|
||||
Task<RepositoryHook> Get(int repositoryId, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
@@ -52,6 +79,15 @@ namespace Octokit
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
Task<RepositoryHook> Create(string owner, string name, NewRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
Task<RepositoryHook> Create(int repositoryId, NewRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
@@ -63,6 +99,16 @@ namespace Octokit
|
||||
/// <returns>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
Task<RepositoryHook> Edit(string owner, string name, int hookId, EditRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
Task<RepositoryHook> Edit(int repositoryId, int hookId, EditRepositoryHook hook);
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
@@ -75,6 +121,17 @@ namespace Octokit
|
||||
/// <returns></returns>
|
||||
Task Test(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>
|
||||
Task Test(int repositoryId, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
@@ -85,6 +142,15 @@ namespace Octokit
|
||||
/// <returns></returns>
|
||||
Task Ping(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>
|
||||
Task Ping(int repositoryId, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
@@ -94,5 +160,14 @@ namespace Octokit
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#delete-a-hook">API documentation</a> for more information.</remarks>
|
||||
/// <returns></returns>
|
||||
Task Delete(string owner, string name, int hookId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>
|
||||
Task Delete(int repositoryId, int hookId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,17 @@ namespace Octokit
|
||||
return GetAll(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <returns>A <see cref="IReadOnlyList{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
public Task<IReadOnlyList<RepositoryHook>> GetAll(int repositoryId)
|
||||
{
|
||||
return GetAll(repositoryId, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
@@ -52,6 +63,20 @@ namespace Octokit
|
||||
return ApiConnection.GetAll<RepositoryHook>(ApiUrls.RepositoryHooks(owner, name), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of hooks defined for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#list">API documentation</a> for more information.</remarks>
|
||||
/// <returns>A <see cref="IReadOnlyList{RepositoryHook}"/> of <see cref="RepositoryHook"/>s representing hooks for specified repository</returns>
|
||||
public Task<IReadOnlyList<RepositoryHook>> GetAll(int repositoryId, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return ApiConnection.GetAll<RepositoryHook>(ApiUrls.RepositoryHooks(repositoryId), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
@@ -68,6 +93,18 @@ namespace Octokit
|
||||
return ApiConnection.Get<RepositoryHook>(ApiUrls.RepositoryHookById(owner, name, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single hook by Id
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>A <see cref="RepositoryHook"/> representing hook for specified hook id</returns>
|
||||
public Task<RepositoryHook> Get(int repositoryId, int hookId)
|
||||
{
|
||||
return ApiConnection.Get<RepositoryHook>(ApiUrls.RepositoryHookById(repositoryId, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
@@ -85,6 +122,20 @@ namespace Octokit
|
||||
return ApiConnection.Post<RepositoryHook>(ApiUrls.RepositoryHooks(owner, name), hook.ToRequest());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>A <see cref="RepositoryHook"/> representing created hook for specified repository</returns>
|
||||
public Task<RepositoryHook> Create(int repositoryId, NewRepositoryHook hook)
|
||||
{
|
||||
Ensure.ArgumentNotNull(hook, "hook");
|
||||
|
||||
return ApiConnection.Post<RepositoryHook>(ApiUrls.RepositoryHooks(repositoryId), hook.ToRequest());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
@@ -103,6 +154,21 @@ namespace Octokit
|
||||
return ApiConnection.Patch<RepositoryHook>(ApiUrls.RepositoryHookById(owner, name, hookId), hook);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edits a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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>A <see cref="RepositoryHook"/> representing modified hook for specified repository</returns>
|
||||
public Task<RepositoryHook> Edit(int repositoryId, int hookId, EditRepositoryHook hook)
|
||||
{
|
||||
Ensure.ArgumentNotNull(hook, "hook");
|
||||
|
||||
return ApiConnection.Patch<RepositoryHook>(ApiUrls.RepositoryHookById(repositoryId, hookId), hook);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
@@ -121,6 +187,20 @@ namespace Octokit
|
||||
return ApiConnection.Post(ApiUrls.RepositoryHookTest(owner, name, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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 Task Test(int repositoryId, int hookId)
|
||||
{
|
||||
return ApiConnection.Post(ApiUrls.RepositoryHookTest(repositoryId, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
@@ -137,6 +217,18 @@ namespace Octokit
|
||||
return ApiConnection.Post(ApiUrls.RepositoryHookPing(owner, name, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will trigger a ping event to be sent to the hook.
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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 Task Ping(int repositoryId, int hookId)
|
||||
{
|
||||
return ApiConnection.Post(ApiUrls.RepositoryHookPing(repositoryId, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
@@ -152,5 +244,17 @@ namespace Octokit
|
||||
|
||||
return ApiConnection.Delete(ApiUrls.RepositoryHookById(owner, name, hookId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a hook for a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The repository's ID</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 Task Delete(int repositoryId, int hookId)
|
||||
{
|
||||
return ApiConnection.Delete(ApiUrls.RepositoryHookById(repositoryId, hookId));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user