Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pylti1p3/deep_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
],
Expand Down
16 changes: 16 additions & 0 deletions pylti1p3/deep_link_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}

Expand Down