Skip to content

Commit

Permalink
Make client property names consistent
Browse files Browse the repository at this point in the history
Also added ObservableReleasesClient
  • Loading branch information
haacked committed Oct 5, 2013
1 parent 252cacb commit 9a33c68
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 8 deletions.
32 changes: 32 additions & 0 deletions Octokit.Reactive/Clients/ObservableReleasesClient.cs
Original file line number Diff line number Diff line change
@@ -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<IReadOnlyList<Release>> GetAll(string owner, string name)
{
return _client.GetAll(owner, name).ToObservable();
}

public IObservable<Release> CreateRelease(string owner, string name, ReleaseUpdate data)
{
return _client.CreateRelease(owner, name, data).ToObservable();
}

public IObservable<ReleaseAsset> UploadAsset(Release release, ReleaseAssetUpload data)
{
return _client.UploadAsset(release, data).ToObservable();
}
}
}
2 changes: 1 addition & 1 deletion Octokit.Reactive/IObservableGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Expand Down
11 changes: 11 additions & 0 deletions Octokit.Reactive/IObservableReleasesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace Octokit.Reactive
{
public interface IObservableReleasesClient
{
IObservable<IReadOnlyList<Release>> GetAll(string owner, string name);
IObservable<Release> CreateRelease(string owner, string name, ReleaseUpdate data);
IObservable<ReleaseAsset> UploadAsset(Release release, ReleaseAssetUpload data);
}
}
4 changes: 2 additions & 2 deletions Octokit.Reactive/ObservableGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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);
}

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; }
}
Expand Down
2 changes: 2 additions & 0 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@
<Compile Include="Clients\ObservableAuthorizationsClient.cs" />
<Compile Include="Clients\ObservableAutoCompleteClient.cs" />
<Compile Include="Clients\ObservableOrganizationsClient.cs" />
<Compile Include="Clients\ObservableReleasesClient.cs" />
<Compile Include="Clients\ObservableRepositoriesClient.cs" />
<Compile Include="Clients\ObservableSshKeysClient.cs" />
<Compile Include="Clients\ObservableUsersClient.cs" />
<Compile Include="IObservableAuthorizationsClient.cs" />
<Compile Include="IObservableAutoCompleteClient.cs" />
<Compile Include="IObservableGitHubClient.cs" />
<Compile Include="IObservableReleasesClient.cs" />
<Compile Include="IObservableRepositoriesClient.cs" />
<Compile Include="IObservableOrganizationsClient.cs" />
<Compile Include="IObservableSshKeysClient.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Tests.Integration/ReleasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions Octokit/GitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public GitHubClient(IConnection connection)
AutoComplete = new AutoCompleteClient(connection);
Organization = new OrganizationsClient(new ApiConnection<Organization>(connection));
Repository = new RepositoriesClient(new ApiConnection<Repository>(connection));
Releases = new ReleasesClient(new ApiConnection<Release>(connection));
Release = new ReleasesClient(new ApiConnection<Release>(connection));
User = new UsersClient(new ApiConnection<User>(connection));
SshKey = new SshKeysClient(new ApiConnection<SshKey>(connection));
}
Expand Down Expand Up @@ -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; }
}
Expand Down
2 changes: 1 addition & 1 deletion Octokit/IGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Expand Down
2 changes: 1 addition & 1 deletion Octokit/IReleasesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface IReleasesClient
/// </summary>
/// <param name="owner">The owner of the repository.</param>
/// <param name="name">The name of the repository.</param>
/// <returns>A <see cref="IReadonlyPagedCollection{Release}"/> of <see cref="Release"/>.</returns>
/// <returns>A <see cref="IReadonlyList{Release}"/> of <see cref="Release"/>.</returns>
Task<IReadOnlyList<Release>> GetAll(string owner, string name);

/// <summary>
Expand Down

0 comments on commit 9a33c68

Please sign in to comment.