push.go 636 B

123456789101112131415161718192021222324252627
  1. package bullet
  2. import (
  3. "bytes"
  4. )
  5. type pushStruct struct {
  6. Type string `json:"type"`
  7. Title string `json:"title"`
  8. Body string `json:"body"`
  9. Url string `json:"url"`
  10. DeviceID string `json:"device_iden"`
  11. }
  12. func (p pushStruct) getReader() (*bytes.Buffer, error) {
  13. return getReader(p)
  14. }
  15. func newNotePush(title, text, deviceID string) pushStruct {
  16. push := pushStruct{Type: "note", Title: title, Body: text, DeviceID: deviceID}
  17. return push
  18. }
  19. func newLinkPush(title, text, link, deviceID string) pushStruct {
  20. push := pushStruct{Type: "note", Title: title, Body: text, Url: link, DeviceID: deviceID}
  21. return push
  22. }