2021-01-11 10:32:51 +00:00
|
|
|
package requests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
var ErrShareCommunityInvalidID = errors.New("share-community: invalid id")
|
|
|
|
var ErrShareCommunityEmptyUsers = errors.New("share-community: empty users")
|
|
|
|
|
|
|
|
type ShareCommunity struct {
|
2022-08-08 10:49:39 +00:00
|
|
|
CommunityID types.HexBytes `json:"communityId"`
|
|
|
|
Users []types.HexBytes `json:"users"`
|
|
|
|
InviteMessage string `json:"inviteMessage,omitempty"`
|
2021-01-11 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (j *ShareCommunity) Validate() error {
|
|
|
|
if len(j.CommunityID) == 0 {
|
|
|
|
return ErrShareCommunityInvalidID
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(j.Users) == 0 {
|
|
|
|
return ErrShareCommunityEmptyUsers
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|