/// <summary>
        /// Create an impersonation OAuth token (must be Site Admin user).
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/enterprise/2.5/v3/users/administration/#create-an-impersonation-oauth-token">API documentation</a>
        /// for more information.
        /// </remarks>
        /// <param name="login">The user to impersonate</param>
        /// <param name="newImpersonationToken">The <see cref="NewImpersonationToken"/> request specifying the required scopes</param>
        /// <returns>An <see cref="Authorization"/> object containing the impersonation token</returns>
        public Task<Authorization> CreateImpersonationToken(string login, NewImpersonationToken newImpersonationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(login, "login");
            Ensure.ArgumentNotNull(newImpersonationToken, "newImpersonationToken");

            var endpoint = ApiUrls.UserAdministrationAuthorization(login);

            return ApiConnection.Post<Authorization>(endpoint, newImpersonationToken);
        }
Beispiel #2
0
        /// <summary>
        /// Create an impersonation OAuth token (must be Site Admin user).
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/enterprise/2.5/v3/users/administration/#create-an-impersonation-oauth-token">API documentation</a>
        /// for more information.
        /// </remarks>
        /// <param name="login">The user to impersonate</param>
        /// <param name="newImpersonationToken">The <see cref="NewImpersonationToken"/> request specifying the required scopes</param>
        /// <returns>An <see cref="Authorization"/> object containing the impersonation token</returns>
        public Task <Authorization> CreateImpersonationToken(string login, NewImpersonationToken newImpersonationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(login, "login");
            Ensure.ArgumentNotNull(newImpersonationToken, "newImpersonationToken");

            var endpoint = ApiUrls.UserAdministrationAuthorization(login);

            return(ApiConnection.Post <Authorization>(endpoint, newImpersonationToken));
        }