client: add wrapper for /openid/request_token
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled

This commit is contained in:
Tulir Asokan 2025-01-01 18:00:18 +02:00
commit 077716a4ec
2 changed files with 12 additions and 0 deletions

View file

@ -1556,6 +1556,11 @@ func (cli *Client) GetMediaConfig(ctx context.Context) (resp *RespMediaConfig, e
return
}
func (cli *Client) RequestOpenIDToken(ctx context.Context) (resp *RespOpenIDToken, err error) {
_, err = cli.MakeRequest(ctx, http.MethodPost, cli.BuildClientURL("v3", "user", cli.UserID, "openid", "request_token"), nil, &resp)
return
}
// UploadLink uploads an HTTP URL and then returns an MXC URI.
func (cli *Client) UploadLink(ctx context.Context, link string) (*RespMediaUpload, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, link, nil)

View file

@ -680,3 +680,10 @@ type RespRoomKeysUpdate struct {
Count int `json:"count"`
ETag string `json:"etag"`
}
type RespOpenIDToken struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
MatrixServerName string `json:"matrix_server_name"`
TokenType string `json:"token_type"` // Always "Bearer"
}