Commits

Sebastián Magrí  committed cd4e675

Comments will not need showInfo

  • Participants
  • Parent commits c33cc88

Comments (0)

Files changed (2)

File src/Network/SoundCloud.hs

 import Network.SoundCloud.Util (scGet, scFetch, scResolve, scResourceType)
 
 import qualified Network.SoundCloud.App as App
-import qualified Network.SoundCloud.Comment as Comment
 import qualified Network.SoundCloud.Group as Group
 import qualified Network.SoundCloud.Set as Set
 import qualified Network.SoundCloud.Track as Track
 
 scResourceShowInfo :: String -> IO ()
 scResourceShowInfo url | scResourceType url == "track"   = Track.showInfo url
-                       | scResourceType url == "user"    = User.showInfo url
-                       | scResourceType url == "set"     = Set.showInfo url
-                       | scResourceType url == "group"   = Group.showInfo url
-                       | scResourceType url == "comment" = Comment.showInfo url
+                       | scResourceType url == "user"    = User.showInfo
+                       | scResourceType url == "set"     = Set.showInfo
+                       | scResourceType url == "group"   = Group.showInfo
                        | scResourceType url == "app"     = App.showInfo url
 scResourceShowInfo _                                     = putStrLn "Unrecognized resource"
 

File src/Network/SoundCloud/Comment.hs

 import qualified Data.ByteString.Lazy.Char8 as BSL
 import GHC.Generics (Generic)
 
-import qualified Network.SoundCloud.User as User
+import qualified Network.SoundCloud.MiniUser as User
 
-data JsonRecord = JsonRecord { id                     :: Int
-                             , created_at             :: String
-                             , body                   :: String
-                             , timestamp              :: Int
-                             , user                   :: User.JsonRecord
-                             , track_id               :: Int
-                             } deriving (Show, Generic)
+data Json = Json { id                     :: Int
+                 , created_at             :: String
+                 , body                   :: String
+                 , timestamp              :: Maybe Int
+                 , user                   :: User.JsonRecord
+                 , track_id               :: Int
+                 } deriving (Show, Generic)
 
-instance FromJSON JsonRecord
-instance ToJSON   JsonRecord
+instance FromJSON Json
+instance ToJSON   Json
 
-decodeJSON :: String -> Maybe JsonRecord
-decodeJSON dat = decode (BSL.pack dat) :: Maybe JsonRecord
-
-showInfo :: String -> IO ()
-showInfo trackUrl = putStrLn "Not Implemented"
+decodeJson :: String -> Maybe Json
+decodeJson dat = decode (BSL.pack dat) :: Maybe Json