github.com/morlay/goqcloud@v0.0.0-20181123023149-b00e0b0b9afc/clients/iotcloud/publish_message.go (about) 1 package iotcloud 2 3 import ( 4 github_com_morlay_goqcloud "github.com/morlay/goqcloud" 5 ) 6 7 // 发布消息 8 // https://cloud.tencent.com/document/api/634/19486 9 10 type PublishMessageRequest struct { 11 // 设备名称 12 DeviceName string `name:"DeviceName"` 13 // 消息内容 14 Payload string `name:"Payload"` 15 // 产品ID 16 ProductId string `name:"ProductId"` 17 // 服务质量等级,取值为0, 1 18 Qos *int64 `name:"Qos,omitempty"` 19 // 区域 20 Region string `name:"Region"` 21 // 消息发往的主题。命名规则:${ProductId}/${DeviceName}/[a-zA-Z0-9:_-]{1,128} 22 Topic string `name:"Topic"` 23 } 24 25 func (req *PublishMessageRequest) Invoke(client github_com_morlay_goqcloud.Client) (*PublishMessageResponse, error) { 26 resp := &PublishMessageResponse{} 27 err := client.Request("iotcloud", "PublishMessage", "2018-06-14").Do(req, resp) 28 return resp, err 29 } 30 31 type PublishMessageResponse struct { 32 github_com_morlay_goqcloud.TencentCloudBaseResponse 33 }