Skip to content

Commit

Permalink
Add Ensures in ObservableTeamsClient.
Browse files Browse the repository at this point in the history
  • Loading branch information
devkhan committed Apr 1, 2016
1 parent 27d6e3b commit a1aa51a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Octokit.Reactive/Clients/ObservableTeamsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public IObservable<Team> Get(int id)
/// <returns>A list of the orgs's teams <see cref="Team"/>s.</returns>
public IObservable<Team> GetAll(string org)
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");

return GetAll(org, ApiOptions.None);
}

Expand Down Expand Up @@ -126,6 +128,9 @@ public IObservable<User> GetAllMembers(int id, ApiOptions options)
/// <returns>Newly created <see cref="Team"/></returns>
public IObservable<Team> Create(string org, NewTeam team)
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
Ensure.ArgumentNotNull(team, "team");

return _client.Create(org, team).ToObservable();
}

Expand All @@ -136,6 +141,8 @@ public IObservable<Team> Create(string org, NewTeam team)
/// <returns>Updated <see cref="Team"/></returns>
public IObservable<Team> Update(int id, UpdateTeam team)
{
Ensure.ArgumentNotNull(team, "team");

return _client.Update(id, team).ToObservable();
}

Expand All @@ -161,6 +168,8 @@ public IObservable<Unit> Delete(int id)
/// <returns>A <see cref="TeamMembership"/> result indicating the membership status</returns>
public IObservable<TeamMembership> AddMembership(int id, string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");

return _client.AddMembership(id, login).ToObservable();
}

Expand All @@ -175,6 +184,8 @@ public IObservable<TeamMembership> AddMembership(int id, string login)
/// <returns><see langword="true"/> if the user was removed from the team; <see langword="false"/> otherwise.</returns>
public IObservable<bool> RemoveMembership(int id, string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");

return _client.RemoveMembership(id, login).ToObservable();
}

Expand All @@ -188,6 +199,8 @@ public IObservable<bool> RemoveMembership(int id, string login)
[Obsolete("Use GetMembership(id, login) to detect pending memberships")]
public IObservable<bool> IsMember(int id, string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");

return _client.IsMember(id, login).ToObservable();
}

Expand All @@ -200,6 +213,8 @@ public IObservable<bool> IsMember(int id, string login)
/// <returns>A <see cref="TeamMembership"/> result indicating the membership status</returns>
public IObservable<TeamMembership> GetMembership(int id, string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");

return _client.GetMembership(id, login).ToObservable();
}

Expand Down Expand Up @@ -240,6 +255,9 @@ public IObservable<Repository> GetAllRepositories(int id, ApiOptions options)
/// <returns><see langword="true"/> if the repository was added to the team; <see langword="false"/> otherwise.</returns>
public IObservable<bool> AddRepository(int id, string organization, string repoName)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNullOrEmptyString(repoName, "repoName");

return _client.AddRepository(id, organization, repoName).ToObservable();
}

Expand All @@ -251,6 +269,9 @@ public IObservable<bool> AddRepository(int id, string organization, string repoN
/// <returns></returns>
public IObservable<bool> RemoveRepository(int id, string organization, string repoName)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNullOrEmptyString(repoName, "repoName");

return _client.RemoveRepository(id, organization, repoName).ToObservable();
}

Expand All @@ -266,6 +287,8 @@ public IObservable<bool> RemoveRepository(int id, string organization, string re
/// <returns><see langword="true"/> if the repository is managed by the given team; <see langword="false"/> otherwise.</returns>
public IObservable<bool> IsRepositoryManagedByTeam(int id, string owner, string repo)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(repo, "repo");
return _client.IsRepositoryManagedByTeam(id, owner, repo).ToObservable();
}
}
Expand Down

0 comments on commit a1aa51a

Please sign in to comment.