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. [ManualRoute("GET", "/user/gpg_keys")] 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. [ManualRoute("GET", "/user/gpg_keys")] public Task> GetAllForCurrent(ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); return ApiConnection.GetAll(ApiUrls.GpgKeys(), 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. [ManualRoute("GET", "/user/gpg_keys/{gpg_key_id}")] public Task Get(int id) { return ApiConnection.Get(ApiUrls.GpgKeys(id)); } /// /// Creates a new for the authenticated user. /// /// The new GPG key to add. /// /// See the API documentation for more information. /// /// The newly created . [ManualRoute("POST", "/user/gpg_keys")] public Task Create(NewGpgKey newGpgKey) { Ensure.ArgumentNotNull(newGpgKey, nameof(newGpgKey)); return ApiConnection.Post(ApiUrls.GpgKeys(), newGpgKey); } /// /// Deletes the GPG key for the specified Id. /// /// The Id of the GPG key to delete. /// /// See the API documentation for more information. /// /// [ManualRoute("DELETE", "/user/gpg_keys/{gpg_key_id}")] public Task Delete(int id) { return ApiConnection.Delete(ApiUrls.GpgKeys(id)); } } }