Skip to content

Commit f243bb9

Browse files
committed
Make :attr:flogin.jsonrpc.results.Result.title optional
1 parent 74cb11a commit f243bb9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docs/whats_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ New Features
2828
- Document the generic in :class:`flogin.jsonrpc.results.Result` for a custom plugin class.
2929
- Document the generic in :class:`flogin.search_handler.SearchHandler.plugin` for a custom plugin class.
3030
- Document the generic in :class:`flogin.query.Query` for :attr:`flogin.query.Query.condition_data`
31+
- Make :attr:`flogin.jsonrpc.results.Result.title` optional
3132

3233
Bug Fixes
3334
~~~~~~~~~

flogin/jsonrpc/results.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(
119119

120120

121121
class ResultConstructorArgs(TypedDict):
122-
title: str
122+
title: NotRequired[str | None]
123123
sub: NotRequired[str | None]
124124
icon: NotRequired[str | None]
125125
title_highlight_data: NotRequired[Iterable[int] | None]
@@ -188,7 +188,7 @@ async def context_menu(self):
188188

189189
def __init__(
190190
self,
191-
title: str,
191+
title: str | None = None,
192192
sub: str | None = None,
193193
icon: str | None = None,
194194
title_highlight_data: Iterable[int] | None = None,
@@ -314,9 +314,10 @@ def to_dict(self) -> dict[str, Any]:
314314
dict[:class:`str`, Any]
315315
"""
316316

317-
x: dict[str, Any] = {
318-
"title": self.title,
319-
}
317+
x: dict[str, Any] = {}
318+
319+
if self.title is not None:
320+
x['title'] = self.title
320321
if self.sub is not None:
321322
x["subTitle"] = self.sub
322323
if self.icon is not None:

0 commit comments

Comments
 (0)