1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 00:03:48 +00:00

fix using of json in new webapp types

This commit is contained in:
InsanusMokrassar 2024-08-01 17:41:02 +06:00
parent 8bb3095fb1
commit 2d11685b7b
2 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,7 @@
package dev.inmo.tgbotapi.webapps.stories package dev.inmo.tgbotapi.webapps.stories
import kotlin.js.json
external interface StoryShareParams { external interface StoryShareParams {
val text: String val text: String
@JsName("widget_link") @JsName("widget_link")
@ -10,8 +12,8 @@ fun StoryShareParams(
text: String, text: String,
widgetLink: StoryWidgetLink? widgetLink: StoryWidgetLink?
): StoryShareParams { ): StoryShareParams {
val result: dynamic = js("{}") val json = json()
result["text"] = text json["text"] = text
widgetLink ?.let { result["widget_link"] = it } widgetLink ?.let { json["widget_link"] = it }
return result.unsafeCast<StoryShareParams>() return json.unsafeCast<StoryShareParams>()
} }

View File

@ -11,8 +11,8 @@ fun StoryWidgetLink(
url: String, url: String,
name: String? name: String?
): StoryWidgetLink { ): StoryWidgetLink {
val result: dynamic = js("{}") val json = json()
result["url"] = url json["url"] = url
name ?.let { result["name"] = it } name ?.let { json["name"] = it }
return result.unsafeCast<StoryWidgetLink>() return json.unsafeCast<StoryWidgetLink>()
} }