Source code for platypush.message.event.github

from datetime import datetime
from dataclasses import dataclass
from typing import Optional, Dict

from platypush.message.event import Event


[docs] @dataclass class Actor: id: str login: str display_login: str url: str gravatar_id: str avatar_url: str
[docs] @dataclass class Repo: id: str name: str url: str
[docs] class GithubEvent(Event): """Generic Github event"""
[docs] def __init__( self, event_type: str, created_at: datetime, actor: Optional[Dict[str, str]] = None, repo: Optional[Dict[str, str]] = None, *args, **kwargs, ): super().__init__( *args, actor=actor, event_type=event_type, repo=repo, created_at=created_at, **kwargs, ) self.event_type = event_type self.actor = Actor(**actor) if actor else None self.repo = Repo(**repo) if repo else None self.created_at = created_at
[docs] class GithubPushEvent(GithubEvent): """Github push event."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubCommitCommentEvent(GithubEvent): """A commit comment is created."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubCreateEvent(GithubEvent): """A git branch or tag is created."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubDeleteEvent(GithubEvent): """A git branch or tag is deleted."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubForkEvent(GithubEvent): """A user forks a watched repository."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubWikiEvent(GithubEvent): """A wiki page is created or updated on a watched repository."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubIssueCommentEvent(GithubEvent): """A comment is added or updated on an issue."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubIssueEvent(GithubEvent): """A new activity is registered on an issue."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubMemberEvent(GithubEvent): """New activity related to repository collaborators."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubPublicEvent(GithubEvent): """A private repository is made public."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubPullRequestEvent(GithubEvent): """New activity related to a pull request."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubPullRequestReviewCommentEvent(GithubEvent): """New activity related to comments of a pull request."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubReleaseEvent(GithubEvent): """New activity related to the release of a repository."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubSponsorshipEvent(GithubEvent): """New activity related to the sponsorship of a repository."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
[docs] class GithubWatchEvent(GithubEvent): """Event triggered when someone stars or starts watching a repository."""
[docs] def __init__(self, payload: dict, *args, **kwargs): super().__init__(*args, payload=payload, **kwargs)
# vim:sw=4:ts=4:et: