From 1cdba57bc4d69087772752c5e236b9e306ebcca4 Mon Sep 17 00:00:00 2001 From: Sagleft Date: Wed, 15 Feb 2023 12:38:04 +0200 Subject: [PATCH] add `EnableReadOnly` method --- v2/internal/utopia/client.go | 8 ++++++++ v2/messenger.go | 3 +++ 2 files changed, 11 insertions(+) diff --git a/v2/internal/utopia/client.go b/v2/internal/utopia/client.go index a80b011..46147dd 100644 --- a/v2/internal/utopia/client.go +++ b/v2/internal/utopia/client.go @@ -463,3 +463,11 @@ func (c *UtopiaClient) GetNetworkConnections() ([]structs.PeerInfo, error) { return data.Connections, nil } + +func (c *UtopiaClient) EnableReadOnly(channelID string, readOnly bool) error { + _, err := c.apiQuery("modifyChannel", map[string]interface{}{ + "channelid": channelID, + "read_only": readOnly, + }) + return err +} diff --git a/v2/messenger.go b/v2/messenger.go index 93b6ded..6f7fae6 100644 --- a/v2/messenger.go +++ b/v2/messenger.go @@ -128,6 +128,9 @@ type Client interface { // GetNetworkConnections - get current network peers GetNetworkConnections() ([]structs.PeerInfo, error) + + // EnableReadOnly - convert chat to channel + EnableReadOnly(channelID string, readOnly bool) error } type Config = utopia.Config