From 223363a03adfc810f4c9d353b94c60ab148281d5 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Fri, 10 Jun 2016 16:08:15 +0700 Subject: [PATCH] added new overloads --- .../IObservableRepositoryHooksClient.cs | 75 +++++++++++++ .../ObservableRepositoryHooksClient.cs | 106 +++++++++++++++++- Octokit/Clients/IRepositoryHooksClient.cs | 75 +++++++++++++ Octokit/Clients/RepositoryHooksClient.cs | 104 +++++++++++++++++ 4 files changed, 359 insertions(+), 1 deletion(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs index e68ce767..3ba9e7be 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs @@ -21,6 +21,14 @@ namespace Octokit.Reactive /// A of s representing hooks for specified repository IObservable GetAll(string owner, string name); + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's ID + /// See API documentation for more information. + /// A of s representing hooks for specified repository + IObservable GetAll(int repositoryId); + /// /// Gets the list of hooks defined for a repository /// @@ -30,6 +38,15 @@ namespace Octokit.Reactive /// See API documentation for more information. /// A of s representing hooks for specified repository IObservable GetAll(string owner, string name, ApiOptions options); + + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's owner + /// Options for changing the API response + /// See API documentation for more information. + /// A of s representing hooks for specified repository + IObservable GetAll(int repositoryId, ApiOptions options); /// /// Gets a single hook by Id @@ -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 Get(string owner, string name, int hookId); + /// + /// Gets a single hook by Id + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation for more information. + /// A representing hook for specified hook id + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "This is ok; we're matching HTTP verbs not keyworks")] + IObservable Get(int repositoryId, int hookId); + /// /// Creates a hook for a repository /// @@ -52,6 +79,15 @@ namespace Octokit.Reactive /// A representing created hook for specified repository IObservable Create(string owner, string name, NewRepositoryHook hook); + /// + /// Creates a hook for a repository + /// + /// The repository's owner + /// The hook's parameters + /// See API documentation for more information. + /// A representing created hook for specified repository + IObservable Create(int repositoryId, NewRepositoryHook hook); + /// /// Edits a hook for a repository /// @@ -63,6 +99,16 @@ namespace Octokit.Reactive /// A representing modified hook for specified repository IObservable Edit(string owner, string name, int hookId, EditRepositoryHook hook); + /// + /// Edits a hook for a repository + /// + /// The repository's owner + /// The repository's hook id + /// The requested changes to an edit repository hook + /// See API documentation for more information. + /// A representing modified hook for specified repository + IObservable Edit(int repositoryId, int hookId, EditRepositoryHook hook); + /// /// Tests a hook for a repository /// @@ -75,6 +121,17 @@ namespace Octokit.Reactive /// IObservable Test(string owner, string name, int hookId); + /// + /// Tests a hook for a repository + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation 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. + /// + IObservable Test(int repositoryId, int hookId); + /// /// This will trigger a ping event to be sent to the hook. /// @@ -85,6 +142,15 @@ namespace Octokit.Reactive /// IObservable Ping(string owner, string name, int hookId); + /// + /// This will trigger a ping event to be sent to the hook. + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation for more information. + /// + IObservable Ping(int repositoryId, int hookId); + /// /// Deletes a hook for a repository /// @@ -94,5 +160,14 @@ namespace Octokit.Reactive /// See API documentation for more information. /// IObservable Delete(string owner, string name, int hookId); + + /// + /// Deletes a hook for a repository + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation for more information. + /// + IObservable Delete(int repositoryId, int hookId); } } \ No newline at end of file diff --git a/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs index 78585ce1..42338366 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs @@ -43,6 +43,17 @@ namespace Octokit.Reactive return GetAll(owner, name, ApiOptions.None); } + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's ID + /// See API documentation for more information. + /// A of s representing hooks for specified repository + public IObservable GetAll(int repositoryId) + { + return GetAll(repositoryId, ApiOptions.None); + } + /// /// Gets the list of hooks defined for a repository /// @@ -60,6 +71,20 @@ namespace Octokit.Reactive return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryHooks(owner, name), options); } + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's owner + /// Options for changing the API response + /// See API documentation for more information. + /// A of s representing hooks for specified repository + public IObservable GetAll(int repositoryId, ApiOptions options) + { + Ensure.ArgumentNotNull(options, "options"); + + return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryHooks(repositoryId), options); + } + /// /// Gets a single hook by Id /// @@ -76,6 +101,18 @@ namespace Octokit.Reactive return _client.Get(owner, name, hookId).ToObservable(); } + /// + /// Gets a single hook by Id + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation for more information. + /// A representing hook for specified hook id + public IObservable Get(int repositoryId, int hookId) + { + return _client.Get(repositoryId, hookId).ToObservable(); + } + /// /// Creates a hook for a repository /// @@ -93,6 +130,20 @@ namespace Octokit.Reactive return _client.Create(owner, name, hook).ToObservable(); } + /// + /// Creates a hook for a repository + /// + /// The repository's owner + /// The hook's parameters + /// See API documentation for more information. + /// A representing created hook for specified repository + public IObservable Create(int repositoryId, NewRepositoryHook hook) + { + Ensure.ArgumentNotNull(hook, "hook"); + + return _client.Create(repositoryId, hook).ToObservable(); + } + /// /// Edits a hook for a repository /// @@ -111,6 +162,21 @@ namespace Octokit.Reactive return _client.Edit(owner, name, hookId, hook).ToObservable(); } + /// + /// Edits a hook for a repository + /// + /// The repository's owner + /// The repository's hook id + /// The requested changes to an edit repository hook + /// See API documentation for more information. + /// A representing modified hook for specified repository + public IObservable Edit(int repositoryId, int hookId, EditRepositoryHook hook) + { + Ensure.ArgumentNotNull(hook, "hook"); + + return _client.Edit(repositoryId, hookId, hook).ToObservable(); + } + /// /// Tests a hook for a repository /// @@ -129,6 +195,20 @@ namespace Octokit.Reactive return _client.Test(owner, name, hookId).ToObservable(); } + /// + /// Tests a hook for a repository + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation 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. + /// + public IObservable Test(int repositoryId, int hookId) + { + return _client.Test(repositoryId, hookId).ToObservable(); + } + /// /// This will trigger a ping event to be sent to the hook. /// @@ -145,6 +225,18 @@ namespace Octokit.Reactive return _client.Ping(owner, name, hookId).ToObservable(); } + /// + /// This will trigger a ping event to be sent to the hook. + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation for more information. + /// + public IObservable Ping(int repositoryId, int hookId) + { + return _client.Ping(repositoryId, hookId).ToObservable(); + } + /// /// Deletes a hook for a repository /// @@ -160,5 +252,17 @@ namespace Octokit.Reactive return _client.Delete(owner, name, hookId).ToObservable(); } + + /// + /// Deletes a hook for a repository + /// + /// The repository's owner + /// The repository's hook id + /// See API documentation for more information. + /// + public IObservable Delete(int repositoryId, int hookId) + { + return _client.Delete(repositoryId, hookId).ToObservable(); + } } -} +} \ No newline at end of file diff --git a/Octokit/Clients/IRepositoryHooksClient.cs b/Octokit/Clients/IRepositoryHooksClient.cs index 039406f1..6a947742 100644 --- a/Octokit/Clients/IRepositoryHooksClient.cs +++ b/Octokit/Clients/IRepositoryHooksClient.cs @@ -20,6 +20,14 @@ namespace Octokit /// See API documentation for more information. /// A of s representing hooks for specified repository Task> GetAll(string owner, string name); + + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's ID + /// See API documentation for more information. + /// A of s representing hooks for specified repository + Task> GetAll(int repositoryId); /// /// Gets the list of hooks defined for a repository @@ -31,6 +39,15 @@ namespace Octokit /// A of s representing hooks for specified repository Task> GetAll(string owner, string name, ApiOptions options); + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's ID + /// Options for changing the API response + /// See API documentation for more information. + /// A of s representing hooks for specified repository + Task> GetAll(int repositoryId, ApiOptions options); + /// /// Gets a single hook by Id /// @@ -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 Get(string owner, string name, int hookId); + /// + /// Gets a single hook by Id + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation for more information. + /// A representing hook for specified hook id + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "This is ok; we're matching HTTP verbs not keywords")] + Task Get(int repositoryId, int hookId); + /// /// Creates a hook for a repository /// @@ -52,6 +79,15 @@ namespace Octokit /// A representing created hook for specified repository Task Create(string owner, string name, NewRepositoryHook hook); + /// + /// Creates a hook for a repository + /// + /// The repository's ID + /// The hook's parameters + /// See API documentation for more information. + /// A representing created hook for specified repository + Task Create(int repositoryId, NewRepositoryHook hook); + /// /// Edits a hook for a repository /// @@ -63,6 +99,16 @@ namespace Octokit /// A representing modified hook for specified repository Task Edit(string owner, string name, int hookId, EditRepositoryHook hook); + /// + /// Edits a hook for a repository + /// + /// The repository's ID + /// The repository's hook id + /// The requested changes to an edit repository hook + /// See API documentation for more information. + /// A representing modified hook for specified repository + Task Edit(int repositoryId, int hookId, EditRepositoryHook hook); + /// /// Tests a hook for a repository /// @@ -75,6 +121,17 @@ namespace Octokit /// Task Test(string owner, string name, int hookId); + /// + /// Tests a hook for a repository + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation 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. + /// + Task Test(int repositoryId, int hookId); + /// /// This will trigger a ping event to be sent to the hook. /// @@ -85,6 +142,15 @@ namespace Octokit /// Task Ping(string owner, string name, int hookId); + /// + /// This will trigger a ping event to be sent to the hook. + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation for more information. + /// + Task Ping(int repositoryId, int hookId); + /// /// Deletes a hook for a repository /// @@ -94,5 +160,14 @@ namespace Octokit /// See API documentation for more information. /// Task Delete(string owner, string name, int hookId); + + /// + /// Deletes a hook for a repository + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation for more information. + /// + Task Delete(int repositoryId, int hookId); } } diff --git a/Octokit/Clients/RepositoryHooksClient.cs b/Octokit/Clients/RepositoryHooksClient.cs index 87a52177..3635ef5d 100644 --- a/Octokit/Clients/RepositoryHooksClient.cs +++ b/Octokit/Clients/RepositoryHooksClient.cs @@ -35,6 +35,17 @@ namespace Octokit return GetAll(owner, name, ApiOptions.None); } + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's ID + /// See API documentation for more information. + /// A of s representing hooks for specified repository + public Task> GetAll(int repositoryId) + { + return GetAll(repositoryId, ApiOptions.None); + } + /// /// Gets the list of hooks defined for a repository /// @@ -52,6 +63,20 @@ namespace Octokit return ApiConnection.GetAll(ApiUrls.RepositoryHooks(owner, name), options); } + /// + /// Gets the list of hooks defined for a repository + /// + /// The repository's ID + /// Options for changing the API response + /// See API documentation for more information. + /// A of s representing hooks for specified repository + public Task> GetAll(int repositoryId, ApiOptions options) + { + Ensure.ArgumentNotNull(options, "options"); + + return ApiConnection.GetAll(ApiUrls.RepositoryHooks(repositoryId), options); + } + /// /// Gets a single hook by Id /// @@ -68,6 +93,18 @@ namespace Octokit return ApiConnection.Get(ApiUrls.RepositoryHookById(owner, name, hookId)); } + /// + /// Gets a single hook by Id + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation for more information. + /// A representing hook for specified hook id + public Task Get(int repositoryId, int hookId) + { + return ApiConnection.Get(ApiUrls.RepositoryHookById(repositoryId, hookId)); + } + /// /// Creates a hook for a repository /// @@ -85,6 +122,20 @@ namespace Octokit return ApiConnection.Post(ApiUrls.RepositoryHooks(owner, name), hook.ToRequest()); } + /// + /// Creates a hook for a repository + /// + /// The repository's ID + /// The hook's parameters + /// See API documentation for more information. + /// A representing created hook for specified repository + public Task Create(int repositoryId, NewRepositoryHook hook) + { + Ensure.ArgumentNotNull(hook, "hook"); + + return ApiConnection.Post(ApiUrls.RepositoryHooks(repositoryId), hook.ToRequest()); + } + /// /// Edits a hook for a repository /// @@ -103,6 +154,21 @@ namespace Octokit return ApiConnection.Patch(ApiUrls.RepositoryHookById(owner, name, hookId), hook); } + /// + /// Edits a hook for a repository + /// + /// The repository's ID + /// The repository's hook id + /// The requested changes to an edit repository hook + /// See API documentation for more information. + /// A representing modified hook for specified repository + public Task Edit(int repositoryId, int hookId, EditRepositoryHook hook) + { + Ensure.ArgumentNotNull(hook, "hook"); + + return ApiConnection.Patch(ApiUrls.RepositoryHookById(repositoryId, hookId), hook); + } + /// /// Tests a hook for a repository /// @@ -121,6 +187,20 @@ namespace Octokit return ApiConnection.Post(ApiUrls.RepositoryHookTest(owner, name, hookId)); } + /// + /// Tests a hook for a repository + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation 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. + /// + public Task Test(int repositoryId, int hookId) + { + return ApiConnection.Post(ApiUrls.RepositoryHookTest(repositoryId, hookId)); + } + /// /// This will trigger a ping event to be sent to the hook. /// @@ -137,6 +217,18 @@ namespace Octokit return ApiConnection.Post(ApiUrls.RepositoryHookPing(owner, name, hookId)); } + /// + /// This will trigger a ping event to be sent to the hook. + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation for more information. + /// + public Task Ping(int repositoryId, int hookId) + { + return ApiConnection.Post(ApiUrls.RepositoryHookPing(repositoryId, hookId)); + } + /// /// Deletes a hook for a repository /// @@ -152,5 +244,17 @@ namespace Octokit return ApiConnection.Delete(ApiUrls.RepositoryHookById(owner, name, hookId)); } + + /// + /// Deletes a hook for a repository + /// + /// The repository's ID + /// The repository's hook id + /// See API documentation for more information. + /// + public Task Delete(int repositoryId, int hookId) + { + return ApiConnection.Delete(ApiUrls.RepositoryHookById(repositoryId, hookId)); + } } } \ No newline at end of file