github.com/iotexproject/iotex-core@v1.14.1-rc1/ioctl/cmd/ws/wsmessage.go (about)

     1  package ws
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/spf13/cobra"
     7  
     8  	"github.com/iotexproject/iotex-core/ioctl/config"
     9  )
    10  
    11  var (
    12  	// wsMessage represents the w3bstream message command
    13  	wsMessage = &cobra.Command{
    14  		Use:   "message",
    15  		Short: config.TranslateInLang(wsMessageShorts, config.UILanguage),
    16  	}
    17  
    18  	// wsMessageShorts w3bstream message shorts multi-lang support
    19  	wsMessageShorts = map[config.Language]string{
    20  		config.English: "w3bstream message operations",
    21  		config.Chinese: "w3bstream消息操作",
    22  	}
    23  
    24  	_flagDIDVCTokenUsages = map[config.Language]string{
    25  		config.English: "DID VC token",
    26  		config.Chinese: "DID VC 令牌",
    27  	}
    28  )
    29  
    30  func init() {
    31  	wsMessage.AddCommand(wsMessageSend)
    32  	wsMessage.AddCommand(wsMessageQuery)
    33  }
    34  
    35  type sendMessageReq struct {
    36  	ProjectID      uint64 `json:"projectID"`
    37  	ProjectVersion string `json:"projectVersion"`
    38  	Data           string `json:"data"`
    39  }
    40  
    41  type sendMessageRsp struct {
    42  	MessageID string `json:"messageID"`
    43  }
    44  
    45  type stateLog struct {
    46  	State   string    `json:"state"`
    47  	Time    time.Time `json:"time"`
    48  	Comment string    `json:"comment"`
    49  }
    50  
    51  type queryMessageRsp struct {
    52  	MessageID string      `json:"messageID"`
    53  	States    []*stateLog `json:"states"`
    54  }