Skip to content
Snippets Groups Projects
Commit c5230220 authored by Jonah Husson's avatar Jonah Husson
Browse files

Add docstring comments to new funcs

parent b6d2b745
No related branches found
No related tags found
2 merge requests!73Add bindings to enable DMs,!67fix for latest client release
......@@ -763,26 +763,6 @@ func (cm *ChannelsManager) JoinChannel(_ js.Value, args []js.Value) any {
return utils.CopyBytesToJS(ci)
}
func (cm *ChannelsManager) EnableDirectMessages(_ js.Value, args []js.Value) any {
marshalledChanId := utils.CopyBytesToGo(args[0])
err := cm.api.EnableDirectMessages(marshalledChanId)
if err != nil {
utils.Throw(utils.TypeError, err)
return nil
}
return nil
}
func (cm *ChannelsManager) DisableDirectMessages(_ js.Value, args []js.Value) any {
marshalledChanId := utils.CopyBytesToGo(args[0])
err := cm.api.DisableDirectMessages(marshalledChanId)
if err != nil {
utils.Throw(utils.TypeError, err)
return nil
}
return nil
}
// LeaveChannel leaves the given channel. It will return the error
// [channels.ChannelDoesNotExistsErr] if the channel was not previously joined.
//
......@@ -848,6 +828,42 @@ func (cm *ChannelsManager) GetChannels(js.Value, []js.Value) any {
return utils.CopyBytesToJS(channelList)
}
// EnableDirectMessages enables the token for direct messaging for this
// channel.
//
// Parameters:
// - args[0] - Marshalled bytes of the channel [id.ID] (Uint8Array).
//
// Returns:
// - Throws a TypeError if saving the DM token fails.
func (cm *ChannelsManager) EnableDirectMessages(_ js.Value, args []js.Value) any {
marshalledChanId := utils.CopyBytesToGo(args[0])
err := cm.api.EnableDirectMessages(marshalledChanId)
if err != nil {
utils.Throw(utils.TypeError, err)
return nil
}
return nil
}
// DisableDirectMessages removes the token for direct messaging for a
// given channel.
//
// Parameters:
// - args[0] - Marshalled bytes of the channel [id.ID] (Uint8Array).
//
// Returns:
// - Throws a TypeError if saving the DM token fails
func (cm *ChannelsManager) DisableDirectMessages(_ js.Value, args []js.Value) any {
marshalledChanId := utils.CopyBytesToGo(args[0])
err := cm.api.DisableDirectMessages(marshalledChanId)
if err != nil {
utils.Throw(utils.TypeError, err)
return nil
}
return nil
}
////////////////////////////////////////////////////////////////////////////////
// Channel Share URL //
////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment