message.go 709 B

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