Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f29b2d

Browse files
author
li_mengyang
committed
feat: add ConvertUserLoginType func to codersdk
1 parent0b5f27f commit2f29b2d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎codersdk/users.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,26 @@ func (c *Client) ConvertLoginType(ctx context.Context, req ConvertLoginRequest)
679679
returnresp,nil
680680
}
681681

682+
// ConvertUserLoginType will send a request to convert the user from password
683+
// based authentication to oauth based. The response has the oauth state code
684+
// to use in the oauth flow.
685+
func (c*Client)ConvertUserLoginType(ctx context.Context,userstring,reqConvertLoginRequest) (OAuthConversionResponse,error) {
686+
res,err:=c.Request(ctx,http.MethodPost,fmt.Sprintf("/api/v2/users/%s/convert-login",user),req)
687+
iferr!=nil {
688+
returnOAuthConversionResponse{},err
689+
}
690+
deferres.Body.Close()
691+
ifres.StatusCode!=http.StatusCreated {
692+
returnOAuthConversionResponse{},ReadBodyAsError(res)
693+
}
694+
varrespOAuthConversionResponse
695+
err=json.NewDecoder(res.Body).Decode(&resp)
696+
iferr!=nil {
697+
returnOAuthConversionResponse{},err
698+
}
699+
returnresp,nil
700+
}
701+
682702
// Logout calls the /logout API
683703
// Call `ClearSessionToken()` to clear the session token of the client.
684704
func (c*Client)Logout(ctx context.Context)error {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp