-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Repository Hooks & Repository Forks #313
Conversation
@@ -98,5 +99,14 @@ public interface IObservableRepositoriesClient | |||
/// that announced this feature. | |||
/// </remarks> | |||
IObservableCommitStatusClient CommitStatus { get; } | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up the excess whitespace here
@AndyCross thanks for starting this one off. One of the design goals we've been aiming for with Octokit is to structure these clients to mirror the Documentation structure (i.e. the sidebar here: http://developer.github.com/v3/) As you can:
I think it's worth extracting this code into a
|
I thought similar; just wanted to make a small change to get started. I'll work on the basis you suggest. |
I've refactored to a RepositoryClient.Hooks approach; I've also implemented GetHookById and will be adding in other methods (currently throwing NotImplementedException from the client). Can you feedback on the approach to the RepositoryClient.Hooks while I implement the others? |
…rated out - there doesn't need to be this duplicitous 'clarity' given the classes are now separate
I have added further method implementations; I have a concern around the TEST method which requires a 0 byte body to be sent it seems; I've implemented this with an empty stub class as the Post body, which works in my production environment but please do review the implementation in terms of style. |
@@ -17,6 +18,8 @@ public ObservableRepositoriesClient(IGitHubClient client) | |||
_client = client.Repository; | |||
_connection = client.Connection; | |||
CommitStatus = new ObservableCommitStatusClient(client); | |||
var apiConnection = new ApiConnection(_connection); | |||
_hooks = new Lazy<IRepositoryHooksClient>( () => new RepositoryHooksClient(apiConnection)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any benefits to using Lazy<T>
here over just new
-ing it up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very marginal given how lightweight that ctor is; I was following an example from a Readme method on RepoClient; but that is much more heavyweight. Happy to take your lead and refactor if req.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one?
htmlContent = new Lazy<Task<string>>(async () => await client.GetHtml(HtmlUrl).ConfigureAwait(false)); |
That's an edge case because we don't want to do the rendering until as late as possible. Let's keep it simple for the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll pull out the lazy loading. Agreed on simplicity.
-----Original Message-----
From: "Brendan Forster" notifications@github.com
Sent: 20/01/2014 19:08
To: "octokit/octokit.net" octokit.net@noreply.github.com
Cc: "Andy Cross" andy@elastacloud.com
Subject: Re: [octokit.net] Implement Repository Hooks (#313)
In Octokit.Reactive/Clients/ObservableRepositoriesClient.cs:
@@ -17,6 +18,8 @@ public ObservableRepositoriesClient(IGitHubClient client)
_client = client.Repository;
_connection = client.Connection;
CommitStatus = new ObservableCommitStatusClient(client);
var apiConnection = new ApiConnection(_connection);
This one?_hooks = new Lazy<IRepositoryHooksClient>( () => new RepositoryHooksClient(apiConnection));
htmlContent = new Lazy<Task<string>>(async () => await client.GetHtml(HtmlUrl).ConfigureAwait(false));
That's an edge case because we don't want to do the rendering until as late as possible. Let's keep it simple for the moment.
—
Reply to this email directly or view it on GitHub.
[EDIT] added link to relevant issues |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up this unused using
statement
Looks like some files are missing from the |
Any further work required following git add snafu? |
It's looking good. Unfortunately there's been a lot of change in |
I've added a merge in from the upstream master, it pulled in some mono assembly that I had an issue with file copying (linking?) via the csproj, but that has been resolved now. Hopefully this is now merge compatible. |
Hmm, this failed the build. Try running |
@haacked --c597449 fixes it up; the build.cmd now works locally. |
Can I pick this up @AndyCross? I'd like to get this functionality in. |
Sure! Sent from my Windows Phone From: John Du Hartmailto:notifications@github.com Can I pick this up @AndyCrosshttps://github.com/AndyCross? I'd like to get this functionality in. — |
This was picked up by @johnduhart in #495. |
Gets the list of hooks defined for a repository
See http://developer.github.com/v3/repos/hooks && http://developer.github.com/v3/repos/forks/ for more information.
Usage:
var hooks = await authedClient.Repository.Hooks.Get("owner", "repo");
var forks = await authedClient.Repository.Forks.Get("owner", "repo");
This also includes the RX assembly.
Resolves #336