mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 03:55:55 +00:00
add metadata to each client action (#2124)
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repos/{owner}/{name}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(string owner, string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -45,6 +46,7 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The id of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("GET", "/repository/{id}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(long repositoryId)
|
||||
{
|
||||
return GetAll(repositoryId, ApiOptions.None);
|
||||
@@ -60,6 +62,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repos/{owner}/{name}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -78,6 +81,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repository/{id}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(long repositoryId, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
@@ -95,6 +99,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repos/{owner}/{name}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(string owner, string name, RepositoryCollaboratorListRequest request)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -113,6 +118,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repository/{id}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(long repositoryId, RepositoryCollaboratorListRequest request)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, nameof(request));
|
||||
@@ -131,6 +137,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repos/{owner}/{name}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -152,6 +159,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repository/{id}/collaborators")]
|
||||
public Task<IReadOnlyList<User>> GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, nameof(request));
|
||||
@@ -170,6 +178,7 @@ namespace Octokit
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="user">Username of the prospective collaborator</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("GET", "/repos/{owner}/{name}/collaborators/{username}")]
|
||||
public async Task<bool> IsCollaborator(string owner, string name, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -196,6 +205,7 @@ namespace Octokit
|
||||
/// <param name="repositoryId">The id of the repository</param>
|
||||
/// <param name="user">Username of the prospective collaborator</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("GET", "/repository/{id}/collaborators/{username}")]
|
||||
public async Task<bool> IsCollaborator(long repositoryId, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -221,6 +231,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repos/{owner}/{name}/collaborators/{username}/permission")]
|
||||
public Task<CollaboratorPermission> ReviewPermission(string owner, string name, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -240,6 +251,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("GET", "/repository/{id}/collaborators/{username}/permission")]
|
||||
public Task<CollaboratorPermission> ReviewPermission(long repositoryId, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -258,6 +270,7 @@ namespace Octokit
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="user">Username of the new collaborator</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("PUT", "/repos/{owner}/{name}/collaborators/{username}")]
|
||||
public Task Add(string owner, string name, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -278,6 +291,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("PUT", "/repos/{owner}/{name}/collaborators/{username}")]
|
||||
public async Task<bool> Add(string owner, string name, string user, CollaboratorRequest permission)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -304,6 +318,7 @@ namespace Octokit
|
||||
/// <param name="repositoryId">The id of the repository</param>
|
||||
/// <param name="user">Username of the new collaborator</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("PUT", "/repository/{id}/collaborators/{username}")]
|
||||
public Task Add(long repositoryId, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -321,6 +336,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
[ManualRoute("PUT", "/repository/{id}/collaborators/{username}")]
|
||||
public async Task<bool> Add(long repositoryId, string user, CollaboratorRequest permission)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -344,14 +360,16 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository.</param>
|
||||
/// <param name="name">The name of the repository.</param>
|
||||
/// <param name="user">The name of the user to invite.</param>
|
||||
/// <param name="user">The name of the user to invite.</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("PUT", "/repos/{owner}/{name}/collaborators/{username}")]
|
||||
public Task<RepositoryInvitation> Invite(string owner, string name, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
|
||||
|
||||
return ApiConnection.Put<RepositoryInvitation>(ApiUrls.RepoCollaborator(owner, name, user), new object(), null, AcceptHeaders.InvitationsApiPreview);
|
||||
}
|
||||
|
||||
@@ -366,6 +384,7 @@ namespace Octokit
|
||||
/// <param name="user">The name of the user to invite.</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>
|
||||
[ManualRoute("PUT", "/repos/{owner}/{name}/collaborators/{username}")]
|
||||
public Task<RepositoryInvitation> Invite(string owner, string name, string user, CollaboratorRequest permission)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -383,8 +402,9 @@ namespace Octokit
|
||||
/// See the <a href="http://developer.github.com/v3/repos/collaborators/#add-collaborator">API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The id of the repository.</param>
|
||||
/// <param name="user">The name of the user to invite.</param>
|
||||
/// <param name="user">The name of the user to invite.</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("PUT", "/repository/{id}/collaborators/{username}")]
|
||||
public Task<RepositoryInvitation> Invite(long repositoryId, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -401,7 +421,8 @@ namespace Octokit
|
||||
/// <param name="repositoryId">The id of the repository.</param>
|
||||
/// <param name="user">The name of the user to invite.</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>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("PUT", "/repository/{id}/collaborators/{username}")]
|
||||
public Task<RepositoryInvitation> Invite(long repositoryId, string user, CollaboratorRequest permission)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -420,6 +441,7 @@ namespace Octokit
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="user">Username of the deleted collaborator</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("DELETE", "/repos/{owner}/{name}/collaborators/{username}")]
|
||||
public Task Delete(string owner, string name, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -438,6 +460,7 @@ namespace Octokit
|
||||
/// <param name="repositoryId">The id of the repository</param>
|
||||
/// <param name="user">Username of the deleted collaborator</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
[ManualRoute("DELETE", "/repository/{id}/collaborators/{username}")]
|
||||
public Task Delete(long repositoryId, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
@@ -445,4 +468,4 @@ namespace Octokit
|
||||
return ApiConnection.Delete(ApiUrls.RepoCollaborator(repositoryId, user));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user