plex-api-spec icon indicating copy to clipboard operation
plex-api-spec copied to clipboard

[enhancement] Accept plex servers invite

Open that-9uy opened this issue 10 months ago • 1 comments

I would like to accept my plex servers invite on users behalf, I can currently do this with python-plexapi using acceptInvite.

And call it like this to accept users invite

def accept_plex_invitation(token: str, server_api_key: Optional[str] = None, server_url: Optional[str] = None):
    """Accept a Plex invitation

    :param token: The token of the invitation
    :type token: str

    :param server_api_key: The API key of the Plex server
    :type server_api_key: Optional[str] - If not provided, will get from database.

    :param server_url: The URL of the Plex server
    :type server_url: Optional[str] - If not provided, will get from database.

    :return: None
    """

    # Get the PlexServer object
    plex = get_plex_server(server_api_key=server_api_key, server_url=server_url)

    # Get my account from Plex and email
    my_account = plex.myPlexAccount()

    # Get plex account for the user
    plex_account = MyPlexAccount(token=token)

    # Accept the invitation and enable sync
    plex_account.acceptInvite(my_account.email)
    plex_account.enableViewStateSync()****

that-9uy avatar Feb 26 '25 00:02 that-9uy

This is missing from the API spec but you're welcome to add this to the spec in a PR and then all SDK's will have it implemented

JasonLandbridge avatar Feb 26 '25 08:02 JasonLandbridge