diff --git a/pylti1p3/deep_link.py b/pylti1p3/deep_link.py index fdce52c..7a5e051 100644 --- a/pylti1p3/deep_link.py +++ b/pylti1p3/deep_link.py @@ -12,7 +12,7 @@ { # Required data: "deep_link_return_url": str, - "accept_types": t.List[te.Literal["link", "ltiResourceLink"]], + "accept_types": t.List[te.Literal["link", "ltiResourceLink", "html"]], "accept_presentation_document_targets": t.List[ te.Literal["iframe", "window", "embed"] ], diff --git a/pylti1p3/deep_link_resource.py b/pylti1p3/deep_link_resource.py index 131606f..de184f8 100644 --- a/pylti1p3/deep_link_resource.py +++ b/pylti1p3/deep_link_resource.py @@ -10,6 +10,7 @@ class DeepLinkResource: _custom_params: t.Mapping[str, str] = {} _target: str = "iframe" _icon_url: t.Optional[str] = None + _html: t.Optional[str] = None def get_type(self): return self._type @@ -60,6 +61,13 @@ def set_icon_url(self, value: str) -> "DeepLinkResource": self._icon_url = value return self + def get_html(self) -> t.Optional[str]: + return self._html + + def set_html(self, value: str) -> "DeepLinkResource": + self._html = value + return self + def to_dict(self) -> t.Dict[str, object]: res: t.Dict[str, object] = { "type": self._type, @@ -90,6 +98,14 @@ def to_dict(self) -> t.Dict[str, object]: res["lineItem"] = line_item + if self._html and self._type == "link": + res["embed"] = { + "html": self._html + } + + elif self._html and self._type == "html": + res["html"] = self._html + if self._icon_url: res["icon"] = {"url": self._icon_url}