using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace Octokit
{
///
/// A client for GitHub's UserUser GPG Keys API.
///
///
/// See the User GPG Keys documentation for more information.
///
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpg")]
public class UserGpgKeysClient : ApiClient, IUserGpgKeysClient
{
///
/// Instatiates a new GitHub User GPG Keys API client.
///
/// The API connection.
public UserGpgKeysClient(IApiConnection apiConnection) : base(apiConnection)
{
}
///
/// Gets all GPG keys for the authenticated user.
///
///
/// See the API documentation for more information.
///
/// A of s for the current user.
public Task> GetAllForCurrent()
{
return GetAllForCurrent(ApiOptions.None);
}
///
/// Gets all GPG keys for the authenticated user.
///
/// Options for changing the API response
///
/// See the API documentation for more information.
///
/// A of s for the current user.
public Task> GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll(ApiUrls.GpgKeys(), null, AcceptHeaders.GpgKeysPreview, options);
}
///
/// View extended details of the for the specified id.
///
/// The ID of the GPG key
///
/// See the API documentation for more information.
///
/// The for the specified ID.
public Task Get(int id)
{
return ApiConnection.Get(ApiUrls.GpgKeys(id), null, AcceptHeaders.GpgKeysPreview);
}
///
/// Creates a new for the authenticated user.
///
/// The new GPG key to add.
///
/// See the API documentation for more information.
///
/// The newly created .
public Task Create(NewGpgKey newGpgKey)
{
Ensure.ArgumentNotNull(newGpgKey, "newGpgKey");
return ApiConnection.Post(ApiUrls.GpgKeys(), newGpgKey, AcceptHeaders.GpgKeysPreview);
}
///
/// Deletes the GPG key for the specified ID.
///
/// The ID of the GPG key to delete.
///
/// See the API documentation for more information.
///
///
public Task Delete(int id)
{
return ApiConnection.Delete(ApiUrls.GpgKeys(id), new object(), AcceptHeaders.GpgKeysPreview);
}
}
}