diff --git a/Octokit.Reactive/Clients/ObservableReleasesClient.cs b/Octokit.Reactive/Clients/ObservableReleasesClient.cs new file mode 100644 index 0000000000..6d93161969 --- /dev/null +++ b/Octokit.Reactive/Clients/ObservableReleasesClient.cs @@ -0,0 +1,32 @@ +using System; +using System.Reactive.Threading.Tasks; + +namespace Octokit.Reactive.Clients +{ + public class ObservableReleasesClient : IObservableReleasesClient + { + readonly IReleasesClient _client; + + public ObservableReleasesClient(IReleasesClient client) + { + Ensure.ArgumentNotNull(client, "client"); + + _client = client; + } + + public IObservable> GetAll(string owner, string name) + { + return _client.GetAll(owner, name).ToObservable(); + } + + public IObservable CreateRelease(string owner, string name, ReleaseUpdate data) + { + return _client.CreateRelease(owner, name, data).ToObservable(); + } + + public IObservable UploadAsset(Release release, ReleaseAssetUpload data) + { + return _client.UploadAsset(release, data).ToObservable(); + } + } +} diff --git a/Octokit.Reactive/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs index 374e541d47..eeb032cd04 100644 --- a/Octokit.Reactive/IObservableGitHubClient.cs +++ b/Octokit.Reactive/IObservableGitHubClient.cs @@ -5,7 +5,7 @@ public interface IObservableGitHubClient IObservableAuthorizationsClient Authorization { get; } IObservableAutoCompleteClient AutoComplete { get; } IObservableOrganizationsClient Organization { get; } - IObservableRepositoriesClient Repositories { get; } + IObservableRepositoriesClient Repository { get; } IObservableSshKeysClient SshKey { get; } IObservableUsersClient User { get; } } diff --git a/Octokit.Reactive/IObservableReleasesClient.cs b/Octokit.Reactive/IObservableReleasesClient.cs new file mode 100644 index 0000000000..2df0869b5c --- /dev/null +++ b/Octokit.Reactive/IObservableReleasesClient.cs @@ -0,0 +1,11 @@ +using System; + +namespace Octokit.Reactive +{ + public interface IObservableReleasesClient + { + IObservable> GetAll(string owner, string name); + IObservable CreateRelease(string owner, string name, ReleaseUpdate data); + IObservable UploadAsset(Release release, ReleaseAssetUpload data); + } +} diff --git a/Octokit.Reactive/ObservableGitHubClient.cs b/Octokit.Reactive/ObservableGitHubClient.cs index aa314b5fa7..3ec62733b2 100644 --- a/Octokit.Reactive/ObservableGitHubClient.cs +++ b/Octokit.Reactive/ObservableGitHubClient.cs @@ -11,7 +11,7 @@ public ObservableGitHubClient(IGitHubClient gitHubClient) Authorization = new ObservableAuthorizationsClient(gitHubClient.Authorization); AutoComplete = new ObservableAutoCompleteClient(gitHubClient.AutoComplete); Organization = new ObservableOrganizationsClient(gitHubClient.Organization); - Repositories = new ObservableRepositoriesClient(gitHubClient.Repository); + Repository = new ObservableRepositoriesClient(gitHubClient.Repository); SshKey = new ObservableSshKeysClient(gitHubClient.SshKey); User = new ObservableUsersClient(gitHubClient.User); } @@ -19,7 +19,7 @@ public ObservableGitHubClient(IGitHubClient gitHubClient) public IObservableAuthorizationsClient Authorization { get; private set; } public IObservableAutoCompleteClient AutoComplete { get; private set; } public IObservableOrganizationsClient Organization { get; private set; } - public IObservableRepositoriesClient Repositories { get; private set; } + public IObservableRepositoriesClient Repository { get; private set; } public IObservableSshKeysClient SshKey { get; private set; } public IObservableUsersClient User { get; private set; } } diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index 3bfe44dd8c..e69fbcb0c2 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -85,12 +85,14 @@ + + diff --git a/Octokit.Tests.Integration/ReleasesClientTests.cs b/Octokit.Tests.Integration/ReleasesClientTests.cs index bc660a5154..e5ecfcc1fc 100644 --- a/Octokit.Tests.Integration/ReleasesClientTests.cs +++ b/Octokit.Tests.Integration/ReleasesClientTests.cs @@ -16,7 +16,7 @@ public async Task ReturnsReleases() Credentials = AutomationSettings.Current.GitHubCredentials }; - var releases = await github.Releases.GetAll("git-tfs", "git-tfs"); + var releases = await github.Release.GetAll("git-tfs", "git-tfs"); Assert.True(releases.Count > 5); Assert.True(releases.Any(release => release.TagName == "v0.18.0")); diff --git a/Octokit/GitHubClient.cs b/Octokit/GitHubClient.cs index c63574f1b7..6dc239c80a 100644 --- a/Octokit/GitHubClient.cs +++ b/Octokit/GitHubClient.cs @@ -39,7 +39,7 @@ public GitHubClient(IConnection connection) AutoComplete = new AutoCompleteClient(connection); Organization = new OrganizationsClient(new ApiConnection(connection)); Repository = new RepositoriesClient(new ApiConnection(connection)); - Releases = new ReleasesClient(new ApiConnection(connection)); + Release = new ReleasesClient(new ApiConnection(connection)); User = new UsersClient(new ApiConnection(connection)); SshKey = new SshKeysClient(new ApiConnection(connection)); } @@ -80,7 +80,7 @@ public Uri BaseAddress public IAutoCompleteClient AutoComplete { get; private set; } public IOrganizationsClient Organization { get; private set; } public IRepositoriesClient Repository { get; private set; } - public IReleasesClient Releases { get; private set; } + public IReleasesClient Release { get; private set; } public ISshKeysClient SshKey { get; private set; } public IUsersClient User { get; private set; } } diff --git a/Octokit/IGitHubClient.cs b/Octokit/IGitHubClient.cs index e455e4b95b..c6b0266f84 100644 --- a/Octokit/IGitHubClient.cs +++ b/Octokit/IGitHubClient.cs @@ -10,7 +10,7 @@ public interface IGitHubClient IAutoCompleteClient AutoComplete { get; } IOrganizationsClient Organization { get; } IRepositoriesClient Repository { get; } - IReleasesClient Releases { get; } + IReleasesClient Release { get; } ISshKeysClient SshKey { get; } IUsersClient User { get; } } diff --git a/Octokit/IReleasesClient.cs b/Octokit/IReleasesClient.cs index 5314a5838b..3ecb7c6f43 100644 --- a/Octokit/IReleasesClient.cs +++ b/Octokit/IReleasesClient.cs @@ -10,7 +10,7 @@ public interface IReleasesClient /// /// The owner of the repository. /// The name of the repository. - /// A of . + /// A of . Task> GetAll(string owner, string name); ///