2021-06-07 08:31:27 +00:00
|
|
|
package requests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
2023-08-31 07:21:25 +00:00
|
|
|
"github.com/status-im/status-go/protocol/common"
|
2021-06-07 08:31:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var ErrEditMessageInvalidID = errors.New("edit-message: invalid id")
|
|
|
|
var ErrEditMessageInvalidText = errors.New("edit-message: invalid text")
|
|
|
|
|
|
|
|
type EditMessage struct {
|
2024-12-03 15:04:21 +00:00
|
|
|
ID types.HexBytes `json:"id"`
|
|
|
|
Text string `json:"text"`
|
|
|
|
LinkPreviews []common.LinkPreview `json:"linkPreviews"`
|
|
|
|
StatusLinkPreviews []common.StatusLinkPreview `json:"statusLinkPreviews"`
|
2021-06-07 08:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EditMessage) Validate() error {
|
|
|
|
if len(e.ID) == 0 {
|
|
|
|
return ErrEditMessageInvalidID
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(e.Text) == 0 {
|
|
|
|
return ErrEditMessageInvalidText
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|