Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync GithubApp class with API spec #3127

Merged
merged 7 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Updated class according to API spec
  • Loading branch information
EnricoMi committed Jan 8, 2025
commit 591af89394eeb0df571a0eb2e47d4d2fc8c40edb
48 changes: 48 additions & 0 deletions github/GithubApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,38 @@ class GithubApp(CompletableGithubObject):
"""

def _initAttributes(self) -> None:
self._client_id: Attribute[str] = NotSet
self._client_secret: Attribute[str] = NotSet
self._created_at: Attribute[datetime] = NotSet
self._description: Attribute[str] = NotSet
self._events: Attribute[list[str]] = NotSet
self._external_url: Attribute[str] = NotSet
self._html_url: Attribute[str] = NotSet
self._id: Attribute[int] = NotSet
self._installations_count: Attribute[int] = NotSet
self._name: Attribute[str] = NotSet
self._node_id: Attribute[str] = NotSet
self._owner: Attribute[github.NamedUser.NamedUser] = NotSet
self._pem: Attribute[str] = NotSet
self._permissions: Attribute[dict[str, str]] = NotSet
self._slug: Attribute[str] = NotSet
self._updated_at: Attribute[datetime] = NotSet
self._url: Attribute[str] = NotSet
self._webhook_secret: Attribute[str] = NotSet

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

@property
def client_id(self) -> str:
self._completeIfNotSet(self._client_id)
return self._client_id.value

@property
def client_secret(self) -> str:
self._completeIfNotSet(self._client_secret)
return self._client_secret.value

@property
def created_at(self) -> datetime:
self._completeIfNotSet(self._created_at)
Expand Down Expand Up @@ -111,16 +127,31 @@ def id(self) -> int:
self._completeIfNotSet(self._id)
return self._id.value

@property
def installations_count(self) -> int:
self._completeIfNotSet(self._installations_count)
return self._installations_count.value

@property
def name(self) -> str:
self._completeIfNotSet(self._name)
return self._name.value

@property
def node_id(self) -> str:
self._completeIfNotSet(self._node_id)
return self._node_id.value

@property
def owner(self) -> github.NamedUser.NamedUser:
self._completeIfNotSet(self._owner)
return self._owner.value

@property
def pem(self) -> str:
self._completeIfNotSet(self._pem)
return self._pem.value

@property
def permissions(self) -> dict[str, str]:
self._completeIfNotSet(self._permissions)
Expand All @@ -140,7 +171,16 @@ def updated_at(self) -> datetime:
def url(self) -> str:
return self._url.value

@property
def webhook_secret(self) -> str:
self._completeIfNotSet(self._webhook_secret)
return self._webhook_secret.value

def _useAttributes(self, attributes: dict[str, Any]) -> None:
if "client_id" in attributes: # pragma no branch
self._client_id = self._makeStringAttribute(attributes["client_id"])
if "client_secret" in attributes: # pragma no branch
self._client_secret = self._makeStringAttribute(attributes["client_secret"])
if "created_at" in attributes: # pragma no branch
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
if "description" in attributes: # pragma no branch
Expand All @@ -153,10 +193,16 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._html_url = self._makeStringAttribute(attributes["html_url"])
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])
if "installations_count" in attributes: # pragma no branch
self._installations_count = self._makeIntAttribute(attributes["installations_count"])
if "name" in attributes: # pragma no branch
self._name = self._makeStringAttribute(attributes["name"])
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])
if "owner" in attributes: # pragma no branch
self._owner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
if "pem" in attributes: # pragma no branch
self._pem = self._makeStringAttribute(attributes["pem"])
if "permissions" in attributes: # pragma no branch
self._permissions = self._makeDictAttribute(attributes["permissions"])
if "slug" in attributes: # pragma no branch
Expand All @@ -166,3 +212,5 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
if "url" in attributes:
self._url = self._makeStringAttribute(attributes["url"])
if "webhook_secret" in attributes: # pragma no branch
self._webhook_secret = self._makeStringAttribute(attributes["webhook_secret"])