PushMessage.swift 833 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // PushMessage.swift
  3. // LoopFollow
  4. //
  5. // Created by Jonas Björkert on 2024-08-27.
  6. // Copyright © 2024 Jon Fawcett. All rights reserved.
  7. //
  8. import Foundation
  9. struct PushMessage: Encodable {
  10. let aps: [String: Int] = ["content-available": 1]
  11. var user: String
  12. var commandType: String
  13. var bolusAmount: Decimal?
  14. var target: Int?
  15. var duration: Int?
  16. var carbs: Int?
  17. var protein: Int?
  18. var fat: Int?
  19. var sharedSecret: String
  20. var timestamp: TimeInterval
  21. enum CodingKeys: String, CodingKey {
  22. case aps
  23. case user
  24. case commandType = "command_type"
  25. case bolusAmount = "bolus_amount"
  26. case target
  27. case duration
  28. case carbs
  29. case protein
  30. case fat
  31. case sharedSecret = "shared_secret"
  32. case timestamp
  33. }
  34. }