gmessages/libgm/messages.go

26 lines
934 B
Go
Raw Normal View History

package libgm
import (
2023-07-17 13:51:31 +00:00
"go.mau.fi/mautrix-gmessages/libgm/gmproto"
)
2023-07-17 23:57:20 +00:00
func (c *Client) SendReaction(payload *gmproto.SendReactionRequest) (*gmproto.SendReactionResponse, error) {
2023-07-17 13:51:31 +00:00
actionType := gmproto.ActionType_SEND_REACTION
2023-07-17 23:11:43 +00:00
return typedResponse[*gmproto.SendReactionResponse](c.sessionHandler.sendMessage(actionType, payload))
}
2023-07-17 13:51:31 +00:00
func (c *Client) DeleteMessage(messageID string) (*gmproto.DeleteMessageResponse, error) {
2023-07-17 23:57:20 +00:00
payload := &gmproto.DeleteMessageRequest{MessageID: messageID}
2023-07-17 13:51:31 +00:00
actionType := gmproto.ActionType_DELETE_MESSAGE
2023-07-17 23:11:43 +00:00
return typedResponse[*gmproto.DeleteMessageResponse](c.sessionHandler.sendMessage(actionType, payload))
}
2023-07-15 11:38:24 +00:00
func (c *Client) MarkRead(conversationID, messageID string) error {
2023-07-17 23:57:20 +00:00
payload := &gmproto.MessageReadRequest{ConversationID: conversationID, MessageID: messageID}
2023-07-17 13:51:31 +00:00
actionType := gmproto.ActionType_MESSAGE_READ
2023-07-15 11:38:24 +00:00
2023-07-15 22:45:57 +00:00
_, err := c.sessionHandler.sendMessage(actionType, payload)
return err
2023-07-15 11:38:24 +00:00
}