mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 08:37:12 +00:00
fix using of json in new webapp types
This commit is contained in:
parent
8bb3095fb1
commit
2d11685b7b
@ -1,5 +1,7 @@
|
||||
package dev.inmo.tgbotapi.webapps.stories
|
||||
|
||||
import kotlin.js.json
|
||||
|
||||
external interface StoryShareParams {
|
||||
val text: String
|
||||
@JsName("widget_link")
|
||||
@ -10,8 +12,8 @@ fun StoryShareParams(
|
||||
text: String,
|
||||
widgetLink: StoryWidgetLink?
|
||||
): StoryShareParams {
|
||||
val result: dynamic = js("{}")
|
||||
result["text"] = text
|
||||
widgetLink ?.let { result["widget_link"] = it }
|
||||
return result.unsafeCast<StoryShareParams>()
|
||||
val json = json()
|
||||
json["text"] = text
|
||||
widgetLink ?.let { json["widget_link"] = it }
|
||||
return json.unsafeCast<StoryShareParams>()
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ fun StoryWidgetLink(
|
||||
url: String,
|
||||
name: String?
|
||||
): StoryWidgetLink {
|
||||
val result: dynamic = js("{}")
|
||||
result["url"] = url
|
||||
name ?.let { result["name"] = it }
|
||||
return result.unsafeCast<StoryWidgetLink>()
|
||||
val json = json()
|
||||
json["url"] = url
|
||||
name ?.let { json["name"] = it }
|
||||
return json.unsafeCast<StoryWidgetLink>()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user