-
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
stand alone reaction client #1335
Changes from 68 commits
7c99350
3d39207
d90bfdb
9f98916
7c894cd
93ab528
b98a9e9
b30fade
1e7fa47
1a2396b
963b979
aac9d69
180b766
29b6fd3
ad419b3
9139562
14bbf8c
69afe63
3d18af4
9f22e17
06fdace
6bedcf8
6baaa4e
831ff1c
f983bba
6fef1ce
c536b85
10fe3cd
18946fb
c9fdb45
53f61cd
17e6137
eddf602
b5a831c
cd40b03
191451a
dc59d58
2611af5
3a4031f
7e4b42b
28f454a
c4c374c
2ebe0ee
1a974e0
56434f2
65f481f
d7d54c7
9116c57
5fcc30d
7794aaf
d7ca61e
c8be919
07f34b8
bbcfae3
93f9ecb
96cc2d6
2c8e119
df3a7c4
ee2f78f
8944988
9a68de1
eff9ef4
190abff
26348e7
69b1640
ff7bff0
e93ac2d
af28943
c1115f5
4ca64d4
118bc31
988a649
02a13df
8db1c10
ccd9654
ff0c9dd
2107baf
7ad07d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System; | ||
using Octokit; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Octokit.Reactive | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public interface IObservableCommitCommentReactionsClient | ||
{ | ||
/// <summary> | ||
/// Creates a reaction for an specified Commit Comment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an => a |
||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <param name="reaction">The reaction to create </param> | ||
/// <returns></returns> | ||
IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction); | ||
|
||
/// <summary> | ||
/// List reactions for a specified Commit Comment | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <returns></returns> | ||
IObservable<Reaction> GetAll(string owner, string name, int number); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public interface IObservableIssueCommentReactionsClient | ||
{ | ||
/// <summary> | ||
/// Creates a reaction for an specified Issue Comment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an => a |
||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <param name="reaction">The reaction to create </param> | ||
/// <returns></returns> | ||
IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction); | ||
|
||
/// <summary> | ||
/// List reactions for a specified Issue Comment | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <returns></returns> | ||
IObservable<Reaction> GetAll(string owner, string name, int number); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public interface IObservableIssueReactionsClient | ||
{ | ||
/// <summary> | ||
/// Creates a reaction for an specified Issue. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an => a |
||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-an-issue</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The issue id</param> | ||
/// <param name="reaction">The reaction to create </param> | ||
/// <returns></returns> | ||
IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction); | ||
|
||
/// <summary> | ||
/// List reactions for an specified Issue. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an => a |
||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The issue id</param> | ||
/// <returns></returns> | ||
IObservable<Reaction> GetAll(string owner, string name, int number); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public interface IObservablePullRequestReviewCommentReactionsClient | ||
{ | ||
/// <summary> | ||
/// Creates a reaction for a specified Pull Request Review Comment. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <param name="reaction">The reaction to create</param> | ||
/// <returns></returns> | ||
IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction); | ||
|
||
/// <summary> | ||
/// Get all reactions for a specified Pull Request Review Comment. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <returns></returns> | ||
IObservable<Reaction> GetAll(string owner, string name, int number); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Reactive; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public interface IObservableReactionsClient | ||
{ | ||
/// <summary> | ||
/// Access GitHub's Reactions API for Commit Comments. | ||
/// </summary> | ||
/// <remarks> | ||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ | ||
/// </remarks> | ||
IObservableCommitCommentReactionsClient CommitComment { get; } | ||
|
||
/// <summary> | ||
/// Access GitHub's Reactions API for Issues. | ||
/// </summary> | ||
/// <remarks> | ||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ | ||
/// </remarks> | ||
IObservableIssueReactionsClient Issue { get; } | ||
|
||
/// <summary> | ||
/// Access GitHub's Reactions API for Issue Comments. | ||
/// </summary> | ||
/// <remarks> | ||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ | ||
/// </remarks> | ||
IObservableIssueCommentReactionsClient IssueComment { get; } | ||
|
||
/// <summary> | ||
/// Access GitHub's Reactions API for Pull Request Review Comments. | ||
/// </summary> | ||
/// <remarks> | ||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ | ||
/// </remarks> | ||
IObservablePullRequestReviewCommentReactionsClient PullRequestReviewComment { get; } | ||
|
||
/// <summary> | ||
/// Delete a reaction. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#delete-a-reaction</remarks> | ||
/// <param name="number">The reaction id</param> | ||
/// <returns></returns> | ||
IObservable<Unit> Delete(int number); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Reactive.Threading.Tasks; | ||
using Octokit.Reactive.Internal; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public class ObservableCommitCommentReactionsClient : IObservableCommitCommentReactionsClient | ||
{ | ||
readonly ICommitCommentReactionsClient _client; | ||
readonly IConnection _connection; | ||
|
||
public ObservableCommitCommentReactionsClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, "client"); | ||
|
||
_client = client.Reaction.CommitComment; | ||
_connection = client.Connection; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a reaction for a specified Commit Comment | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <param name="reaction">The reaction to create</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
Ensure.ArgumentNotNull(reaction, "reaction"); | ||
|
||
return _client.Create(owner, name, number, reaction).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// List reactions for a specified Commit Comment | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> GetAll(string owner, string name, int number) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
|
||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Octokit.Reactive.Internal; | ||
using System; | ||
using System.Reactive.Linq; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public class ObservableIssueCommentReactionsClient : IObservableIssueCommentReactionsClient | ||
{ | ||
readonly IIssueCommentReactionsClient _client; | ||
readonly IConnection _connection; | ||
|
||
public ObservableIssueCommentReactionsClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, "client"); | ||
|
||
_client = client.Reaction.IssueComment; | ||
_connection = client.Connection; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a reaction for an specified Issue Comment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "a |
||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <param name="reaction">The reaction to create </param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
Ensure.ArgumentNotNull(reaction, "reaction"); | ||
|
||
return _client.Create(owner, name, number, reaction).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// List reactions for an specified Issue Comment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an => a |
||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> GetAll(string owner, string name, int number) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
|
||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Octokit.Reactive.Internal; | ||
using System; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public class ObservableIssueReactionsClient : IObservableIssueReactionsClient | ||
{ | ||
readonly IIssueReactionsClient _client; | ||
readonly IConnection _connection; | ||
|
||
public ObservableIssueReactionsClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, "client"); | ||
|
||
_client = client.Reaction.Issue; | ||
_connection = client.Connection; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a reaction for a specified Issue | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-an-issue</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The issue id</param> | ||
/// <param name="reaction">The reaction to create</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
Ensure.ArgumentNotNull(reaction, "reaction"); | ||
|
||
return _client.Create(owner, name, number, reaction).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// List reactions for a specified Issue | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The issue id</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> GetAll(string owner, string name, int number) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
|
||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Octokit.Reactive.Internal; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public class ObservablePullRequestReviewCommentReactionsClient : IObservablePullRequestReviewCommentReactionsClient | ||
{ | ||
readonly IPullRequestReviewCommentReactionsClient _client; | ||
readonly IConnection _connection; | ||
|
||
public ObservablePullRequestReviewCommentReactionsClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, "client"); | ||
|
||
_client = client.Reaction.PullRequestReviewComment; | ||
_connection = client.Connection; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a reaction for a specified Pull Request Review Comment. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <param name="reaction">The reaction to create</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
Ensure.ArgumentNotNull(reaction, "reaction"); | ||
|
||
return _client.Create(owner, name, number, reaction).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// Get all reactions for a specified Pull Request Review Comment. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment</remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <param name="number">The comment id</param> | ||
/// <returns></returns> | ||
public IObservable<Reaction> GetAll(string owner, string name, int number) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); | ||
Ensure.ArgumentNotNullOrEmptyString(name, "name"); | ||
|
||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.PullRequestReviewCommentReaction(owner, name, number), null, AcceptHeaders.ReactionsPreview); | ||
} | ||
} | ||
} |
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.
inadvertent?
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.
I have a strange behavior in visual studio. Vsual Studio tells me that it cannot resolve typ or namespace for types that came from namespace Octokit. But that comes first since yesterday.
So yes, this was inadvertent.