Merge pull request #1 from hallettj/pull-requests
PR looks good to me. (As a semi-relevant aside: I might eventually remove the non-Dynamic module and make Dynamic the primary way of interacting with the library. I hope that would make sense!)
G. D. Ritter
10 years ago
47 | 47 | , acGenerator |
48 | 48 | , acIcon |
49 | 49 | , acId |
50 | , acObject | |
50 | 51 | , acPublished |
51 | 52 | , acProvider |
52 | 53 | , acTarget |
56 | 57 | , acVerb |
57 | 58 | , acRest |
58 | 59 | , makeActivity |
60 | , asObject | |
59 | 61 | -- * Collection |
60 | 62 | , Collection |
61 | 63 | , cTotalItems |
198 | 200 | acId :: Lens' Activity (Maybe Text) |
199 | 201 | acId = makeAesonLensMb "id" acRest |
200 | 202 | |
203 | acObject :: Lens' Activity (Maybe Object) | |
204 | acObject = makeAesonLensMb "object" acRest | |
205 | ||
201 | 206 | acPublished :: Lens' Activity DateTime |
202 | 207 | acPublished = makeAesonLens "published" acRest |
203 | 208 | |
221 | 226 | |
222 | 227 | -- | Create an @Activity@ with an @actor@, @published@, and |
223 | 228 | -- @provider@ property. |
224 | makeActivity :: Object -> DateTime -> Object -> Activity | |
225 | makeActivity actor published provider = Activity | |
229 | makeActivity :: Object -> DateTime -> Activity | |
230 | makeActivity actor published = Activity | |
226 | 231 | $ HM.insert "actor" (toJSON actor) |
227 | 232 | $ HM.insert "published" (toJSON published) |
228 | $ HM.insert "provider" (toJSON provider) | |
229 | 233 | $ HM.empty |
234 | ||
235 | -- | JSON Activity Streams 1.0 specificies that an @Activity@ may be used as an | |
236 | -- @Object@. In such a case, the object may have fields permitted on either an | |
237 | -- @Activity@ or an @Object@ | |
238 | asObject :: Activity -> Object | |
239 | asObject act = Object (fromActivity act) | |
230 | 240 | |
231 | 241 | -- | Collection |
232 | 242 |