Schema.hs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. {-# LANGUAGE TemplateHaskell #-}
  2. module Codec.ActivityStream.Schema where
  3. import Data.Aeson hiding (Object)
  4. import Data.Aeson.TH
  5. import Data.DateTime
  6. import Data.Text (Text)
  7. import Codec.ActivityStream.Internal
  8. import Codec.ActivityStream.Representation
  9. data SchemaVerb
  10. = Accept
  11. | Access
  12. | Acknowledge
  13. | Add
  14. | Agree
  15. | Append
  16. | Approve
  17. | Archive
  18. | Assign
  19. | At
  20. | Attach
  21. | Attend
  22. | Author
  23. | Authorize
  24. | Borrow
  25. | Build
  26. | Cancel
  27. | Close
  28. | Complete
  29. | Confirm
  30. | Consume
  31. | Checkin
  32. | Create
  33. | Delete
  34. | Deliver
  35. | Deny
  36. | Disagree
  37. | Dislike
  38. | Experience
  39. | Favorite
  40. | Find
  41. | FlagAsInappropriate
  42. | Follow
  43. | Give
  44. | Host
  45. | Ignore
  46. | Insert
  47. | Install
  48. | Interact
  49. | Invite
  50. | Join
  51. | Leave
  52. | Like
  53. | Listen
  54. | Lose
  55. | MakeFriend
  56. | Open
  57. | Play
  58. | Post
  59. | Present
  60. | Purchase
  61. | Qualify
  62. | Read
  63. | Receive
  64. | Reject
  65. | Remove
  66. | RemoveFriend
  67. | Replace
  68. | Request
  69. | RequestFriend
  70. | Resolve
  71. | Return
  72. | Retract
  73. | RsvpMaybe
  74. | RsvpNo
  75. | RsvpYes
  76. | Satisfy
  77. | Save
  78. | Schedule
  79. | Search
  80. | Sell
  81. | Send
  82. | Share
  83. | Sponsor
  84. | Start
  85. | StopFollowing
  86. | Submit
  87. | Tag
  88. | Terminate
  89. | Tie
  90. | Unfavorite
  91. | Unlike
  92. | Unsatisfy
  93. | Unsave
  94. | Unshare
  95. | Update
  96. | Use
  97. | Watch
  98. | Win
  99. deriving (Eq, Show, Read)
  100. deriveJSON (commonOptsCC "") ''SchemaVerb
  101. data SchemaObjectType
  102. = Alert
  103. | Application
  104. | Article
  105. | Audio
  106. | Badge
  107. | Binary
  108. | Bookmark
  109. | Collection
  110. | Comment
  111. | Device
  112. | Event
  113. | File
  114. | Game
  115. | Group
  116. | Image
  117. | Issue
  118. | Job
  119. | Note
  120. | Offer
  121. | Organization
  122. | Page
  123. | Person
  124. | Place
  125. | Process
  126. | Product
  127. | Question
  128. | Review
  129. | Service
  130. | Task
  131. | Video
  132. deriving (Eq, Show, Read)
  133. deriveJSON (commonOptsCC "") ''SchemaObjectType
  134. type SchemaObject = Object SchemaObjectType
  135. type SchemaCollection = Collection SchemaObjectType
  136. data AVObj = AVObj
  137. { avEmbedCode :: Maybe Text
  138. , avStream :: Maybe MediaLink
  139. , avRest :: SchemaObject
  140. } deriving (Eq, Show)
  141. data BinaryObj = BinaryObj
  142. { bnCompression :: Maybe Text
  143. , bnData :: Maybe Text
  144. , bnFileUrl :: Maybe Text
  145. , bnLength :: Maybe Int
  146. , bnMd5 :: Maybe Text
  147. , bnMimeType :: Maybe Text
  148. , bnRest :: SchemaObject
  149. } deriving (Eq, Show)
  150. data EventObj = EventObj
  151. { evAttendedBy :: Maybe SchemaCollection
  152. , evAttending :: Maybe SchemaCollection
  153. , evEndTime :: Maybe DateTime
  154. , evInvited :: Maybe SchemaCollection
  155. , evMaybeAttending :: Maybe SchemaCollection
  156. , evNotAttendedBy :: Maybe SchemaCollection
  157. , evNotAttending :: Maybe SchemaCollection
  158. , evStartTime :: Maybe DateTime
  159. , evRest :: SchemaObject
  160. } deriving (Eq, Show)
  161. data IssueObj = IssueObj
  162. { isTypes :: Maybe [Text]
  163. , isRest :: SchemaObject
  164. } deriving (Eq, Show)
  165. data PlaceObj = PlaceObj
  166. { plPosition :: Maybe PlacePositionObj
  167. , plAddress :: Maybe PlaceAddressObj
  168. , plRest :: SchemaObject
  169. } deriving (Eq, Show)
  170. data PlacePositionObj = PlacePositionObj
  171. { ppAltitude :: Integer
  172. , ppLatitude :: Integer
  173. , ppLongitude :: Integer
  174. } deriving (Eq, Show)
  175. data PlaceAddressObj = PlaceAddressObj
  176. { paFormatted :: Text
  177. , paStreetAddress :: Text
  178. , paLocality :: Text
  179. , paRegion :: Text
  180. , paPostalCode :: Text
  181. , paCountry :: Text
  182. } deriving (Eq, Show)
  183. data TaskObj = TaskObj
  184. { tsActor :: Maybe SchemaObject
  185. , tsBy :: Maybe DateTime
  186. , tsObject :: Maybe SchemaObject
  187. , tsPrerequisites :: Maybe [TaskObj]
  188. , tsRequired :: Maybe Bool
  189. , tsSupersedes :: Maybe [TaskObj]
  190. , tsVerb :: Maybe SchemaVerb
  191. , tsRest :: SchemaObject
  192. } deriving (Eq, Show)