Browse Source

Rename and document ApplicationCompany & ApplicationExecutable

pull/10109/head
dolfies 3 years ago
parent
commit
4245a72146
  1. 28
      discord/appinfo.py
  2. 10
      docs/api.rst

28
discord/appinfo.py

@ -47,8 +47,8 @@ if TYPE_CHECKING:
__all__ = ( __all__ = (
'ApplicationBot', 'ApplicationBot',
'Company', 'ApplicationCompany',
'Executable', 'ApplicationExecutable',
'Application', 'Application',
'PartialApplication', 'PartialApplication',
'InteractionApplication', 'InteractionApplication',
@ -136,7 +136,7 @@ class ApplicationBot(User):
self.application._update(data) self.application._update(data)
class Company(Hashable): class ApplicationCompany(Hashable):
"""Represents a developer or publisher of an application. """Represents a developer or publisher of an application.
.. container:: operations .. container:: operations
@ -184,8 +184,8 @@ class Company(Hashable):
return self.name return self.name
class Executable: class ApplicationExecutable:
"""Represents an executable. """Represents an application executable.
.. versionadded:: 2.0 .. versionadded:: 2.0
@ -275,11 +275,11 @@ class PartialApplication(Hashable):
Whether the application has a Discord overlay or not. Whether the application has a Discord overlay or not.
aliases: List[:class:`str`] aliases: List[:class:`str`]
A list of aliases that can be used to identify the application. Only available for specific applications. A list of aliases that can be used to identify the application. Only available for specific applications.
developers: List[:class:`Company`] developers: List[:class:`ApplicationCompany`]
A list of developers that developed the application. Only available for specific applications. A list of developers that developed the application. Only available for specific applications.
publishers: List[:class:`Company`] publishers: List[:class:`ApplicationCompany`]
A list of publishers that published the application. Only available for specific applications. A list of publishers that published the application. Only available for specific applications.
executables: List[:class:`Executable`] executables: List[:class:`ApplicationExecutable`]
A list of executables that are the application's. Only available for specific applications. A list of executables that are the application's. Only available for specific applications.
""" """
@ -326,9 +326,15 @@ class PartialApplication(Hashable):
self.rpc_origins: Optional[List[str]] = data.get('rpc_origins') or [] self.rpc_origins: Optional[List[str]] = data.get('rpc_origins') or []
self.verify_key: str = data['verify_key'] self.verify_key: str = data['verify_key']
self.developers: List[Company] = [Company(data=d, application=self) for d in data.get('developers', [])] self.developers: List[ApplicationCompany] = [
self.publishers: List[Company] = [Company(data=d, application=self) for d in data.get('publishers', [])] ApplicationCompany(data=d, application=self) for d in data.get('developers', [])
self.executables: List[Executable] = [Executable(data=e, application=self) for e in data.get('executables', [])] ]
self.publishers: List[ApplicationCompany] = [
ApplicationCompany(data=d, application=self) for d in data.get('publishers', [])
]
self.executables: List[ApplicationExecutable] = [
ApplicationExecutable(data=e, application=self) for e in data.get('executables', [])
]
self.aliases: List[str] = data.get('aliases', []) self.aliases: List[str] = data.get('aliases', [])
self._icon: Optional[str] = data.get('icon') self._icon: Optional[str] = data.get('icon')

10
docs/api.rst

@ -4112,6 +4112,16 @@ Application
.. autoclass:: PartialApplication() .. autoclass:: PartialApplication()
:members: :members:
.. attributetable:: ApplicationCompany
.. autoclass:: ApplicationCompany()
:members:
.. attributetable:: ApplicationExecutable
.. autoclass:: ApplicationExecutable()
:members:
.. attributetable:: InteractionApplication .. attributetable:: InteractionApplication
.. autoclass:: InteractionApplication() .. autoclass:: InteractionApplication()

Loading…
Cancel
Save