2021-05-23 13:34:17 +00:00
|
|
|
package requests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
|
|
)
|
|
|
|
|
2021-08-25 16:52:28 +00:00
|
|
|
var ErrReorderCommunityChatInvalidCommunityID = errors.New("reorder-community-chat: invalid community id")
|
|
|
|
var ErrReorderCommunityChatInvalidChatID = errors.New("reorder-community-chat: invalid chat id")
|
|
|
|
var ErrReorderCommunityChatInvalidPosition = errors.New("reorder-community-chat: invalid position")
|
2021-05-23 13:34:17 +00:00
|
|
|
|
|
|
|
type ReorderCommunityChat struct {
|
|
|
|
CommunityID types.HexBytes `json:"communityId"`
|
|
|
|
CategoryID string `json:"categoryId"`
|
|
|
|
ChatID string `json:"chatId"`
|
|
|
|
Position int `json:"position"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (j *ReorderCommunityChat) Validate() error {
|
|
|
|
if len(j.CommunityID) == 0 {
|
|
|
|
return ErrReorderCommunityChatInvalidCommunityID
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(j.ChatID) == 0 {
|
|
|
|
return ErrReorderCommunityChatInvalidChatID
|
|
|
|
}
|
|
|
|
|
|
|
|
if j.Position < 0 {
|
|
|
|
return ErrReorderCommunityCategoryInvalidPosition
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|