Fix failure with 201 status code on adding a collaborator (#2559)

* fix: return RepositoryInvitation instead of throwing an exception on 201

* fix: TheAddMethod test
This commit is contained in:
Annchous
2022-09-06 09:36:48 +04:00
committed by GitHub
parent 9c3317f711
commit 0069239774
5 changed files with 12 additions and 28 deletions
@@ -172,7 +172,7 @@ namespace Octokit.Reactive
/// <param name="user">Username of the new collaborator</param>
/// <param name="permission">The permission to set. Only valid on organization-owned repositories.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<bool> Add(string owner, string name, string user, CollaboratorRequest permission);
IObservable<RepositoryInvitation> Add(string owner, string name, string user, CollaboratorRequest permission);
/// <summary>
/// Adds a new collaborator to the repository.
@@ -195,7 +195,7 @@ namespace Octokit.Reactive
/// <param name="user">Username of the new collaborator</param>
/// <param name="permission">The permission to set. Only valid on organization-owned repositories.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<bool> Add(long repositoryId, string user, CollaboratorRequest permission);
IObservable<RepositoryInvitation> Add(long repositoryId, string user, CollaboratorRequest permission);
/// <summary>
/// Invites a user as a collaborator to a repository.
@@ -267,7 +267,7 @@ namespace Octokit.Reactive
/// <param name="user">Username of the new collaborator</param>
/// <param name="permission">The permission to set. Only valid on organization-owned repositories.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<bool> Add(string owner, string name, string user, CollaboratorRequest permission)
public IObservable<RepositoryInvitation> Add(string owner, string name, string user, CollaboratorRequest permission)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
@@ -303,7 +303,7 @@ namespace Octokit.Reactive
/// <param name="user">Username of the new collaborator</param>
/// <param name="permission">The permission to set. Only valid on organization-owned repositories.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<bool> Add(long repositoryId, string user, CollaboratorRequest permission)
public IObservable<RepositoryInvitation> Add(long repositoryId, string user, CollaboratorRequest permission)
{
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
Ensure.ArgumentNotNull(permission, nameof(permission));