message.go 667 B

12345678910111213141516171819202122232425262728
  1. package jpushclient
  2. type Message struct {
  3. Content string `json:"msg_content"`
  4. Title string `json:"title,omitempty"`
  5. ContentType string `json:"content_type,omitempty"`
  6. Extras map[string]interface{} `json:"extras,omitempty"`
  7. }
  8. func (this *Message) SetContent(c string) {
  9. this.Content = c
  10. }
  11. func (this *Message) SetTitle(title string) {
  12. this.Title = title
  13. }
  14. func (this *Message) SetContentType(t string) {
  15. this.ContentType = t
  16. }
  17. func (this *Message) AddExtras(key string, value interface{}) {
  18. if this.Extras == nil {
  19. this.Extras = make(map[string]interface{})
  20. }
  21. this.Extras[key] = value
  22. }