mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
71 lines
2.8 KiB
C#
71 lines
2.8 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Octokit
|
|
{
|
|
/// <summary>
|
|
/// A client for GitHub's Repository Hooks API
|
|
/// </summary>
|
|
public class RepositoryHooksClient : ApiClient, IRepositoryHooksClient
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new GitHub Repos API client.
|
|
/// </summary>
|
|
/// <param name="apiConnection">An API connection.</param>
|
|
public RepositoryHooksClient(IApiConnection apiConnection) : base(apiConnection)
|
|
{
|
|
}
|
|
|
|
/// <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>
|
|
/// <returns></returns>
|
|
public Task<IReadOnlyList<RepositoryHook>> GetHooks(string owner, string repositoryName)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
|
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
|
|
|
return ApiConnection.GetAll<RepositoryHook>(ApiUrls.RepositoryHooks(owner, repositoryName));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a single hook defined for a repository by id
|
|
/// </summary>
|
|
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#get-single-hook">API documentation</a> for more information.</remarks>
|
|
/// <returns></returns>
|
|
public Task<RepositoryHook> GetHookById(string owner, string repositoryName, int hookId)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
|
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
|
Ensure.ArgumentNotNull(hookId, "hookId");
|
|
|
|
return ApiConnection.Get<RepositoryHook>(ApiUrls.RepositoryHooksById(owner, repositoryName, hookId));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a hook for a repository
|
|
/// </summary>
|
|
/// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#create-a-hook">API documentation</a> for more information.</remarks>
|
|
/// <returns></returns>
|
|
public Task<RepositoryHook> CreateHook(string owner, string repositoryName, NewRepositoryHook hook)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
public Task<RepositoryHook> EditHook(string owner, string repositoryName, string hookId, EditRepositoryHook hook)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
public Task TestHook(string owner, string repositoryName, string hookId)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
public Task DeleteHook(string owner, string repositoryName, string hookId)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
}
|
|
} |