packages feed

activitypub (empty) → 0.1.0.0

raw patch · 9 files changed

+378/−0 lines, 9 filesdep +aesondep +basedep +network-urisetup-changed

Dependencies added: aeson, base, network-uri, text, time

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Luke Hoersten (c) 2018++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Luke Hoersten nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,1 @@+# activitypub
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ activitypub.cabal view
@@ -0,0 +1,57 @@+name:                activitypub+version:             0.1.0.0+synopsis:            ActivityPub Haskell Library+description:         ActivityPub Haskell library with vocabulary to spec.+homepage:            https://github.com/LukeHoersten/activitypub#readme+license:             BSD3+license-file:        LICENSE+author:              Luke Hoersten+maintainer:          luke@hoersten.org+copyright:           2018 Luke Hoersten+category:            Web+build-type:          Simple+extra-source-files:  README.md+cabal-version:       >=1.10++library+  hs-source-dirs:      src+  exposed-modules:     Network.ActivityPub.Vocabulary.Activity+                     , Network.ActivityPub.Vocabulary.Actor+                     , Network.ActivityPub.Vocabulary.Core+                     , Network.ActivityPub.Vocabulary.Object+                     , Network.ActivityPub.Vocabulary.Properties++  build-depends:       aeson       >= 1.3 && < 1.4+                     , base        >= 4.7 && < 5+                     , network-uri >= 2.6 && < 2.7+                     , text        >= 1.2 && < 1.3+                     , time        >= 1.8 && < 1.10+                     -- , servant-server+                     -- , wai+                     -- , warp+  default-language:    Haskell2010++-- executable activitypub-exe+--   hs-source-dirs:      app+--   main-is:             Main.hs+--   ghc-options:         -threaded -rtsopts -with-rtsopts=-N+--   build-depends:       base+--                      , activitypub+--   default-language:    Haskell2010++-- test-suite activitypub-test+--   type:                exitcode-stdio-1.0+--   hs-source-dirs:      test+--   main-is:             Spec.hs+--   build-depends:       base+--                      , activitypub+--                      , hspec+--                      , hspec-wai+--                      , hspec-wai-json+--                      , aeson+--   ghc-options:         -threaded -rtsopts -with-rtsopts=-N+--   default-language:    Haskell2010++source-repository head+  type:     git+  location: https://github.com/LukeHoersten/activitypub
+ src/Network/ActivityPub/Vocabulary/Activity.hs view
@@ -0,0 +1,32 @@+module Network.ActivityPub.Vocabulary.Activity where++import           Network.ActivityPub.Vocabulary.Core (Activity)++type Accept = Activity+type Add = Activity+type Announce = Activity+type Arrive = Activity+type Block = Activity+type Create = Activity+type Delete = Activity+type Dislike = Activity+type Flag = Activity+type Follow = Activity+type Ignore = Activity+type Invite = Activity+type Join = Activity+type Leave = Activity+type Like = Activity+type Listen = Activity+type Move = Activity+type Offer = Activity+type Question = Activity+type Reject = Activity+type Read = Activity+type Remove = Activity+type TentativeReject = Activity+type TentativeAccept = Activity+type Travel = Activity+type Undo = Activity+type Update = Activity+type View = Activity
+ src/Network/ActivityPub/Vocabulary/Actor.hs view
@@ -0,0 +1,9 @@+module Network.ActivityPub.Vocabulary.Actor where++import           Network.ActivityPub.Vocabulary.Core (Object)++type Application = Object+type Group = Object+type Organization = Object+type Person = Object+type Service = Object
+ src/Network/ActivityPub/Vocabulary/Core.hs view
@@ -0,0 +1,165 @@+module Network.ActivityPub.Vocabulary.Core where++import           Data.Maybe                                (Maybe)+import           Data.Text                                 (Text)+import           Data.Time                                 (UTCTime)+import           Network.URI                               (URI)++import           Network.ActivityPub.Vocabulary.Properties++data Object =+    Object+    { oid               :: URI+    , oObjectProperties :: ObjectProperties+    } deriving (Show, Eq)++type Document = Object+type Image = Document++data Link =+    Link+    { lid             :: URI+    , lLinkProperties :: LinkProperties+    } deriving (Show, Eq)++data Activity =+    Activity+    { aid                 :: URI+    , aObjectProperties   :: ObjectProperties+    , aActivityProperties :: ActivityProperties+    } deriving (Show, Eq)++data Collection =+    Collection+    { cid                   :: URI+    , cObjectProperties     :: ObjectProperties+    , cCollectionProperties :: CollectionProperties+    } deriving (Show, Eq)++type OrderedCollection = Collection++data CollectionPage =+    CollectionPage+    { cpid                       :: URI+    , cpObjectProperties         :: ObjectProperties+    , cpCollectionProperties     :: CollectionProperties+    , cpCollectionPageProperties :: CollectionPageProperties+    } deriving (Show, Eq)++data OrderedCollectionPage =+    OrderedCollectionPage+    { ocpid                       :: URI+    , ocpObjectProperties         :: ObjectProperties+    , ocpCollectionProperties     :: CollectionProperties+    , ocpCollectionPageProperties :: CollectionPageProperties+    , startIndex                  :: Maybe StartIndex+    } deriving (Show, Eq)+++-- Property Data Types+data CollectionPageProperties =+    CollectionPageProperties+    { partOf :: Maybe PartOf+    , next   :: Maybe Next+    , prev   :: Maybe Prev+    } deriving (Show, Eq)++data CollectionProperties =+    CollectionProperties+    { totalItems :: Maybe TotalItems+    , current    :: Maybe Current+    , first      :: Maybe First+    , last       :: Maybe Last+    , items      :: Maybe Items+    } deriving (Show, Eq)++data LinkProperties =+    LinkProperties+    { href      :: Maybe Href+    , rel       :: Maybe Rel+    , mediaType :: Maybe MediaType+    , name      :: Maybe Name+    , hreflang  :: Maybe HrefLang+    , height    :: Maybe Height+    , width     :: Maybe Width+    , preview   :: Maybe Preview+    } deriving (Show, Eq)++data ActivityProperties =+    ActivityProperties+    { actor      :: Maybe Actor+    , object     :: Maybe ObjectRef+    , target     :: Maybe Target+    , result     :: Maybe Result+    , origin     :: Maybe Origin+    , instrument :: Maybe Instrument+    } deriving (Show, Eq)++data ObjectProperties =+    ObjectProperties+    { attachment   :: Maybe Attachment+    , attributedTo :: Maybe AttributedTo+    , audience     :: Maybe Audience+    , content      :: Maybe Content+    , context      :: Maybe Context+    , objName      :: Maybe Name+    , endTime      :: Maybe EndTime+    , generator    :: Maybe Generator+    , icon         :: Maybe Icon+    , image        :: Maybe ImageRef+    , inReplyTo    :: Maybe InReplyTo+    , location     :: Maybe Location+    , objPreview   :: Maybe Preview+    , published    :: Maybe Published+    , replies      :: Maybe Replies+    , startTime    :: Maybe StartTime+    , summary      :: Maybe Summary+    , tag          :: Maybe Tag+    , updated      :: Maybe Updated+    , url          :: Maybe URL+    , to           :: Maybe To+    , bto          :: Maybe Bto+    , cc           :: Maybe Cc+    , bcc          :: Maybe Bcc+    , objMediaType :: Maybe MediaType+    , duration     :: Maybe Duration+    } deriving (Show, Eq)++data Items = Item Object | ItemRef Link | Items [Either Object Link] deriving (Show, Eq)+data Closed = ClosedObject Object | ClosedLink Link | ClosedTime UTCTime | ClosedState Bool deriving (Show, Eq)++type Actor = Either Object Link+type Attachment = Either Object Link+type AttributedTo = Either Object Link+type Audience = Either Object Link+type Bcc = Either Object Link+type Bto = Either Object Link+type Cc = Either Object Link+type Context = Either Object Link+type Current = Either CollectionPage Link+type First = Either CollectionPage Link+type Generator = Either Object Link+type Icon = Either Image Link+type ImageRef = Either Image Link+type InReplyTo = Either Object Link+type Instrument = Either Object Link+type Last = Either CollectionPage Link+type Location = Either Object Link+type OneOf = Either Object Link+type AnyOf = Either Object Link+type Origin = Either Object Link+type Next = Either CollectionPage Link+type ObjectRef = Either Object Link+type Prev = Either CollectionPage Link+type Preview = Either Object Link+type Result = Either Object Link+type Replies = Collection+type Tag = Either Object Link+type Target = Either Object Link+type To = Either Object Link+type URL = Either URI Link+type PartOf = Either Link Collection+type Units = Either Unit URI+type Subject = Either Object Link+type Describes = Object+type FormerType = Object
+ src/Network/ActivityPub/Vocabulary/Object.hs view
@@ -0,0 +1,50 @@+module Network.ActivityPub.Vocabulary.Object where++import           Data.Maybe                                (Maybe)+import           Network.URI                               (URI)++import           Network.ActivityPub.Vocabulary.Core+import           Network.ActivityPub.Vocabulary.Properties++-- Object Types+type Article = Object+type Event = Object+type Note = Object+type Audio = Document+type Page = Document+type Video = Document++data Tombstone = Tombstone+            { tid               :: URI+            , tObjectProperties :: ObjectProperties+            , formerType        :: Maybe FormerType+            , deleted           :: Maybe Deleted+            } deriving (Show, Eq)++data Profile = Profile+            { prid               :: URI+            , prObjectProperties :: ObjectProperties+            , describes          :: Maybe Describes+            } deriving (Show, Eq)++data Place = Place+            { pid               :: URI+            , pObjectProperties :: ObjectProperties+            , accuracy          :: Maybe Accuracy+            , altitude          :: Maybe Altitude+            , latitude          :: Maybe Latitude+            , longitude         :: Maybe Longitude+            , radius            :: Maybe Radius+            , units             :: Maybe Units+            } deriving (Show, Eq)++data Relationship = Relationship+            { rid               :: URI+            , rObjectProperties :: ObjectProperties+            , subject           :: Maybe Subject+            , object            :: Maybe ObjectRef+            , relationship      :: Maybe Relationship+            } deriving (Show, Eq)++-- Link Types+type Mention = Link
+ src/Network/ActivityPub/Vocabulary/Properties.hs view
@@ -0,0 +1,32 @@+module Network.ActivityPub.Vocabulary.Properties where++import           Data.Either (Either)+import           Data.Text   (Text)+import           Data.Time   (NominalDiffTime, UTCTime)+import           Data.Word   (Word)+import           Network.URI (URI)++data Unit = Cm | Feed | Inches | Km | M | Miles deriving (Show, Eq)++type Accuracy = Float+type Altitude = Float+type Content = Text+type Name = Text+type Duration = NominalDiffTime+type Height = Word+type Href = URI+type HrefLang = Text -- [BCP47] Language Tag+type Latitude = Float+type Longitude = Float+type MediaType = Text -- MIME Media Type+type EndTime = UTCTime+type Published = UTCTime+type StartTime = UTCTime+type Radius = Float+type Rel = [Text] -- [RFC5988] or [HTML5] Link Relation+type StartIndex = Word+type Summary = Text+type TotalItems = Word+type Updated = UTCTime+type Width = Word+type Deleted = UTCTime