Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deep link: support HTML content type #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions pylti1p3/deep_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def get_message_jwt(
}
return message_jwt

def get_accept_types(self) -> t.List[str]:
return self._deep_link_settings.get('accept_types', [])

def encode_jwt(self, message):
headers = None
kid = self._registration.get_kid()
Expand Down
11 changes: 11 additions & 0 deletions pylti1p3/deep_link_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class DeepLinkResource:
_title: t.Optional[str] = None
_url: t.Optional[str] = None
_lineitem: t.Optional[LineItem] = None
_html: t.Optional[str] = None
_custom_params: t.Mapping[str, str] = {}
_target: str = "iframe"
_icon_url: t.Optional[str] = None
Expand Down Expand Up @@ -60,6 +61,13 @@ def set_icon_url(self, value: str) -> "DeepLinkResource":
self._icon_url = value
return self

def set_html(self, value: str) -> "DeepLinkResource":
self._html = value
return self

def get_html(self) -> str:
return self._html

def to_dict(self) -> t.Dict[str, object]:
res: t.Dict[str, object] = {
"type": self._type,
Expand Down Expand Up @@ -90,6 +98,9 @@ def to_dict(self) -> t.Dict[str, object]:

res["lineItem"] = line_item

if self._html:
res["html"] = self._html

if self._icon_url:
res["icon"] = {"url": self._icon_url}

Expand Down