UserAdministrationPublicKeys() public static method

public static UserAdministrationPublicKeys ( ) : Uri
return Uri
        /// <summary>
        /// Delete a public key (must be Site Admin user).
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/enterprise/2.5/v3/users/administration/#delete-a-public-key">API documentation</a>
        /// for more information.
        /// </remarks>
        /// <param name="keyId">The key to delete</param>
        /// <returns></returns>
        public async Task DeletePublicKey(int keyId)
        {
            Ensure.ArgumentNotNull(keyId, "keyId");
            var endpoint = ApiUrls.UserAdministrationPublicKeys(keyId);

            var response = await Connection.Delete(endpoint).ConfigureAwait(false);

            if (response != HttpStatusCode.NoContent)
            {
                throw new ApiException("Invalid Status Code returned. Expected a 204", response);
            }
        }
Beispiel #2
0
        /// <summary>
        /// List all public keys (must be Site Admin user).
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/enterprise/2.5/v3/users/administration/#list-all-public-keys">API documentation</a>
        /// for more information.
        /// </remarks>
        /// <returns></returns>
        public Task <IReadOnlyList <PublicKey> > ListAllPublicKeys()
        {
            var endpoint = ApiUrls.UserAdministrationPublicKeys();

            return(ApiConnection.GetAll <PublicKey>(endpoint));
        }