Add helper function GetOwnDisplayName()

This commit is contained in:
MTRNord 2017-08-22 21:44:21 +02:00
parent 3e76370297
commit f6ce5f65b5
1 changed files with 7 additions and 0 deletions

View File

@ -394,6 +394,13 @@ func (cli *Client) GetDisplayName(mxid string) (resp *RespUserDisplayName, err e
return return
} }
// GetOwnDisplayName returns the user's display name. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
func (cli *Client) GetOwnDisplayName() (resp *RespUserDisplayName, err error) {
urlPath := cli.BuildURL("profile", cli.UserID, "displayname")
_, err = cli.MakeRequest("GET", urlPath, nil, &resp)
return
}
// SetDisplayName sets the user's profile display name. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-profile-userid-displayname // SetDisplayName sets the user's profile display name. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-profile-userid-displayname
func (cli *Client) SetDisplayName(displayName string) (err error) { func (cli *Client) SetDisplayName(displayName string) (err error) {
urlPath := cli.BuildURL("profile", cli.UserID, "displayname") urlPath := cli.BuildURL("profile", cli.UserID, "displayname")