• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package kotlinx.benchmarks.model
2 
3 import kotlinx.serialization.*
4 import kotlinx.serialization.json.*
5 
6 @Serializable
7 data class MacroTwitterFeed(
8     val statuses: List<TwitterStatus>,
9     val search_metadata: SearchMetadata
10 )
11 
12 @Serializable
13 data class MicroTwitterFeed(
14     val statuses: List<TwitterTrimmedStatus>
15 )
16 
17 @Serializable
18 data class TwitterTrimmedStatus(
19     val metadata: Metadata,
20     val created_at: String,
21     val id: Long,
22     val id_str: String,
23     val text: String,
24     val source: String,
25     val truncated: Boolean,
26     val user: TwitterTrimmedUser,
27     val retweeted_status: TwitterTrimmedStatus? = null,
28 )
29 
30 @Serializable
31 data class TwitterStatus(
32     val metadata: Metadata,
33     val created_at: String,
34     val id: Long,
35     val id_str: String,
36     val text: String,
37     val source: String,
38     val truncated: Boolean,
39     val in_reply_to_status_id: Long?,
40     val in_reply_to_status_id_str: String?,
41     val in_reply_to_user_id: Long?,
42     val in_reply_to_user_id_str: String?,
43     val in_reply_to_screen_name: String?,
44     val user: TwitterUser,
45     val geo: String?,
46     val coordinates: String?,
47     val place: String?,
48     val contributors: List<String>?,
49     val retweeted_status: TwitterStatus? = null,
50     val retweet_count: Int,
51     val favorite_count: Int,
52     val entities: StatusEntities,
53     val favorited: Boolean,
54     val retweeted: Boolean,
55     val lang: String,
56     val possibly_sensitive: Boolean? = null
57 )
58 
59 @Serializable
60 data class StatusEntities(
61     val hashtags: List<Hashtag>,
62     val symbols: List<String>,
63     val urls: List<Url>,
64     val user_mentions: List<TwitterUserMention>,
65     val media: List<TwitterMedia>? = null
66 )
67 
68 @Serializable
69 data class TwitterMedia(
70     val id: Long,
71     val id_str: String,
72     val url: String,
73     val media_url: String,
74     val media_url_https: String,
75     val expanded_url: String,
76     val display_url: String,
77     val indices: List<Int>,
78     val type: String,
79     val sizes: SizeType,
80     val source_status_id: Long? = null,
81     val source_status_id_str: String? = null
82 )
83 
84 @Serializable
85 data class SizeType(
86     val large: Size,
87     val medium: Size,
88     val thumb: Size,
89     val small: Size
90 )
91 
92 @Serializable
93 data class Size(val w: Int, val h: Int, val resize: String)
94 
95 @Serializable
96 data class TwitterUserMention(
97     val screen_name: String,
98     val name: String,
99     val id: Long,
100     val id_str: String,
101     val indices: List<Int>
102 )
103 
104 @Serializable
105 data class Urls(val urls: List<Url>)
106 
107 @Serializable
108 data class Metadata(
109     val result_type: String,
110     val iso_language_code: String
111 )
112 
113 @Serializable
114 data class TwitterTrimmedUser(
115     val id: Long,
116     val id_str: String,
117     val name: String,
118     val screen_name: String,
119     val location: String,
120     val description: String,
121     val url: String?,
122     val entities: UserEntities,
123     val protected: Boolean,
124     val followers_count: Int,
125     val friends_count: Int,
126     val listed_count: Int,
127     val created_at: String,
128     val favourites_count: Int,
129 )
130 
131 @Serializable
132 data class TwitterUser(
133     val id: Long,
134     val id_str: String,
135     val name: String,
136     val screen_name: String,
137     val location: String,
138     val description: String,
139     val url: String?,
140     val entities: UserEntities,
141     val protected: Boolean,
142     val followers_count: Int,
143     val friends_count: Int,
144     val listed_count: Int,
145     val created_at: String,
146     val favourites_count: Int,
147     val utc_offset: Int?,
148     val time_zone: String?,
149     val geo_enabled: Boolean,
150     val verified: Boolean,
151     val statuses_count: Int,
152     val lang: String,
153     val contributors_enabled: Boolean,
154     val is_translator: Boolean,
155     val is_translation_enabled: Boolean,
156     val profile_background_color: String,
157     val profile_background_image_url: String,
158     val profile_background_image_url_https: String,
159     val profile_background_tile: Boolean,
160     val profile_image_url: String,
161     val profile_image_url_https: String,
162     val profile_banner_url: String? = null,
163     val profile_link_color: String,
164     val profile_sidebar_border_color: String,
165     val profile_sidebar_fill_color: String,
166     val profile_text_color: String,
167     val profile_use_background_image: Boolean,
168     val default_profile: Boolean,
169     val default_profile_image: Boolean,
170     val following: Boolean,
171     val follow_request_sent: Boolean,
172     val notifications: Boolean
173 )
174 
175 @Serializable
176 data class UserEntities(
177     val url: Urls? = null,
178     val description: Urls
179 )
180 
mainnull181 fun main() {
182     val s = MacroTwitterFeed::class.java.getResource("/twitter_macro.json").readBytes().decodeToString()
183     println(Json.decodeFromString<MacroTwitterFeed>(s))
184 }
185