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

Organization Membership Preview API Changes - existing endpoints #1952

Closed
Closed
Show file tree
Hide file tree
Changes from 11 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
52 changes: 50 additions & 2 deletions Octokit.Reactive/Clients/IObservableRepoCollaboratorsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ public interface IObservableRepoCollaboratorsClient
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId);
IObservable<User> GetAll(string owner, string name, ListCollaboratorRequest listCollaboratorRequest);

/// <summary>
/// Gets all the collaborators on a repository.
Expand All @@ -44,6 +46,27 @@ public interface IObservableRepoCollaboratorsClient
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(string owner, string name, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId, ListCollaboratorRequest listCollaboratorRequest);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand All @@ -55,6 +78,31 @@ public interface IObservableRepoCollaboratorsClient
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(string owner, string name, ListCollaboratorRequest listCollaboratorRequest, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId, ListCollaboratorRequest listCollaboratorRequest, ApiOptions options);

/// <summary>
/// Checks if a user is a collaborator on a repository.
/// </summary>
Expand Down
86 changes: 80 additions & 6 deletions Octokit.Reactive/Clients/ObservableRepoCollaboratorsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IObservable<User> GetAll(string owner, string name)
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));

return GetAll(owner, name, ApiOptions.None);
return GetAll(owner, name, new ListCollaboratorRequest(), ApiOptions.None);
}

/// <summary>
Expand All @@ -51,11 +51,17 @@ public IObservable<User> GetAll(string owner, string name)
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<User> GetAll(long repositoryId)
public IObservable<User> GetAll(string owner, string name, ListCollaboratorRequest listCollaboratorRequest)
{
return GetAll(repositoryId, ApiOptions.None);
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(listCollaboratorRequest, nameof(listCollaboratorRequest));

return GetAll(owner, name, listCollaboratorRequest, ApiOptions.None);
}

/// <summary>
Expand All @@ -74,7 +80,36 @@ public IObservable<User> GetAll(string owner, string name, ApiOptions options)
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<User>(ApiUrls.RepoCollaborators(owner, name), options);
return GetAll(owner, name, new ListCollaboratorRequest(), options);
}

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<User> GetAll(long repositoryId)
{
return GetAll(repositoryId, new ListCollaboratorRequest(), ApiOptions.None);
}

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<User> GetAll(long repositoryId, ListCollaboratorRequest listCollaboratorRequest)
{
Ensure.ArgumentNotNull(listCollaboratorRequest, nameof(listCollaboratorRequest));

return GetAll(repositoryId, listCollaboratorRequest, ApiOptions.None);
}

/// <summary>
Expand All @@ -90,7 +125,46 @@ public IObservable<User> GetAll(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<User>(ApiUrls.RepoCollaborators(repositoryId), options);
return GetAll(repositoryId, new ListCollaboratorRequest(), options);
}

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<User> GetAll(string owner, string name, ListCollaboratorRequest listCollaboratorRequest, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(listCollaboratorRequest, nameof(listCollaboratorRequest));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<User>(ApiUrls.RepoCollaborators(owner, name), listCollaboratorRequest.ToParametersDictionary(), AcceptHeaders.OrganizationMembershipPreview, options);
}

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="listCollaboratorRequest">Details to filter the request, such as by affiliation.</param>
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<User> GetAll(long repositoryId, ListCollaboratorRequest listCollaboratorRequest, ApiOptions options)
{
Ensure.ArgumentNotNull(listCollaboratorRequest, nameof(listCollaboratorRequest));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<User>(ApiUrls.RepoCollaborators(repositoryId), listCollaboratorRequest.ToParametersDictionary(), AcceptHeaders.OrganizationMembershipPreview, options);
}

/// <summary>
Expand Down
Loading