diff --git a/Octokit.Reactive/Clients/IObservableReleasesClient.cs b/Octokit.Reactive/Clients/IObservableReleasesClient.cs index 3459e35c..290e0adf 100644 --- a/Octokit.Reactive/Clients/IObservableReleasesClient.cs +++ b/Octokit.Reactive/Clients/IObservableReleasesClient.cs @@ -105,10 +105,9 @@ namespace Octokit.Reactive /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// The specified by the asset id. - IObservable GetAsset(string owner, string name, int releaseId, int assetId); + IObservable GetAsset(string owner, string name, int assetId); /// /// Edits the for the specified release of the specified repository. @@ -118,11 +117,10 @@ namespace Octokit.Reactive /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// Description of the asset with its amended data /// The edited . - IObservable EditAsset(string owner, string name, int releaseId, int assetId, ReleaseAssetUpdate data); + IObservable EditAsset(string owner, string name, int assetId, ReleaseAssetUpdate data); /// /// Deletes the specified from the specified repository diff --git a/Octokit.Reactive/Clients/ObservableFollowersClient.cs b/Octokit.Reactive/Clients/ObservableFollowersClient.cs index cefacb36..e9dadc2e 100644 --- a/Octokit.Reactive/Clients/ObservableFollowersClient.cs +++ b/Octokit.Reactive/Clients/ObservableFollowersClient.cs @@ -28,7 +28,7 @@ namespace Octokit.Reactive /// /// See the API documentation for more information. /// - /// A of s that follow the authenticated user. + /// A of s that follow the authenticated user. public IObservable GetAllForCurrent() { return _connection.GetAndFlattenAllPages(ApiUrls.Followers()); @@ -41,7 +41,7 @@ namespace Octokit.Reactive /// /// See the API documentation for more information. /// - /// A of s that follow the passed user. + /// A of s that follow the passed user. public IObservable GetAll(string login) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); @@ -55,7 +55,7 @@ namespace Octokit.Reactive /// /// See the API documentation for more information. /// - /// A of s that the authenticated user follows. + /// A of s that the authenticated user follows. public IObservable GetFollowingForCurrent() { return _connection.GetAndFlattenAllPages(ApiUrls.Following()); @@ -68,7 +68,7 @@ namespace Octokit.Reactive /// /// See the API documentation for more information. /// - /// A of s that the passed user follows. + /// A of s that the passed user follows. public IObservable GetFollowing(string login) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); diff --git a/Octokit.Reactive/Clients/ObservableReleasesClient.cs b/Octokit.Reactive/Clients/ObservableReleasesClient.cs index e2a52a85..7daf9397 100644 --- a/Octokit.Reactive/Clients/ObservableReleasesClient.cs +++ b/Octokit.Reactive/Clients/ObservableReleasesClient.cs @@ -142,17 +142,15 @@ namespace Octokit.Reactive /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// The specified by the asset id. - public IObservable GetAsset(string owner, string name, int releaseId, int assetId) + public IObservable GetAsset(string owner, string name, int assetId) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - Ensure.ArgumentNotNull(releaseId, "releaseId"); Ensure.ArgumentNotNull(assetId, "assetId"); - return _client.GetAsset(owner, name, releaseId, assetId).ToObservable(); + return _client.GetAsset(owner, name, assetId).ToObservable(); } /// @@ -181,19 +179,17 @@ namespace Octokit.Reactive /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// Description of the asset with its amended data /// The edited . - public IObservable EditAsset(string owner, string name, int releaseId, int assetId, ReleaseAssetUpdate data) + public IObservable EditAsset(string owner, string name, int assetId, ReleaseAssetUpdate data) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - Ensure.ArgumentNotNull(releaseId, "releaseId"); Ensure.ArgumentNotNull(assetId, "assetId"); Ensure.ArgumentNotNull(data, "data"); - return _client.EditAsset(owner, name, releaseId, assetId, data).ToObservable(); + return _client.EditAsset(owner, name, assetId, data).ToObservable(); } /// diff --git a/Octokit.Tests/Clients/ReleasesClientTests.cs b/Octokit.Tests/Clients/ReleasesClientTests.cs index 325becd4..fcee8598 100644 --- a/Octokit.Tests/Clients/ReleasesClientTests.cs +++ b/Octokit.Tests/Clients/ReleasesClientTests.cs @@ -211,7 +211,7 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new ReleasesClient(connection); - client.GetAsset("fake", "repo", 1, 1); + client.GetAsset("fake", "repo", 1); connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/releases/1/assets/1"), null); } @@ -221,10 +221,10 @@ namespace Octokit.Tests.Clients { var client = new ReleasesClient(Substitute.For()); - Assert.Throws(() => client.GetAsset(null, "name", 1, 1)); - Assert.Throws(() => client.GetAsset("", "name", 1, 1)); - Assert.Throws(() => client.GetAsset("owner", null, 1, 1)); - Assert.Throws(() => client.GetAsset("owner", "", 1, 1)); + Assert.Throws(() => client.GetAsset(null, "name", 1)); + Assert.Throws(() => client.GetAsset("", "name", 1)); + Assert.Throws(() => client.GetAsset("owner", null, 1)); + Assert.Throws(() => client.GetAsset("owner", "", 1)); } } @@ -237,9 +237,9 @@ namespace Octokit.Tests.Clients var client = new ReleasesClient(connection); var data = new ReleaseAssetUpdate("asset"); - client.EditAsset("fake", "repo", 1, 1, data); + client.EditAsset("fake", "repo", 1, data); - connection.Received().Patch(Arg.Is(u => u.ToString() == "repos/fake/repo/releases/1/assets/1"), + connection.Received().Patch(Arg.Is(u => u.ToString() == "repos/fake/repo/releases/assets/1"), data); } @@ -248,11 +248,11 @@ namespace Octokit.Tests.Clients { var client = new ReleasesClient(Substitute.For()); - Assert.Throws(() => client.EditAsset(null, "name", 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("", "name", 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("owner", null, 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("owner", "", 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("owner", "name", 1, 1, null)); + Assert.Throws(() => client.EditAsset(null, "name", 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("", "name", 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("owner", null, 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("owner", "", 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("owner", "name", 1, null)); } } diff --git a/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs b/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs index 18702085..ae3e52fd 100644 --- a/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs @@ -1,11 +1,8 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reactive.Linq; -using System.Threading.Tasks; using NSubstitute; using Octokit.Reactive; -using Octokit.Tests.Helpers; using Xunit; namespace Octokit.Tests.Reactive @@ -213,9 +210,9 @@ namespace Octokit.Tests.Reactive var gitHubClient = Substitute.For(); var client = new ObservableReleasesClient(gitHubClient); - client.GetAsset("fake", "repo", 1, 1); + client.GetAsset("fake", "repo", 1); - gitHubClient.Release.Received(1).GetAsset("fake", "repo", 1, 1); + gitHubClient.Release.Received(1).GetAsset("fake", "repo", 1); } [Fact] @@ -223,10 +220,10 @@ namespace Octokit.Tests.Reactive { var client = new ObservableReleasesClient(Substitute.For()); - Assert.Throws(() => client.GetAsset(null, "name", 1, 1)); - Assert.Throws(() => client.GetAsset("", "name", 1, 1)); - Assert.Throws(() => client.GetAsset("owner", null, 1, 1)); - Assert.Throws(() => client.GetAsset("owner", "", 1, 1)); + Assert.Throws(() => client.GetAsset(null, "name", 1)); + Assert.Throws(() => client.GetAsset("", "name", 1)); + Assert.Throws(() => client.GetAsset("owner", null, 1)); + Assert.Throws(() => client.GetAsset("owner", "", 1)); } } @@ -239,9 +236,9 @@ namespace Octokit.Tests.Reactive var client = new ObservableReleasesClient(gitHubClient); var data = new ReleaseAssetUpdate("asset"); - client.EditAsset("fake", "repo", 1, 1, data); + client.EditAsset("fake", "repo", 1, data); - gitHubClient.Release.Received(1).EditAsset("fake", "repo", 1, 1, data); + gitHubClient.Release.Received(1).EditAsset("fake", "repo", 1, data); } [Fact] @@ -249,11 +246,11 @@ namespace Octokit.Tests.Reactive { var client = new ObservableReleasesClient(Substitute.For()); - Assert.Throws(() => client.EditAsset(null, "name", 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("", "name", 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("owner", null, 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("owner", "", 1, 1, new ReleaseAssetUpdate("name"))); - Assert.Throws(() => client.EditAsset("owner", "name", 1, 1, null)); + Assert.Throws(() => client.EditAsset(null, "name", 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("", "name", 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("owner", null, 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("owner", "", 1, new ReleaseAssetUpdate("name"))); + Assert.Throws(() => client.EditAsset("owner", "name", 1, null)); } } diff --git a/Octokit/Clients/IReleasesClient.cs b/Octokit/Clients/IReleasesClient.cs index 48939c11..2aa4cb83 100644 --- a/Octokit/Clients/IReleasesClient.cs +++ b/Octokit/Clients/IReleasesClient.cs @@ -113,10 +113,9 @@ namespace Octokit /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// The specified by the asset id. - Task GetAsset(string owner, string name, int releaseId, int assetId); + Task GetAsset(string owner, string name, int assetId); /// /// Edits the for the specified release of the specified repository. @@ -126,11 +125,10 @@ namespace Octokit /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// Description of the asset with its amended data /// The edited . - Task EditAsset(string owner, string name, int releaseId, int assetId, ReleaseAssetUpdate data); + Task EditAsset(string owner, string name, int assetId, ReleaseAssetUpdate data); /// /// Deletes the specified from the specified repository diff --git a/Octokit/Clients/ReleasesClient.cs b/Octokit/Clients/ReleasesClient.cs index 139f09a6..eb39c0be 100644 --- a/Octokit/Clients/ReleasesClient.cs +++ b/Octokit/Clients/ReleasesClient.cs @@ -174,15 +174,14 @@ namespace Octokit /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// The specified by the asset id. - public Task GetAsset(string owner, string name, int releaseId, int assetId) + public Task GetAsset(string owner, string name, int assetId) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - var endpoint = ApiUrls.ReleaseAssets(owner, name, releaseId, assetId); + var endpoint = ApiUrls.Asset(owner, name, assetId); return ApiConnection.Get(endpoint); } @@ -194,17 +193,16 @@ namespace Octokit /// /// The repository's owner /// The repository's name - /// The id of the /// The id of the /// Description of the asset with its amended data /// The edited . - public Task EditAsset(string owner, string name, int releaseId, int assetId, ReleaseAssetUpdate data) + public Task EditAsset(string owner, string name, int assetId, ReleaseAssetUpdate data) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(data, "data"); - var endpoint = ApiUrls.ReleaseAssets(owner, name, releaseId, assetId); + var endpoint = ApiUrls.Asset(owner, name, assetId); return ApiConnection.Patch(endpoint, data); } @@ -223,7 +221,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - var endpoint = ApiUrls.Assets(owner, name, id); + var endpoint = ApiUrls.Asset(owner, name, id); return ApiConnection.Delete(endpoint); } } diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 984f159c..d222750e 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -134,26 +134,13 @@ namespace Octokit } /// - /// Returns the that returns a single asset for the specified release for the specified repository. - /// - /// The owner of the repository - /// The name of the repository - /// The id of the release - /// The id of the release asset - /// - public static Uri ReleaseAssets(string owner, string name, int releaseId, int assetId) - { - return "repos/{0}/{1}/releases/{2}/assets/{3}".FormatUri(owner, name, releaseId, assetId); - } - - /// - /// Returns the that returns all the assets for the specified repository. + /// Returns the that returns the assets specified by the asset id. /// /// The owner of the repository /// The name of the repository /// The id of the release asset /// - public static Uri Assets(string owner, string name, int id) + public static Uri Asset(string owner, string name, int id) { return "repos/{0}/{1}/releases/assets/{2}".FormatUri(owner, name, id); }