Skip to content

Commit 077716a

Browse files
committed
client: add wrapper for /openid/request_token
1 parent 2cd6183 commit 077716a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: client.go

+5
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,11 @@ func (cli *Client) GetMediaConfig(ctx context.Context) (resp *RespMediaConfig, e
15561556
return
15571557
}
15581558

1559+
func (cli *Client) RequestOpenIDToken(ctx context.Context) (resp *RespOpenIDToken, err error) {
1560+
_, err = cli.MakeRequest(ctx, http.MethodPost, cli.BuildClientURL("v3", "user", cli.UserID, "openid", "request_token"), nil, &resp)
1561+
return
1562+
}
1563+
15591564
// UploadLink uploads an HTTP URL and then returns an MXC URI.
15601565
func (cli *Client) UploadLink(ctx context.Context, link string) (*RespMediaUpload, error) {
15611566
req, err := http.NewRequestWithContext(ctx, http.MethodGet, link, nil)

Diff for: responses.go

+7
Original file line numberDiff line numberDiff line change
@@ -680,3 +680,10 @@ type RespRoomKeysUpdate struct {
680680
Count int `json:"count"`
681681
ETag string `json:"etag"`
682682
}
683+
684+
type RespOpenIDToken struct {
685+
AccessToken string `json:"access_token"`
686+
ExpiresIn int `json:"expires_in"`
687+
MatrixServerName string `json:"matrix_server_name"`
688+
TokenType string `json:"token_type"` // Always "Bearer"
689+
}

0 commit comments

Comments
 (0)