using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reactive; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { /// /// 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 ObservableUserGpgKeysClient : IObservableUserGpgKeysClient { readonly IUserGpgKeysClient _client; public ObservableUserGpgKeysClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.User.GpgKeys; } /// /// Gets all GPG keys for the authenticated user. /// /// /// See the API documentation for more information. /// /// A of s for the current user. public IObservable 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 IObservable GetAllForCurrent(ApiOptions options) { return _client.GetAllForCurrent(options).ToObservable().SelectMany(k => k); } /// /// 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 IObservable Get(int id) { return _client.Get(id).ToObservable(); } /// /// Creates a new for the authenticated user. /// /// The new GPG key to add. /// /// See the API documentation for more information. /// /// The newly created . public IObservable Create(NewGpgKey newGpgKey) { Ensure.ArgumentNotNull(newGpgKey, "newGpgKey"); return _client.Create(newGpgKey).ToObservable(); } /// /// Deletes the GPG key for the specified ID. /// /// The ID of the GPG key to delete. /// /// See the API documentation for more information. /// /// public IObservable Delete(int id) { return _client.Delete(id).ToObservable(); } } }