EP / me2day-scala
me2day API for scala
$ hg clone http://bitbucket.org/EP/me2day-scala/
| commit 22: | 4f0edf559528 |
| parent 21: | d927ed507ead |
| branch: | default |
12 months ago
Changed (Δ3.4 KB):
src/main/scala/net/me2day/scala/Comment.scala (23 lines added, 0 lines removed)
src/main/scala/net/me2day/scala/Me2Day.scala (0 lines added, 58 lines removed)
src/main/scala/net/me2day/scala/Person.scala (5 lines added, 2 lines removed)
src/main/scala/net/me2day/scala/Post.scala (41 lines added, 0 lines removed)
src/main/scala/net/me2day/scala/XmlResultParser.scala (2 lines added, 2 lines removed)
Up to file-list src/main/scala/net/me2day/scala/Comment.scala:
1 |
package net.me2day.scala |
|
2 |
||
3 |
import java.net.URL |
|
4 |
import java.util.Date |
|
5 |
||
6 |
case class Comment( |
|
7 |
id : String, |
|
8 |
body : String, |
|
9 |
publishedDate : Date, |
|
10 |
author : Author |
|
11 |
) |
|
12 |
||
13 |
abstract class CommentTrace(val post : PostSummary, val comment : Comment) |
|
14 |
case class CommentBy(override val post : PostSummary, override val comment : Comment) extends CommentTrace(post, comment) |
|
15 |
case class CommentTo(override val post : PostSummary, override val comment : Comment) extends CommentTrace(post, comment) |
|
16 |
||
17 |
case class PostSummary( |
|
18 |
id : String, |
|
19 |
permalink : URL, |
|
20 |
body : String, |
|
21 |
me2dayHome : URL, |
|
22 |
publishedDate : Date, |
|
23 |
author : Author) |
Up to file-list src/main/scala/net/me2day/scala/Me2Day.scala:
| … | … | @@ -321,62 +321,4 @@ class TrackComments(me2day : Me2Day, use |
321 |
321 |
} |
322 |
322 |
} |
323 |
323 |
|
324 |
case class Post( |
|
325 |
id : String, |
|
326 |
permalink : URL, |
|
327 |
body : String, |
|
328 |
icon : GenericIcon, |
|
329 |
tags : List[Tag], |
|
330 |
me2dayHome : URL, |
|
331 |
publishedDate : Date, |
|
332 |
commentsCount : Int, |
|
333 |
metooCount : Int, |
|
334 |
commentClosed : Boolean, |
|
335 |
callback : Option[PostCallback], |
|
336 |
author : Author, |
|
337 |
location : Location, |
|
338 |
media : Option[Media] |
|
339 |
) |
|
340 |
||
341 |
case class Comment( |
|
342 |
id : String, |
|
343 |
body : String, |
|
344 |
publishedDate : Date, |
|
345 |
author : Author |
|
346 |
) |
|
347 |
||
348 |
abstract class CommentTrace(val post : PostSummary, val comment : Comment) |
|
349 |
case class CommentBy(override val post : PostSummary, override val comment : Comment) extends CommentTrace(post, comment) |
|
350 |
case class CommentTo(override val post : PostSummary, override val comment : Comment) extends CommentTrace(post, comment) |
|
351 |
||
352 |
case class PostSummary( |
|
353 |
id : String, |
|
354 |
permalink : URL, |
|
355 |
body : String, |
|
356 |
me2dayHome : URL, |
|
357 |
publishedDate : Date, |
|
358 |
author : Author) |
|
359 |
||
360 |
case class GenericIcon(kind : String, url : URL) |
|
361 |
||
362 |
case class DefinedIcon(number : int) |
|
363 |
||
364 |
object Icon { |
|
365 |
val Think = DefinedIcon(1) |
|
366 |
val Feel = DefinedIcon(2) |
|
367 |
val Announce = DefinedIcon(3) |
|
368 |
} |
|
369 |
||
370 |
case class PostCallback(contentType : String, iconUrl : URL, url : URL) |
|
371 |
||
372 |
case class Author(id : String, nickname : String, face : URL, me2dayHome : URL) |
|
373 |
||
374 |
case class Position(longitude : Float , latitude : Float) |
|
375 |
||
376 |
case class Location(position : Option[Position], name : Option[String]) |
|
377 |
||
378 |
abstract class Media() |
|
379 |
case class Me2Photo(provider : String, id : String, permalink : URL, url : URL) extends Media |
|
380 |
case class Me2Video(provider : String, id : String, permalink : URL) extends Media |
|
381 |
||
382 |
324 |
case class ErrorResult(code : Int, message : String, description : String) |
Up to file-list src/main/scala/net/me2day/scala/Person.scala:
| … | … | @@ -17,13 +17,16 @@ case class Person( |
17 |
17 |
invitedBy : String, |
18 |
18 |
friendsCount : Int, |
19 |
19 |
updated : Date, |
20 |
postIcons : List[P |
|
20 |
postIcons : List[PersonalIcon] |
|
21 |
21 |
) |
22 |
22 |
|
23 |
case class P |
|
23 |
case class PersonalIcon( |
|
24 |
24 |
index : Int, |
25 |
25 |
typeNumber : Int, |
26 |
26 |
url : URL, |
27 |
27 |
description : String, |
28 |
28 |
default : Boolean |
29 |
29 |
) |
30 |
||
31 |
case class Author(id : String, nickname : String, face : URL, me2dayHome : URL) |
|
32 |
Up to file-list src/main/scala/net/me2day/scala/Post.scala:
1 |
package net.me2day.scala |
|
2 |
||
3 |
import java.net.URL |
|
4 |
import java.util.Date |
|
5 |
||
6 |
case class Post( |
|
7 |
id : String, |
|
8 |
permalink : URL, |
|
9 |
body : String, |
|
10 |
icon : GenericIcon, |
|
11 |
tags : List[Tag], |
|
12 |
me2dayHome : URL, |
|
13 |
publishedDate : Date, |
|
14 |
commentsCount : Int, |
|
15 |
metooCount : Int, |
|
16 |
commentClosed : Boolean, |
|
17 |
callback : Option[PostCallback], |
|
18 |
author : Author, |
|
19 |
location : Location, |
|
20 |
media : Option[Media] |
|
21 |
) |
|
22 |
||
23 |
case class GenericIcon(kind : String, url : URL) |
|
24 |
||
25 |
case class DefinedIcon(number : Int) |
|
26 |
||
27 |
object Icon { |
|
28 |
val Think = DefinedIcon(1) |
|
29 |
val Feel = DefinedIcon(2) |
|
30 |
val Announce = DefinedIcon(3) |
|
31 |
} |
|
32 |
||
33 |
case class PostCallback(contentType : String, iconUrl : URL, url : URL) |
|
34 |
||
35 |
abstract class Media() |
|
36 |
case class Me2Photo(provider : String, id : String, permalink : URL, url : URL) extends Media |
|
37 |
case class Me2Video(provider : String, id : String, permalink : URL) extends Media |
|
38 |
||
39 |
case class Position(longitude : Float , latitude : Float) |
|
40 |
||
41 |
case class Location(position : Option[Position], name : Option[String]) |
Up to file-list src/main/scala/net/me2day/scala/XmlResultParser.scala:
| … | … | @@ -166,7 +166,7 @@ class XmlResultParser { |
166 |
166 |
) |
167 |
167 |
} |
168 |
168 |
|
169 |
def postIcons(node : xml.NodeSeq) : List[P |
|
169 |
def postIcons(node : xml.NodeSeq) : List[PersonalIcon] = { |
|
170 |
170 |
if (node.isEmpty) { |
171 |
171 |
null |
172 |
172 |
} else { |
| … | … | @@ -175,7 +175,7 @@ class XmlResultParser { |
175 |
175 |
} |
176 |
176 |
|
177 |
177 |
def postIcon(node : xml.Node) = { |
178 |
P |
|
178 |
PersonalIcon( |
|
179 |
179 |
(node \ "iconIndex").first.text.toInt, |
180 |
180 |
(node \ "iconType").first.text.toInt, |
181 |
181 |
url((node \ "url").first), |
