Created
June 23, 2016 17:11
-
-
Save johandahlberg/69c74a3c5ed57310e682f9c5b3e61cfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class FacebookPostingMessages(`object`: String, entry: Seq[MessagePostEntry]) { | |
def messages(): Seq[Message] = { | |
entry.flatMap(_.messaging).map(_.message) | |
} | |
} | |
case class Correspondent(id: String) | |
case class MessagePostEntry(id: String, time: Long, messaging: Seq[Messaging]) | |
case class Messaging(sender: Correspondent, recipient: Correspondent, timestamp: Long, message: Message) | |
case class Message(mid: String, seq: Long, text: String) | |
object MessageFormats { | |
implicit val messageFormat = Json.format[Message] | |
implicit val messageReads = Json.reads[Message] | |
implicit val correspondentFormat = Json.format[Correspondent] | |
implicit val correspondentReads = Json.reads[Correspondent] | |
implicit val messagingFormat = Json.format[Messaging] | |
implicit val messagingReads = Json.reads[Messaging] | |
implicit val entryFormat = Json.format[MessagePostEntry] | |
implicit val entryReads = Json.reads[MessagePostEntry] | |
implicit val facebookPostingMessagesFormats = Json.format[FacebookPostingMessages] | |
implicit val facebookPostingMessagesReads = Json.reads[FacebookPostingMessages] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment