Created
June 23, 2016 17:11
Star
You must be signed in to star a gist
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