From f6ce5f65b540987037fb27bf708fb41fdad86c38 Mon Sep 17 00:00:00 2001 From: MTRNord Date: Tue, 22 Aug 2017 21:44:21 +0200 Subject: [PATCH] Add helper function GetOwnDisplayName() --- client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client.go b/client.go index 6e369b0..90a07c6 100644 --- a/client.go +++ b/client.go @@ -394,6 +394,13 @@ func (cli *Client) GetDisplayName(mxid string) (resp *RespUserDisplayName, err e 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 func (cli *Client) SetDisplayName(displayName string) (err error) { urlPath := cli.BuildURL("profile", cli.UserID, "displayname")