Skip to content

Commit

Permalink
Sync IssueEvent class with API spec (#3142)
Browse files Browse the repository at this point in the history
Adds the following attributes:
- author_association
- performed_via_github_app
- project_card
- review_requester
  • Loading branch information
EnricoMi authored Jan 9, 2025
1 parent 0488764 commit be44bb5
Show file tree
Hide file tree
Showing 3 changed files with 271 additions and 80 deletions.
78 changes: 61 additions & 17 deletions github/IssueEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,25 @@
from __future__ import annotations

from datetime import datetime
from typing import Any
from typing import TYPE_CHECKING, Any

import github.GithubApp
import github.GithubObject
import github.Issue
import github.Label
import github.Milestone
import github.NamedUser
import github.Team
from github.GithubObject import Attribute, CompletableGithubObject, NotSet

if TYPE_CHECKING:
from github.GithubApp import GithubApp
from github.Issue import Issue
from github.Label import Label
from github.Milestone import Milestone
from github.NamedUser import NamedUser
from github.Team import Team


class IssueEvent(CompletableGithubObject):
"""
Expand All @@ -66,43 +76,52 @@ class IssueEvent(CompletableGithubObject):
"""

def _initAttributes(self) -> None:
self._actor: Attribute[github.NamedUser.NamedUser] = NotSet
self._assignee: Attribute[github.NamedUser.NamedUser] = NotSet
self._assigner: Attribute[github.NamedUser.NamedUser] = NotSet
self._actor: Attribute[NamedUser] = NotSet
self._assignee: Attribute[NamedUser] = NotSet
self._assigner: Attribute[NamedUser] = NotSet
self._author_association: Attribute[dict[str, Any]] = NotSet
self._commit_id: Attribute[str] = NotSet
self._commit_url: Attribute[str] = NotSet
self._created_at: Attribute[datetime] = NotSet
self._dismissed_review: Attribute[dict] = NotSet
self._event: Attribute[str] = NotSet
self._id: Attribute[int] = NotSet
self._issue: Attribute[github.Issue.Issue] = NotSet
self._label: Attribute[github.Label.Label] = NotSet
self._issue: Attribute[Issue] = NotSet
self._label: Attribute[Label] = NotSet
self._lock_reason: Attribute[str] = NotSet
self._milestone: Attribute[github.Milestone.Milestone] = NotSet
self._milestone: Attribute[Milestone] = NotSet
self._node_id: Attribute[str] = NotSet
self._performed_via_github_app: Attribute[GithubApp] = NotSet
self._project_card: Attribute[dict[str, Any]] = NotSet
self._rename: Attribute[dict] = NotSet
self._requested_reviewer: Attribute[github.NamedUser.NamedUser] = NotSet
self._review_requester: Attribute[github.NamedUser.NamedUser] = NotSet
self._requested_reviewer: Attribute[NamedUser] = NotSet
self._requested_team: Attribute[Team] = NotSet
self._review_requester: Attribute[NamedUser] = NotSet
self._url: Attribute[str] = NotSet

def __repr__(self) -> str:
return self.get__repr__({"id": self._id.value})

@property
def actor(self) -> github.NamedUser.NamedUser:
def actor(self) -> NamedUser:
self._completeIfNotSet(self._actor)
return self._actor.value

@property
def assignee(self) -> github.NamedUser.NamedUser:
def assignee(self) -> NamedUser:
self._completeIfNotSet(self._assignee)
return self._assignee.value

@property
def assigner(self) -> github.NamedUser.NamedUser:
def assigner(self) -> NamedUser:
self._completeIfNotSet(self._assigner)
return self._assigner.value

@property
def author_association(self) -> dict[str, Any]:
self._completeIfNotSet(self._author_association)
return self._author_association.value

@property
def commit_id(self) -> str:
self._completeIfNotSet(self._commit_id)
Expand Down Expand Up @@ -134,12 +153,12 @@ def id(self) -> int:
return self._id.value

@property
def issue(self) -> github.Issue.Issue:
def issue(self) -> Issue:
self._completeIfNotSet(self._issue)
return self._issue.value

@property
def label(self) -> github.Label.Label:
def label(self) -> Label:
self._completeIfNotSet(self._label)
return self._label.value

Expand All @@ -149,7 +168,7 @@ def lock_reason(self) -> str:
return self._lock_reason.value

@property
def milestone(self) -> github.Milestone.Milestone:
def milestone(self) -> Milestone:
self._completeIfNotSet(self._milestone)
return self._milestone.value

Expand All @@ -158,18 +177,33 @@ def node_id(self) -> str:
self._completeIfNotSet(self._node_id)
return self._node_id.value

@property
def performed_via_github_app(self) -> GithubApp:
self._completeIfNotSet(self._performed_via_github_app)
return self._performed_via_github_app.value

@property
def project_card(self) -> dict[str, Any]:
self._completeIfNotSet(self._project_card)
return self._project_card.value

@property
def rename(self) -> dict:
self._completeIfNotSet(self._rename)
return self._rename.value

@property
def requested_reviewer(self) -> github.NamedUser.NamedUser:
def requested_reviewer(self) -> NamedUser:
self._completeIfNotSet(self._requested_reviewer)
return self._requested_reviewer.value

@property
def review_requester(self) -> github.NamedUser.NamedUser:
def requested_team(self) -> Team:
self._completeIfNotSet(self._requested_team)
return self._requested_team.value

@property
def review_requester(self) -> NamedUser:
self._completeIfNotSet(self._review_requester)
return self._review_requester.value

Expand All @@ -185,6 +219,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
if "assigner" in attributes: # pragma no branch
self._assigner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assigner"])
if "author_association" in attributes: # pragma no branch
self._author_association = self._makeDictAttribute(attributes["author_association"])
if "commit_id" in attributes: # pragma no branch
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
if "commit_url" in attributes: # pragma no branch
Expand All @@ -207,12 +243,20 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._milestone = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])
if "performed_via_github_app" in attributes: # pragma no branch
self._performed_via_github_app = self._makeClassAttribute(
github.GithubApp.GithubApp, attributes["performed_via_github_app"]
)
if "project_card" in attributes: # pragma no branch
self._project_card = self._makeDictAttribute(attributes["project_card"])
if "rename" in attributes: # pragma no branch
self._rename = self._makeDictAttribute(attributes["rename"])
if "requested_reviewer" in attributes: # pragma no branch
self._requested_reviewer = self._makeClassAttribute(
github.NamedUser.NamedUser, attributes["requested_reviewer"]
)
if "requested_team" in attributes: # pragma no branch
self._requested_team = self._makeClassAttribute(github.Team.Team, attributes["requested_team"])
if "review_requester" in attributes: # pragma no branch
self._review_requester = self._makeClassAttribute(
github.NamedUser.NamedUser, attributes["review_requester"]
Expand Down
Loading

0 comments on commit be44bb5

Please sign in to comment.