github.com/status-im/status-go@v1.1.0/protocol/requests/create_community_category.go (about) 1 package requests 2 3 import ( 4 "errors" 5 6 "github.com/status-im/status-go/eth-node/types" 7 ) 8 9 var ErrCreateCommunityCategoryInvalidCommunityID = errors.New("create-community-category: invalid community id") 10 var ErrCreateCommunityCategoryInvalidName = errors.New("create-community-category: invalid category name") 11 12 type CreateCommunityCategory struct { 13 CommunityID types.HexBytes `json:"communityId"` 14 CategoryName string `json:"categoryName"` 15 ChatIDs []string `json:"chatIds"` 16 ThirdPartyID string `json:"thirdPartyID,omitempty"` 17 } 18 19 func (j *CreateCommunityCategory) Validate() error { 20 if len(j.CommunityID) == 0 { 21 return ErrCreateCommunityCategoryInvalidCommunityID 22 } 23 24 if len(j.CategoryName) == 0 { 25 return ErrCreateCommunityCategoryInvalidName 26 } 27 28 return nil 29 }