gdritter repos activitystreams-aeson / 4eb40b3
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
2 changed file(s) with 15 addition(s) and 4 deletion(s). Collapse all Expand all
4747 , acGenerator
4848 , acIcon
4949 , acId
50 , acObject
5051 , acPublished
5152 , acProvider
5253 , acTarget
5657 , acVerb
5758 , acRest
5859 , makeActivity
60 , asObject
5961 -- * Collection
6062 , Collection
6163 , cTotalItems
198200 acId :: Lens' Activity (Maybe Text)
199201 acId = makeAesonLensMb "id" acRest
200202
203 acObject :: Lens' Activity (Maybe Object)
204 acObject = makeAesonLensMb "object" acRest
205
201206 acPublished :: Lens' Activity DateTime
202207 acPublished = makeAesonLens "published" acRest
203208
221226
222227 -- | Create an @Activity@ with an @actor@, @published@, and
223228 -- @provider@ property.
224 makeActivity :: Object -> DateTime -> Object -> Activity
225 makeActivity actor published provider = Activity
229 makeActivity :: Object -> DateTime -> Activity
230 makeActivity actor published = Activity
226231 $ HM.insert "actor" (toJSON actor)
227232 $ HM.insert "published" (toJSON published)
228 $ HM.insert "provider" (toJSON provider)
229233 $ 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)
230240
231241 -- | Collection
232242
2121 Codec.ActivityStream.Representation,
2222 Codec.ActivityStream.Schema,
2323 Codec.ActivityStream
24 other-modules: Codec.ActivityStream.Internal
24 other-modules: Codec.ActivityStream.Internal,
25 Codec.ActivityStream.LensInternal
2526 build-depends: base >=4.7 && <4.8,
2627 aeson,
2728 text,