-
Notifications
You must be signed in to change notification settings - Fork 0
/
TiposDatos.hs
91 lines (73 loc) · 1.91 KB
/
TiposDatos.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module TiposDatos
(
Account,
defaultAccount,
--Accesor methods
phoneNumber, email, createdVia, username, accountId , createdAt, accountDisplayName,
Description,
bio,website,location,
Profile,
defaultProfile,
description,avatarMediaUrl,
Verified,
defaultVerified,
--Accesor methods
verified,
Tweets,
Tweet,
--defaultTweets,
defaultTweet,
favorite_count,
retweet_count,
created_at,
full_text,
lang,
) where
import GHC.Generics
import Data.Aeson
import qualified Data.ByteString.Lazy as B
data Account = Account {
phoneNumber :: String,
email :: String,
createdVia :: String,
username :: String,
accountId :: String,
createdAt :: String,
accountDisplayName :: String
} deriving (Generic, Show)
instance FromJSON Account
defaultAccount = Account { phoneNumber = "", email = "", createdVia ="", username ="", accountId ="", createdAt ="", accountDisplayName =""}
data Description = Description {
bio :: String,
website :: String,
location :: String
} deriving (Generic, Show)
instance FromJSON Description
defaultDescription = Description {bio="", website="", location=""}
data Profile = Profile {
description :: Description,
avatarMediaUrl :: String
} deriving (Generic, Show)
instance FromJSON Profile
defaultProfile = Profile {description=defaultDescription, avatarMediaUrl=""}
data Verified = Verified {
verified :: Bool
} deriving (Generic, Show)
instance FromJSON Verified
defaultVerified = Verified {verified=False}
----------------------------Tweets
data Tweet = Tweet {
favorite_count :: String,
retweet_count :: String,
created_at :: String,
full_text :: String,
lang :: String
} deriving (Generic, Show)
instance FromJSON Tweet
defaultTweet = Tweet {full_text="", created_at="", lang="", retweet_count="", favorite_count=""}
data Tweets = Tweets {
tweets :: [Tweet]
} deriving (Generic, Show)
instance FromJSON Tweets