/// <summary> /// Gets all verified public keys for a user. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user /// </remarks> /// <param name="userName">The @ handle of the user.</param> /// <param name="options">Options to change API's behavior.</param> /// <returns>Lists the verified public keys for a user.</returns> public Task <IReadOnlyList <PublicKey> > GetAll(string userName, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(userName, "userName"); Ensure.ArgumentNotNull(options, "options"); return(ApiConnection.GetAll <PublicKey>(ApiUrls.Keys(userName), options)); }
/// <summary> /// Create a public key <see cref="NewPublicKey"/>. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#create-a-public-key /// </remarks> /// <param name="newKey">The SSH Key contents</param> /// <returns></returns> public Task <PublicKey> Create(NewPublicKey newKey) { Ensure.ArgumentNotNull(newKey, "newKey"); return(ApiConnection.Post <PublicKey>(ApiUrls.Keys(), newKey)); }
/// <summary> /// Retrieves the <see cref="PublicKey"/> for the specified id. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#get-a-single-public-key /// </remarks> /// <param name="id">The Id of the SSH key</param> /// <returns></returns> public Task <PublicKey> Get(int id) { return(ApiConnection.Get <PublicKey>(ApiUrls.Keys(id))); }
/// <summary> /// Gets all public keys for the authenticated user. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#list-your-public-keys /// </remarks> /// <param name="options">Options to chagne API's behavior.</param> /// <returns>Lists the current user's keys.</returns> public Task <IReadOnlyList <PublicKey> > GetAllForCurrent(ApiOptions options) { Ensure.ArgumentNotNull(options, "options"); return(ApiConnection.GetAll <PublicKey>(ApiUrls.Keys(), options)); }
/// <summary> /// Delete a public key. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#delete-a-public-key /// </remarks> /// <param name="id">The id of the key to delete</param> /// <returns></returns> public Task Delete(int id) { return(ApiConnection.Delete(ApiUrls.Keys(id))); }
public Task <SshKey> Update(int id, SshKeyUpdate key) { Ensure.ArgumentNotNull(key, "key"); return(ApiConnection.Patch <SshKey>(ApiUrls.Keys(id), key)); }
/// <summary> /// Gets all public keys for the authenticated user. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#list-your-public-keys /// </remarks> /// <returns></returns> public Task <IReadOnlyList <PublicKey> > GetAllForCurrent() { return(ApiConnection.GetAll <PublicKey>(ApiUrls.Keys())); }
/// <summary> /// Gets all verified public keys for a user. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user /// </remarks> /// <returns>The <see cref="PublicKey"/>s for the user.</returns> public Task <IReadOnlyList <PublicKey> > GetAll(string userName) { return(ApiConnection.GetAll <PublicKey>(ApiUrls.Keys(userName))); }