mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
client: add wrapper for /openid/request_token
Some checks failed
Some checks failed
This commit is contained in:
parent
2cd6183f30
commit
077716a4ec
2 changed files with 12 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue