From fb695d6898e505ed1c2165853e4fa687884fa195 Mon Sep 17 00:00:00 2001 From: betterlmy Date: Thu, 22 May 2025 13:56:28 +0800 Subject: [PATCH] feat: add ConvertUserLoginType func to codersdk --- codersdk/users.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/codersdk/users.go b/codersdk/users.go index 3d9d95e683066..af5bc19e78b1b 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -663,7 +663,14 @@ func (c *Client) ChangePasswordWithOneTimePasscode(ctx context.Context, req Chan // based authentication to oauth based. The response has the oauth state code // to use in the oauth flow. func (c *Client) ConvertLoginType(ctx context.Context, req ConvertLoginRequest) (OAuthConversionResponse, error) { - res, err := c.Request(ctx, http.MethodPost, "/api/v2/users/me/convert-login", req) + return c.ConvertUserLoginType(ctx, Me, req) +} + +// ConvertUserLoginType will send a request to convert the user from password +// based authentication to oauth based. The response has the oauth state code +// to use in the oauth flow. +func (c *Client) ConvertUserLoginType(ctx context.Context, user string, req ConvertLoginRequest) (OAuthConversionResponse, error) { + res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/users/%s/convert-login", user), req) if err != nil { return OAuthConversionResponse{}, err } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy