Skip to content

Conversation

@jonatascastro12
Copy link
Contributor

@jonatascastro12 jonatascastro12 commented Jan 29, 2025

Description

This PR introduces the intent_options parameter in the Portal.generate_link() method. This feature is not generally available on WorkOS API. Contact WorkOS support for access.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@jonatascastro12 jonatascastro12 requested a review from a team as a code owner January 29, 2025 20:16
@linear
Copy link

linear bot commented Jan 29, 2025

@jonatascastro12 jonatascastro12 changed the title Add intent_options_sso_bookmark_slug parameter on Portal.generate_link() method Add intent_options_sso_bookmark_slug parameter on Portal.generate_link() method Jan 29, 2025
@jonatascastro12 jonatascastro12 force-pushed the feature/dsync-2460-add-bookmark_id-parameter-to-portal-link-generation-method branch 3 times, most recently from d8b5abd to b35d101 Compare January 29, 2025 21:05
Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a method signature suggestion. Let me know your thoughts.

workos/portal.py Outdated
organization_id: str,
return_url: Optional[str] = None,
success_url: Optional[str] = None,
intent_options_sso_bookmark_slug: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should defined this as a structured TypedDict so it makes future expansion easier.

For example:

# types/portal/portal_link_intent_options.py
class SSOIntentOptions(TypedDict):
    bookmark_slug: str


class IntentOptions(TypedDict):
    sso: SSOIntentOptions

# portal.py
def generate_link(
        self,
        *,
        intent: PortalLinkIntent,
        organization_id: str,
        return_url: Optional[str] = None,
        success_url: Optional[str] = None,
        intent_options: Optional[IntentOptions] = None,
    ) -> PortalLink:
    ...
    if intent_options and intent_options["sso"]:
        json["intent_options"] = {
            "sso": {
                "bookmark_slug": intent_options["sso"]["bookmark_slug"],
             }
         }

Usage would be something like:

Portal.generate_link(
    intent="sso",
    organization_id="org_123",
    intent_options={"sso": {"bookmark_slug": "test"}},
)

@jonatascastro12 jonatascastro12 changed the title Add intent_options_sso_bookmark_slug parameter on Portal.generate_link() method Add intent_options parameter on Portal.generate_link() method Jan 30, 2025
@jonatascastro12 jonatascastro12 force-pushed the feature/dsync-2460-add-bookmark_id-parameter-to-portal-link-generation-method branch from b35d101 to 2643cb0 Compare January 30, 2025 20:02
Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jonatascastro12 jonatascastro12 merged commit 74666e1 into main Jan 30, 2025
5 checks passed
@jonatascastro12 jonatascastro12 deleted the feature/dsync-2460-add-bookmark_id-parameter-to-portal-link-generation-method branch January 30, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants