status-go/protocol/requests/edit_community_category.go
RichΛrd 92032c7158
Community categories (#2228)
* create and edit community categories
* edit categories order
* adding category to chat
* Adding categories to json
2021-05-23 09:34:17 -04:00

35 lines
960 B
Go

package requests
import (
"errors"
"github.com/status-im/status-go/eth-node/types"
)
var ErrEditCommunityCategoryInvalidCommunityID = errors.New("edit-community-category: invalid community id")
var ErrEditCommunityCategoryInvalidCategoryID = errors.New("edit-community-category: invalid category id")
var ErrEditCommunityCategoryInvalidName = errors.New("edit-community-category: invalid category name")
type EditCommunityCategory struct {
CommunityID types.HexBytes `json:"communityId"`
CategoryID string `json:"categoryId"`
CategoryName string `json:"categoryName"`
ChatIDs []string `json:"chatIds"`
}
func (j *EditCommunityCategory) Validate() error {
if len(j.CommunityID) == 0 {
return ErrEditCommunityCategoryInvalidCommunityID
}
if len(j.CategoryID) == 0 {
return ErrEditCommunityCategoryInvalidCategoryID
}
if len(j.CategoryName) == 0 {
return ErrEditCommunityCategoryInvalidName
}
return nil
}