github.com/status-im/status-go@v1.1.0/protocol/requests/mute_community_request.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 ErrInvalidMuteCommunityParams = errors.New("mute-community: invalid params")
    10  
    11  type MuteCommunity struct {
    12  	CommunityID types.HexBytes  `json:"communityId"`
    13  	MutedType   MutingVariation `json:"mutedType"`
    14  }
    15  
    16  func (a *MuteCommunity) Validate() error {
    17  	if len(a.CommunityID) == 0 {
    18  		return ErrInvalidMuteCommunityParams
    19  	}
    20  
    21  	if a.MutedType < 0 {
    22  		return ErrInvalidMuteCommunityParams
    23  	}
    24  
    25  	return nil
    26  }