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

Update permissions #2661

Merged
merged 43 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6518448
move enum and rename response class
notauserx Jan 23, 2023
2f626db
move InvitationPermissionType to Permission.cs
notauserx Jan 23, 2023
0c4a129
rename PermissionLevel enum
notauserx Jan 23, 2023
89b4c8a
mark failing tests
notauserx Jan 23, 2023
1b6d39d
update summary for collaborators clients
notauserx Jan 24, 2023
60e9d30
update api link
notauserx Jan 24, 2023
7039f1e
add collaborator model
notauserx Jan 24, 2023
4bea499
update models
notauserx Jan 24, 2023
4c395d9
move permissions to common folder
notauserx Jan 24, 2023
57f7e40
fix debugger display
notauserx Jan 24, 2023
50ff3c5
update list collaborators method signature
notauserx Jan 24, 2023
9dbe36c
fix wrong references to api docs
notauserx Jan 24, 2023
b44c913
update api doc links
notauserx Jan 24, 2023
ddeb59e
Merge branch 'main' into update-permissions
notauserx Jan 24, 2023
5a87115
update tests
notauserx Jan 24, 2023
f25a1d0
refactor: permission as string
notauserx Jan 24, 2023
b7af2b1
rename permission to TeamPermissionLegacy
notauserx Jan 24, 2023
96465ba
remove unnecessary SuppressMessage
notauserx Jan 24, 2023
2a69384
remove not null assert on value type
notauserx Jan 24, 2023
4f96d0c
remove redundant suppress message
notauserx Jan 25, 2023
c1ed861
remove unused suppress message
notauserx Jan 25, 2023
99fa513
update installation permission
notauserx Jan 25, 2023
d338c33
move app installation permission enums to permission file
notauserx Jan 25, 2023
303aa8f
use string interpolation in debugger display
notauserx Jan 25, 2023
8a166b3
add missing properties from constructor params
notauserx Jan 25, 2023
a4ee06b
rename param to pass convention tests
notauserx Jan 25, 2023
52806b4
update doc reference
notauserx Jan 25, 2023
2ec9c73
Merge branch 'main' into update-permissions
nickfloyd Feb 7, 2023
e515827
Merge branch 'main' into update-permissions
notauserx Feb 12, 2023
b29a4bf
fix type for property
notauserx Feb 12, 2023
4acadfd
update model for RepositoryCollaboratorListResponse
notauserx Feb 12, 2023
47ac6df
rename file to match classname
notauserx Feb 12, 2023
54381f3
use expression body for debugger display
notauserx Feb 12, 2023
9799f84
clean up model
notauserx Feb 12, 2023
e448c0f
move xunit import statement
notauserx Feb 13, 2023
180356e
fix integration tests for TheGetAllMethod
notauserx Feb 13, 2023
8ca4b3f
update tests for IsCollaboratorMethod
notauserx Feb 13, 2023
15b321a
skip delete tests
notauserx Feb 13, 2023
dbd4578
update tests for TheReviewPermissionMethod
notauserx Feb 13, 2023
5629bc3
add test for permission filter
notauserx Feb 14, 2023
3b43329
add integration test for permission filter
notauserx Feb 14, 2023
ec636f4
add comment on Permission.cs file
notauserx Feb 15, 2023
4bc0b8d
Merge branch 'main' into update-permissions
nickfloyd Mar 8, 2023
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
16 changes: 8 additions & 8 deletions Octokit.AsyncPaginationExtension/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,20 +547,20 @@ public static IPaginatedList<ReleaseAsset> GetAllAssetsAsync(this IReleasesClien
=> pageSize > 0 ? new PaginatedList<ReleaseAsset>(options => t.GetAllAssets(repositoryId, id, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");

/// <inheritdoc cref="IRepoCollaboratorsClient.GetAll(string, string, ApiOptions)"/>
public static IPaginatedList<User> GetAllAsync(this IRepoCollaboratorsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<User>(options => t.GetAll(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");
public static IPaginatedList<Collaborator> GetAllAsync(this IRepoCollaboratorsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<Collaborator>(options => t.GetAll(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");

/// <inheritdoc cref="IRepoCollaboratorsClient.GetAll(long, ApiOptions)"/>
public static IPaginatedList<User> GetAllAsync(this IRepoCollaboratorsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<User>(options => t.GetAll(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");
public static IPaginatedList<Collaborator> GetAllAsync(this IRepoCollaboratorsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<Collaborator>(options => t.GetAll(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");

/// <inheritdoc cref="IRepoCollaboratorsClient.GetAll(string, string, RepositoryCollaboratorListRequest, ApiOptions)"/>
public static IPaginatedList<User> GetAllAsync(this IRepoCollaboratorsClient t, string owner, string name, RepositoryCollaboratorListRequest request, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<User>(options => t.GetAll(owner, name, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");
public static IPaginatedList<Collaborator> GetAllAsync(this IRepoCollaboratorsClient t, string owner, string name, RepositoryCollaboratorListRequest request, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<Collaborator>(options => t.GetAll(owner, name, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");

/// <inheritdoc cref="IRepoCollaboratorsClient.GetAll(long, RepositoryCollaboratorListRequest, ApiOptions)"/>
public static IPaginatedList<User> GetAllAsync(this IRepoCollaboratorsClient t, long repositoryId, RepositoryCollaboratorListRequest request, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<User>(options => t.GetAll(repositoryId, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");
public static IPaginatedList<Collaborator> GetAllAsync(this IRepoCollaboratorsClient t, long repositoryId, RepositoryCollaboratorListRequest request, int pageSize = DEFAULT_PAGE_SIZE)
=> pageSize > 0 ? new PaginatedList<Collaborator>(options => t.GetAll(repositoryId, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive.");

/// <inheritdoc cref="IRepositoriesClient.GetAllForCurrent(ApiOptions)"/>
public static IPaginatedList<Repository> GetAllForCurrentAsync(this IRepositoriesClient t, int pageSize = DEFAULT_PAGE_SIZE)
Expand Down
48 changes: 24 additions & 24 deletions Octokit.Reactive/Clients/IObservableRepoCollaboratorsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,110 +4,110 @@
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Collaborators on a Repository.
/// A client for GitHub's Collaborators API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/">Collaborators API documentation</a> for more details.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28">Collaborators API documentation</a> for more details.
/// </remarks>
public interface IObservableRepoCollaboratorsClient
{
/// <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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">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>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(string owner, string name);
IObservable<Collaborator> GetAll(string owner, string name);

/// <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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">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);
IObservable<Collaborator> 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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">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="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, ApiOptions options);
IObservable<Collaborator> 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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</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, ApiOptions options);
IObservable<Collaborator> 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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">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="request">Used to request and filter a list of repository collaborators</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(string owner, string name, RepositoryCollaboratorListRequest request);
IObservable<Collaborator> GetAll(string owner, string name, RepositoryCollaboratorListRequest request);

/// <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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="request">Used to request and filter a list of repository collaborators</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId, RepositoryCollaboratorListRequest request);
IObservable<Collaborator> GetAll(long repositoryId, RepositoryCollaboratorListRequest request);

/// <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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">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="request">Used to request and filter a list of repository collaborators</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, RepositoryCollaboratorListRequest request, ApiOptions options);
IObservable<Collaborator> GetAll(string owner, string name, RepositoryCollaboratorListRequest request, 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.
/// See the <a href="https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="request">Used to request and filter a list of repository collaborators</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, RepositoryCollaboratorListRequest request, ApiOptions options);
IObservable<Collaborator> GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options);

/// <summary>
/// Checks if a user is a collaborator on a repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#get">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>
Expand Down Expand Up @@ -136,7 +136,7 @@ public interface IObservableRepoCollaboratorsClient
/// <param name="name">The name of the repository</param>
/// <param name="user">Username of the collaborator to check permission for</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<CollaboratorPermission> ReviewPermission(string owner, string name, string user);
IObservable<CollaboratorPermissionResponse> ReviewPermission(string owner, string name, string user);

/// <summary>
/// Review a user's permission level in a repository
Expand All @@ -147,13 +147,13 @@ public interface IObservableRepoCollaboratorsClient
/// <param name="repositoryId">The id of the repository</param>
/// <param name="user">Username of the collaborator to check permission for</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<CollaboratorPermission> ReviewPermission(long repositoryId, string user);
IObservable<CollaboratorPermissionResponse> ReviewPermission(long repositoryId, string user);

/// <summary>
/// Adds a new collaborator to the repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#add-collaborator">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>
Expand All @@ -165,7 +165,7 @@ public interface IObservableRepoCollaboratorsClient
/// Adds a new collaborator to the repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#add-collaborator">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>
Expand Down Expand Up @@ -247,7 +247,7 @@ public interface IObservableRepoCollaboratorsClient
/// Deletes a collaborator from the repository.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information.
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#remove-collaborator">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>
Expand Down
Loading