Marshalling/unmarshalling test.
This commit is contained in:
@@ -10,8 +10,18 @@ object TelegramEntities extends SprayJsonSupport with DefaultJsonProtocol {
|
||||
error_code: Option[Int] = None,
|
||||
result: T)
|
||||
|
||||
object Response {
|
||||
implicit val responseGetMeFormat: RootJsonFormat[Response[GetMe]] = jsonFormat4(Response[GetMe])
|
||||
implicit val responseWebhookInfoFormat: RootJsonFormat[Response[WebhookInfo]] = jsonFormat4(Response[WebhookInfo])
|
||||
implicit val responseStringFormat: RootJsonFormat[Response[String]] = jsonFormat4(Response[String])
|
||||
}
|
||||
|
||||
case class GetMe(id: Int, is_bot: Boolean, first_name: String, username: String)
|
||||
|
||||
object GetMe {
|
||||
implicit val getMeFormat: RootJsonFormat[GetMe] = jsonFormat4(GetMe.apply)
|
||||
}
|
||||
|
||||
case class InlineQuery(id: String,
|
||||
from: User,
|
||||
location: Location,
|
||||
@@ -98,11 +108,19 @@ object TelegramEntities extends SprayJsonSupport with DefaultJsonProtocol {
|
||||
|
||||
case class InputFile()
|
||||
|
||||
object InputFile {
|
||||
implicit val inputFileFormat: RootJsonFormat[InputFile] = jsonFormat0(InputFile.apply)
|
||||
}
|
||||
|
||||
case class Webhook(url: String,
|
||||
certificate: Option[InputFile] = None,
|
||||
max_connections: Option[Int] = None,
|
||||
allowed_updates: Option[Seq[String]] = None)
|
||||
|
||||
object Webhook {
|
||||
implicit val webHookFormat: RootJsonFormat[Webhook] = jsonFormat4(Webhook.apply)
|
||||
}
|
||||
|
||||
case class WebhookInfo(url: String,
|
||||
has_custom_certificate: Boolean,
|
||||
pending_update_count: Int,
|
||||
@@ -111,12 +129,7 @@ object TelegramEntities extends SprayJsonSupport with DefaultJsonProtocol {
|
||||
max_connections: Option[Int] = None,
|
||||
allowed_updates: Option[Seq[String]] = None)
|
||||
|
||||
implicit val inputFileFormat: RootJsonFormat[InputFile] = jsonFormat0(InputFile)
|
||||
implicit val webHookFormat: RootJsonFormat[Webhook] = jsonFormat4(Webhook)
|
||||
implicit val webHookInfoFormat: RootJsonFormat[WebhookInfo] = jsonFormat7(WebhookInfo)
|
||||
implicit val getMeFormat: RootJsonFormat[GetMe] = jsonFormat4(GetMe)
|
||||
// responses
|
||||
implicit val responseGetMeFormat: RootJsonFormat[Response[GetMe]] = jsonFormat4(Response[GetMe])
|
||||
implicit val responseWebhookInfoFormat: RootJsonFormat[Response[WebhookInfo]] = jsonFormat4(Response[WebhookInfo])
|
||||
implicit val responseStringFormat: RootJsonFormat[Response[String]] = jsonFormat4(Response[String])
|
||||
object WebhookInfo {
|
||||
implicit val webHookInfoFormat: RootJsonFormat[WebhookInfo] = jsonFormat7(WebhookInfo.apply)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user