diff --git a/pybotx/bot/bot.py b/pybotx/bot/bot.py index aa66112d..aef8eb17 100644 --- a/pybotx/bot/bot.py +++ b/pybotx/bot/bot.py @@ -1783,6 +1783,9 @@ async def send_smartapp_manifest( android: Missing[SmartappManifestAndroidParams] = Undefined, web_layout: Missing[SmartappManifestWebParams] = Undefined, unread_counter: Missing[SmartappManifestUnreadCounterParams] = Undefined, + store_on_close: Missing[bool] = Undefined, + preload_in_background: Missing[bool] = Undefined, + link_regex: Missing[str | None] = Undefined, ) -> SmartappManifest: """Send smartapp manifest with given parameters. @@ -1791,6 +1794,9 @@ async def send_smartapp_manifest( :param android: Smartapp layout for android clients. :param web_layout: Smartapp layout for web clients. :param unread_counter: Entities that can be subscribed to in the unread counter. + :param store_on_close: Keep smartapp in memory on close. + :param preload_in_background: Force load smartapp even not pinned. + :param link_regex: URLs matching this Regex will be opened by the current SmartApp. :return: Smartapp manifest with the set parameters received from BotX. """ @@ -1805,6 +1811,9 @@ async def send_smartapp_manifest( android=android, web_layout=web_layout, unread_counter=unread_counter, + store_on_close=store_on_close, + preload_in_background=preload_in_background, + link_regex=link_regex, ) smartapp_manifest_response = await method.execute(payload) return smartapp_manifest_response.to_domain() diff --git a/pybotx/client/smartapps_api/smartapp_manifest.py b/pybotx/client/smartapps_api/smartapp_manifest.py index 1efe0623..64f219ad 100644 --- a/pybotx/client/smartapps_api/smartapp_manifest.py +++ b/pybotx/client/smartapps_api/smartapp_manifest.py @@ -38,6 +38,9 @@ class SmartappManifest(VerifiedPayloadBaseModel): android: SmartappManifestAndroidParams web: SmartappManifestWebParams unread_counter_link: SmartappManifestUnreadCounterParams + store_on_close: bool = False + preload_in_background: bool = False + link_regex: str | None = None class SmartappManifestPayload(UnverifiedPayloadBaseModel): @@ -46,6 +49,9 @@ class SmartappManifestPayload(UnverifiedPayloadBaseModel): web: Missing[SmartappManifestWebParams] = Undefined aurora: Missing[SmartappManifestAuroraParams] = Undefined unread_counter_link: Missing[SmartappManifestUnreadCounterParams] = Undefined + store_on_close: Missing[bool] = Undefined + preload_in_background: Missing[bool] = Undefined + link_regex: Missing[str | None] = Undefined class BotXAPISmartAppManifestRequestPayload(UnverifiedPayloadBaseModel): @@ -58,6 +64,9 @@ def from_domain( android: Missing[SmartappManifestAndroidParams] = Undefined, web_layout: Missing[SmartappManifestWebParams] = Undefined, unread_counter: Missing[SmartappManifestUnreadCounterParams] = Undefined, + store_on_close: Missing[bool] = Undefined, + preload_in_background: Missing[bool] = Undefined, + link_regex: Missing[str | None] = Undefined, ) -> "BotXAPISmartAppManifestRequestPayload": if web_layout is Undefined and unread_counter is Undefined: return cls(manifest={}) @@ -68,6 +77,9 @@ def from_domain( android=android, web=web_layout, unread_counter_link=unread_counter, + store_on_close=store_on_close, + preload_in_background=preload_in_background, + link_regex=link_regex, ), ) diff --git a/pyproject.toml b/pyproject.toml index 091bb4be..17179d71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybotx" -version = "0.76.0" +version = "0.76.1" description = "A python library for interacting with eXpress BotX API" authors = [ "Sidnev Nikolay ", diff --git a/tests/client/smartapps_api/test_smartapp_manifest.py b/tests/client/smartapps_api/test_smartapp_manifest.py index 82d4a36a..4503d7d0 100644 --- a/tests/client/smartapps_api/test_smartapp_manifest.py +++ b/tests/client/smartapps_api/test_smartapp_manifest.py @@ -56,6 +56,9 @@ async def test__send_smartapp_manifest__all_params_provided__succeed( "group_chat_id": ["adc03af8-9193-4d3b-b913-7a023cdb4029"], "app_id": ["test_app"], }, + "store_on_close": True, + "preload_in_background": False, + "link_regex": "^https:\\/\\/site\\.com.*$", }, }, ).mock( @@ -80,6 +83,9 @@ async def test__send_smartapp_manifest__all_params_provided__succeed( "group_chat_id": ["adc03af8-9193-4d3b-b913-7a023cdb4029"], "app_id": ["test_app"], }, + "store_on_close": True, + "preload_in_background": False, + "link_regex": "^https:\\/\\/site\\.com.*$", }, "status": "ok", }, @@ -108,6 +114,9 @@ async def test__send_smartapp_manifest__all_params_provided__succeed( group_chat_id=[UUID("adc03af8-9193-4d3b-b913-7a023cdb4029")], app_id=["test_app"], ), + store_on_close=True, + preload_in_background=False, + link_regex="^https:\\/\\/site\\.com.*$", ) # - Assert - @@ -129,6 +138,9 @@ async def test__send_smartapp_manifest__all_params_provided__succeed( group_chat_id=[UUID("adc03af8-9193-4d3b-b913-7a023cdb4029")], app_id=["test_app"], ), + store_on_close=True, + preload_in_background=False, + link_regex="^https:\\/\\/site\\.com.*$", ) @@ -167,6 +179,10 @@ async def test__send_smartapp_manifest__only_default_params_provided__succeed( "group_chat_id": [], "user_huid": [], }, + "store_on_close": False, + "preload_in_background": False, + "link_regex": None, + }, "status": "ok", }, @@ -198,6 +214,9 @@ async def test__send_smartapp_manifest__only_default_params_provided__succeed( group_chat_id=[], app_id=[], ), + store_on_close=False, + preload_in_background=False, + link_regex=None, )