Skip to content
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

Dev put release on iRepository from iGitHub client #1058

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@ public interface IObservableRepositoriesClient
///</remarks>
IObservableRepositoryCommitsClient Commit { get; }

/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
IObservableReleasesClient Release { get; }

/// <summary>
/// Client for managing pull requests.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Reactive/Clients/ObservableReleasesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public ObservableReleasesClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

_client = client.Release;
_client = client.Repository.Release;
_connection = client.Connection;
}

Expand Down
9 changes: 9 additions & 0 deletions Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public ObservableRepositoriesClient(IGitHubClient client)
Commits = new ObservableRepositoryCommitsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new ObservableRepositoryCommitsClient(client);
Release = new ObservableReleasesClient(client);
DeployKeys = new ObservableRepositoryDeployKeysClient(client);
Content = new ObservableRepositoryContentsClient(client);
Merging = new ObservableMergingClient(client);
Expand Down Expand Up @@ -469,6 +470,14 @@ public IObservable<CompareResult> Compare(string owner, string name, string @bas
///</remarks>
public IObservableRepositoryCommitsClient Commit { get; private set; }

/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
public IObservableReleasesClient Release { get; private set; }

/// <summary>
/// Client for managing pull requests.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Octokit.Reactive/IObservableGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public interface IObservableGitHubClient : IApiInfoProvider
IObservablePullRequestsClient PullRequest { get; }
IObservableRepositoriesClient Repository { get; }
IObservableGistsClient Gist { get; }
[Obsolete("Use Repository.Release instead")]
IObservableReleasesClient Release { get; }
IObservableSshKeysClient SshKey { get; }
IObservableUsersClient User { get; }
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Reactive/ObservableGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public ObservableGitHubClient(IGitHubClient gitHubClient)
Repository = new ObservableRepositoriesClient(gitHubClient);
SshKey = new ObservableSshKeysClient(gitHubClient);
User = new ObservableUsersClient(gitHubClient);
Release = new ObservableReleasesClient(gitHubClient);
Git = new ObservableGitDatabaseClient(gitHubClient);
Gist = new ObservableGistsClient(gitHubClient);
Search = new ObservableSearchClient(gitHubClient);
Expand All @@ -62,7 +61,8 @@ public IConnection Connection
public IObservablePullRequestsClient PullRequest { get; private set; }
public IObservableRepositoriesClient Repository { get; private set; }
public IObservableGistsClient Gist { get; private set; }
public IObservableReleasesClient Release { get; private set; }
[Obsolete("Use Repository.Release instead")]
public IObservableReleasesClient Release { get { return Repository.Release; } }
public IObservableSshKeysClient SshKey { get; private set; }
public IObservableUsersClient User { get; private set; }
public IObservableNotificationsClient Notification { get; private set; }
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TheGetReleasesMethod : IDisposable
public TheGetReleasesMethod()
{
var github = Helper.GetAuthenticatedClient();
_releaseClient = github.Release;
_releaseClient = github.Repository.Release;

_context = github.CreateRepositoryContext("public-repo").Result;
}
Expand Down Expand Up @@ -84,7 +84,7 @@ public class TheEditMethod : IDisposable
public TheEditMethod()
{
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Release;
_releaseClient = _github.Repository.Release;

_context = _github.CreateRepositoryContext("public-repo").Result;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public class TheUploadAssetMethod : IDisposable
public TheUploadAssetMethod()
{
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Release;
_releaseClient = _github.Repository.Release;

_context = _github.CreateRepositoryContext("public-repo").Result;
}
Expand Down
14 changes: 7 additions & 7 deletions Octokit.Tests/Reactive/ObservableReleasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void CallsIntoClient()

client.Get("fake", "repo", 1);

gitHubClient.Release.Received(1).Get("fake", "repo", 1);
gitHubClient.Repository.Release.Received(1).Get("fake", "repo", 1);
}

[Fact]
Expand All @@ -78,7 +78,7 @@ public void CallsIntoClient()

releasesClient.Create("fake", "repo", data);

gitHubClient.Release.Received(1).Create("fake", "repo", data);
gitHubClient.Repository.Release.Received(1).Create("fake", "repo", data);
}

[Fact]
Expand All @@ -105,7 +105,7 @@ public void RequestsTheCorrectUrl()

releasesClient.Edit("fake", "repo", 1, data);

gitHubClient.Release.Received(1).Edit("fake", "repo", 1, data);
gitHubClient.Repository.Release.Received(1).Edit("fake", "repo", 1, data);
}

[Fact]
Expand All @@ -132,7 +132,7 @@ public void RequestsTheCorrectUrl()

client.Delete("fake", "repo", 1);

gitHubClient.Release.Received(1).Delete("fake", "repo", 1);
gitHubClient.Repository.Release.Received(1).Delete("fake", "repo", 1);
}

[Fact]
Expand Down Expand Up @@ -186,7 +186,7 @@ public void CallsIntoClient()

releasesClient.UploadAsset(release, upload);

gitHubClient.Release.Received(1).UploadAsset(release, upload);
gitHubClient.Repository.Release.Received(1).UploadAsset(release, upload);
}

[Fact]
Expand All @@ -212,7 +212,7 @@ public void CallsIntoClient()

client.GetAsset("fake", "repo", 1);

gitHubClient.Release.Received(1).GetAsset("fake", "repo", 1);
gitHubClient.Repository.Release.Received(1).GetAsset("fake", "repo", 1);
}

[Fact]
Expand All @@ -238,7 +238,7 @@ public void RequestsTheCorrectUrl()

client.EditAsset("fake", "repo", 1, data);

gitHubClient.Release.Received(1).EditAsset("fake", "repo", 1, data);
gitHubClient.Repository.Release.Received(1).EditAsset("fake", "repo", 1, data);
}

[Fact]
Expand Down
8 changes: 8 additions & 0 deletions Octokit/Clients/IRepositoriesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ public interface IRepositoriesClient
///</remarks>
IRepositoryCommitsClient Commit { get; }

/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
IReleasesClient Release { get; }

/// <summary>
/// Client for GitHub's Repository Merging API
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions Octokit/Clients/RepositoriesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection)
Commits = new RepositoryCommitsClient(apiConnection);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new RepositoryCommitsClient(apiConnection);
Release = new ReleasesClient(apiConnection);
DeployKeys = new RepositoryDeployKeysClient(apiConnection);
Merging = new MergingClient(apiConnection);
Content = new RepositoryContentsClient(apiConnection);
Expand Down Expand Up @@ -390,6 +391,14 @@ public Task<IReadOnlyList<Repository>> GetAllForOrg(string organization)
///</remarks>
public IRepositoryCommitsClient Commit { get; private set; }

/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
public IReleasesClient Release { get; private set; }

/// <summary>
/// Client for GitHub's Repository Merging API
/// </summary>
Expand Down
8 changes: 5 additions & 3 deletions Octokit/GitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public GitHubClient(IConnection connection)
PullRequest = new PullRequestsClient(apiConnection);
Repository = new RepositoriesClient(apiConnection);
Gist = new GistsClient(apiConnection);
Release = new ReleasesClient(apiConnection);
User = new UsersClient(apiConnection);
SshKey = new SshKeysClient(apiConnection);
Git = new GitDatabaseClient(apiConnection);
Expand Down Expand Up @@ -215,14 +214,17 @@ public Uri BaseAddress
/// </remarks>
public IGistsClient Gist { get; private set; }

// TODO: this should be under Repositories to align with the API docs
/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
public IReleasesClient Release { get; private set; }
[Obsolete("Use Repository.Release instead")]
public IReleasesClient Release
{
get { return Repository.Release; }
}

// TODO: this should be under Users to align with the API docs
// TODO: this should be named PublicKeys to align with the API docs
Expand Down
3 changes: 2 additions & 1 deletion Octokit/IGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Octokit
{
/// <summary>
/// <summary>
/// A Client for the GitHub API v3. You can read more about the api here: http://developer.github.com.
/// </summary>
public interface IGitHubClient : IApiInfoProvider
Expand Down Expand Up @@ -91,6 +91,7 @@ public interface IGitHubClient : IApiInfoProvider
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
[Obsolete("Use Repository.Release instead")]
IReleasesClient Release { get; }

// TODO: this should be under Users to align with the API docs
Expand Down