From 6941540498ef76e4a0bc8d87c9aabc4f1fbad7a9 Mon Sep 17 00:00:00 2001 From: Sagleft Date: Sun, 19 Feb 2023 19:01:28 +0200 Subject: [PATCH] add `SetProfileData` method --- v2/internal/utopia/client.go | 15 +++++++++++++++ v2/internal/utopia/consts.go | 2 ++ 2 files changed, 17 insertions(+) diff --git a/v2/internal/utopia/client.go b/v2/internal/utopia/client.go index 46147dd..9e6b6e4 100644 --- a/v2/internal/utopia/client.go +++ b/v2/internal/utopia/client.go @@ -78,6 +78,21 @@ func (c *UtopiaClient) SetProfileStatus(status string, mood string) error { return nil } +func (c *UtopiaClient) SetProfileData(nick, firstName, lastName string) error { + result, err := c.queryResultToBool(reqSetProfiltData, uMap{ + "nick": nick, + "firstName": firstName, + "lastName": lastName, + }) + if err != nil { + return err + } + if !result { + return ErrorSetProfileData + } + return nil +} + func (c *UtopiaClient) GetOwnContact() (structs.OwnContactData, error) { r := structs.OwnContactData{} err := c.getSimpleStruct(reqGetOwnContact, &r) diff --git a/v2/internal/utopia/consts.go b/v2/internal/utopia/consts.go index 94a3a67..c6de4a8 100644 --- a/v2/internal/utopia/consts.go +++ b/v2/internal/utopia/consts.go @@ -19,6 +19,7 @@ const ( reqGetProfileStatus = "getProfileStatus" reqGetSystemInfo = "getSystemInfo" reqSetProfileStatus = "setProfileStatus" + reqSetProfiltData = "setProfileData" reqGetOwnContact = "getOwnContact" reqUseVoucher = "useVoucher" reqGetFinanceSystemInformation = "getFinanceSystemInformation" @@ -41,5 +42,6 @@ const ( var ( ErrorSetProfileStatus = errors.New("failed to set profile status") + ErrorSetProfileData = errors.New("failed to set profile data") ErrorClientDisconnected = errors.New("client disconected") )