github.com/status-im/status-go@v1.1.0/protocol/requests/share_image_message.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 ErrShareMessageInvalidID = errors.New("share image message: invalid id")
    10  var ErrShareMessageEmptyUsers = errors.New("share image message: empty users")
    11  
    12  type ShareImageMessage struct {
    13  	MessageID string           `json:"id"`
    14  	Users     []types.HexBytes `json:"users"`
    15  }
    16  
    17  func (s *ShareImageMessage) Validate() error {
    18  	if len(s.MessageID) == 0 {
    19  		return ErrShareMessageInvalidID
    20  	}
    21  
    22  	if len(s.Users) == 0 {
    23  		return ErrShareMessageEmptyUsers
    24  	}
    25  
    26  	return nil
    27  }