Add Observable GetEmails method

This commit is contained in:
Haacked
2013-10-03 16:02:53 -07:00
parent 50dff26c4a
commit 76e509978f
2 changed files with 17 additions and 7 deletions

View File

@@ -5,32 +5,37 @@ namespace Octokit.Reactive.Clients
{
public class ObservableUsersClient : IObservableUsersClient
{
readonly IUsersClient client;
readonly IUsersClient _client;
public ObservableUsersClient(IUsersClient client)
{
Ensure.ArgumentNotNull(client, "client");
this.client = client;
this._client = client;
}
public IObservable<User> Get(string login)
{
Ensure.ArgumentNotNull(login, "login");
return client.Get(login).ToObservable();
return _client.Get(login).ToObservable();
}
public IObservable<User> Current()
{
return client.Current().ToObservable();
return _client.Current().ToObservable();
}
public IObservable<User> Update(UserUpdate user)
{
Ensure.ArgumentNotNull(user, "user");
return client.Update(user).ToObservable();
return _client.Update(user).ToObservable();
}
public IObservable<IReadOnlyList<EmailAddress>> GetEmails()
{
return _client.GetEmails().ToObservable();
}
}
}

View File

@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace Octokit.Reactive
{
@@ -29,5 +27,12 @@ namespace Octokit.Reactive
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <returns>A <see cref="User"/></returns>
IObservable<User> Update(UserUpdate user);
/// <summary>
/// Returns emails for the current user.
/// </summary>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<IReadOnlyList<EmailAddress>> GetEmails();
}
}