model.send.manageTemplate.WhatsAppCloudTemplate.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tock-bot-connector-whatsapp-cloud Show documentation
Show all versions of tock-bot-connector-whatsapp-cloud Show documentation
Bot Connector for WhatsApp Cloud
/*
* Copyright (C) 2017/2021 e-voyageurs technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ai.tock.bot.connector.whatsapp.cloud.model.send.manageTemplate
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.annotation.JsonTypeName
enum class LanguageCode {
en_US, fr
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes(
JsonSubTypes.Type(value = BodyComponent::class, name = "BODY"),
JsonSubTypes.Type(value = CarouselComponent::class, name = "CAROUSEL")
)
sealed class TemplateComponent
@JsonTypeName("BODY")
data class BodyComponent(
val text: String,
val example: BodyExample? = null
) : TemplateComponent()
data class BodyExample(val body_text: List>)
@JsonTypeName("CAROUSEL")
data class CarouselComponent(
val cards: List
) : TemplateComponent()
data class Card(val components: List)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes(
JsonSubTypes.Type(value = HeaderComponent::class, name = "HEADER"),
JsonSubTypes.Type(value = Body::class, name = "BODY"),
JsonSubTypes.Type(value = ButtonsComponent::class, name = "BUTTONS")
)
sealed class CardComponent
@JsonTypeName("HEADER")
data class HeaderComponent(
val format: String,
val example: HeaderExample? = null
) : CardComponent()
data class HeaderExample(
@JsonProperty("header_handle")
val headerHandle: List
)
@JsonTypeName("BODY")
data class Body(
val text: String,
val example: BodyExample
) : CardComponent()
@JsonTypeName("BUTTONS")
data class ButtonsComponent(val buttons: List