How to use the twitchio.webhook.Topic function in twitchio

To help you get started, we’ve selected a few twitchio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TwitchIO / TwitchIO / twitchio / webhook.py View on Github external
def as_uri(self):
        """
        Converts the Topic into the URI which can be used to create a Webhook subscription.

        Returns
        -------
        str
            The Topic as an URI.
        """

        params = '&'.join(f'{name}={getattr(self, name)}' for name in self._parameters)
        return f'{self.URL}?{params}'


class UserFollows(Topic):
    """
    This Topic notifies you whenever a user follows someone or someone is being followed.

    Parameters
    ----------
    first: Optional[int]
        This needs to be 1. Please see the Twitch documentation for more information.
    from_id: Optional[int]
        User ID for the user that's following other Twitch channels.
    to_id: Optional[int]
        User ID for the channel that other Twitch users follow.

    Raises
    ------
    TypeError
        Neither the `from_id` or `to_id` parameter were given.
github TwitchIO / TwitchIO / twitchio / webhook.py View on Github external
URL = 'https://api.twitch.tv/helix/users/follows'

    __slots__ = ('first', 'from_id', 'to_id')

    def __init__(self, *, first=1, from_id=None, to_id=None):
        self.first = first

        if from_id is None and to_id is None:
            raise TypeError('Missing either "from_id" or "to_id" argument.')

        self.from_id = from_id
        self.to_id = to_id


class StreamChanged(Topic):
    """
    This Topic notifies you whenever a Stream starts, is modified or stops.

    Parameters
    ----------
    user_id: int
        The channel to receive notifications for.
    """

    URL = 'https://api.twitch.tv/helix/streams'

    __slots__ = ('user_id',)

    def __init__(self, user_id):
        self.user_id = user_id
github TwitchIO / TwitchIO / twitchio / webhook.py View on Github external
Parameters
    ----------
    user_id: int
        The user to receive information for.
    """

    URL = 'https://api.twitch.tv/helix/users'

    __slots__ = ('id',)

    def __init__(self, user_id):
        self.id = user_id


class GameAnalytics(Topic):
    """
    This Topic notifies you whenever a new game analytics report is available.

    .. note::
        This Topic requires the `analytics:read:games` OAuth scope.

    Parameters
    ----------
    game_id: int
        The game to receive notifications for.
    """

    URL = 'https://api.twitch.tv/helix/analytics/games'

    __slots__ = ('game_id',)
github TwitchIO / TwitchIO / twitchio / webhook.py View on Github external
Parameters
    ----------
    user_id: int
        The channel to receive notifications for.
    """

    URL = 'https://api.twitch.tv/helix/streams'

    __slots__ = ('user_id',)

    def __init__(self, user_id):
        self.user_id = user_id


class UserChanged(Topic):
    """
    This Topic notifies you whenever a user updates their profile.

    Parameters
    ----------
    user_id: int
        The user to receive information for.
    """

    URL = 'https://api.twitch.tv/helix/users'

    __slots__ = ('id',)

    def __init__(self, user_id):
        self.id = user_id
github TwitchIO / TwitchIO / twitchio / webhook.py View on Github external
Parameters
    ----------
    game_id: int
        The game to receive notifications for.
    """

    URL = 'https://api.twitch.tv/helix/analytics/games'

    __slots__ = ('game_id',)

    def __init__(self, game_id):
        self.game_id = game_id


class ExtensionAnalytics(Topic):
    """
    This Topic notifies you whenever a new extension analytics report is available.

    ..note ::
        This Topic requires the `analytics:read:extensions` OAuth scope.

    Parameters
    ----------
    extension_id: int
        The extension to receive notifications for.
    """

    URL = 'https://api.twitch.tv/helix/analytics/extensions'

    __slots__ = ('extension_id',)