Removed obsolete datetime dependency in favor of time
Getty Ritter
10 years ago
| 84 | 84 | , fromJSON |
| 85 | 85 | ) |
| 86 | 86 | import qualified Data.Aeson as A |
| 87 |
import Data. |
|
| 87 | import Data.Time.Clock (UTCTime) | |
| 88 | 88 | import qualified Data.HashMap.Strict as HM |
| 89 | 89 | import Data.Text (Text) |
| 90 | 90 | |
| 233 | 233 | |
| 234 | 234 | -- | The date and time at which the object was published. An object MAY |
| 235 | 235 | -- contain a @published@ property. |
| 236 |
oPublished :: Lens' Object (Maybe |
|
| 236 | oPublished :: Lens' Object (Maybe UTCTime) | |
| 237 | 237 | oPublished = makeAesonLensMb "published" oRest |
| 238 | 238 | |
| 239 | 239 | -- | Natural-language summarization of the object encoded as a single |
| 244 | 244 | |
| 245 | 245 | -- | The date and time at which a previously published object has been |
| 246 | 246 | -- modified. An Object MAY contain an @updated@ property. |
| 247 |
oUpdated :: Lens' Object (Maybe |
|
| 247 | oUpdated :: Lens' Object (Maybe UTCTime) | |
| 248 | 248 | oUpdated = makeAesonLensMb "updated" oRest |
| 249 | 249 | |
| 250 | 250 | -- | A JSON Array of one or more absolute IRI's |
| 333 | 333 | |
| 334 | 334 | -- | The date and time at which the activity was published. An activity |
| 335 | 335 | -- MUST contain a @published@ property. |
| 336 |
acPublished :: Lens' Activity |
|
| 336 | acPublished :: Lens' Activity UTCTime | |
| 337 | 337 | acPublished = makeAesonLens "published" acRest |
| 338 | 338 | |
| 339 | 339 | -- | Describes the application that published the activity. Note that this |
| 362 | 362 | |
| 363 | 363 | -- | The date and time at which a previously published activity has |
| 364 | 364 | -- been modified. An Activity MAY contain an @updated@ property. |
| 365 |
acUpdated :: Lens' Activity (Maybe |
|
| 365 | acUpdated :: Lens' Activity (Maybe UTCTime) | |
| 366 | 366 | acUpdated = makeAesonLensMb "updated" acRest |
| 367 | 367 | |
| 368 | 368 | -- | An IRI <http://www.ietf.org/rfc/rfc3987.txt RFC3987> |
| 384 | 384 | |
| 385 | 385 | -- | Create an @Activity@ with an @actor@, @published@, and |
| 386 | 386 | -- @provider@ property. |
| 387 |
makeActivity :: Object -> |
|
| 387 | makeActivity :: Object -> UTCTime -> Activity | |
| 388 | 388 | makeActivity actor published = Activity |
| 389 | 389 | $ HM.insert "actor" (toJSON actor) |
| 390 | 390 | $ HM.insert "published" (toJSON published) |
| 88 | 88 | |
| 89 | 89 | import qualified Data.Aeson as Aeson |
| 90 | 90 | import Data.Aeson.TH (deriveJSON) |
| 91 |
import Data. |
|
| 91 | import Data.Time.Clock (UTCTime) | |
| 92 | 92 | import Data.Aeson ( FromJSON(..), ToJSON(..) ) |
| 93 | 93 | import qualified Data.HashMap.Strict as HM |
| 94 | 94 | import Data.Text (Text) |
| 698 | 698 | |
| 699 | 699 | -- | The date and time that the event ends represented as a String |
| 700 | 700 | -- conforming to the "date-time" production in [RFC3339]. |
| 701 |
evEndTime :: Lens' Object (Maybe |
|
| 701 | evEndTime :: Lens' Object (Maybe UTCTime) | |
| 702 | 702 | evEndTime = makeAesonLensMb "endTime" oRest |
| 703 | 703 | |
| 704 | 704 | -- | A collection object as defined in Section 3.5 of the JSON |
| 727 | 727 | |
| 728 | 728 | -- | The date and time that the event begins represented as a String |
| 729 | 729 | -- confirming to the "date-time" production in RFC 3339. |
| 730 |
evStartTime :: Lens' Object (Maybe |
|
| 730 | evStartTime :: Lens' Object (Maybe UTCTime) | |
| 731 | 731 | evStartTime = makeAesonLensMb "startTime" oRest |
| 732 | 732 | |
| 733 | 733 | -- issue |
| 811 | 811 | |
| 812 | 812 | -- | A RFC 3339 date-time specifying the date and time by which the |
| 813 | 813 | -- task is to be completed. |
| 814 |
tsBy :: Lens' Object (Maybe |
|
| 814 | tsBy :: Lens' Object (Maybe UTCTime) | |
| 815 | 815 | tsBy = makeAesonLensMb "by" oRest |
| 816 | 816 | |
| 817 | 817 | -- | An Activity Streams object describing the object of the task. |
| 1 | 1 | name: activitystreams-aeson |
| 2 |
version: 0.2.0. |
|
| 2 | version: 0.2.0.1 | |
| 3 | 3 | synopsis: An interface to the ActivityStreams specification |
| 4 | 4 | description: An interface to the |
| 5 | 5 | <http://activitystrea.ms/ Activity Streams> |
| 32 | 32 | build-depends: base >=4.7 && <4.8, |
| 33 | 33 | aeson ==0.8.*, |
| 34 | 34 | text >=1.1, |
| 35 |
|
|
| 35 | time >=1.4, | |
| 36 | 36 | unordered-containers >=0.2.5 |
| 37 | 37 | default-language: Haskell2010 |