HookDescription.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> # 4 # Copyright 2012 Zearin <zearin@gonk.net> # 5 # Copyright 2013 AKFish <akfish@gmail.com> # 6 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # 7 # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> # 8 # Copyright 2016 Jannis Gebauer <ja.geb@me.com> # 9 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> # 10 # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> # 11 # Copyright 2018 sfdye <tsfdye@gmail.com> # 12 # # 13 # This file is part of PyGithub. # 14 # http://pygithub.readthedocs.io/ # 15 # # 16 # PyGithub is free software: you can redistribute it and/or modify it under # 17 # the terms of the GNU Lesser General Public License as published by the Free # 18 # Software Foundation, either version 3 of the License, or (at your option) # 19 # any later version. # 20 # # 21 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 22 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 23 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 24 # details. # 25 # # 26 # You should have received a copy of the GNU Lesser General Public License # 27 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 28 # # 29 ################################################################################ 30 from __future__ import annotations 31 32 from typing import Any 33 34 from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet 35 36 37 class HookDescription(NonCompletableGithubObject): 38 """ 39 This class represents HookDescriptions 40 """ 41 42 def _initAttributes(self) -> None: 43 self._events: Attribute[list[str]] = NotSet 44 self._name: Attribute[str] = NotSet 45 self._schema: Attribute[list[list[str]]] = NotSet 46 self._supported_events: Attribute[list[str]] = NotSet 47 48 def __repr__(self) -> str: 49 return self.get__repr__({"name": self._name.value}) 50 51 @property 52 def events(self) -> list[str]: 53 return self._events.value 54 55 @property 56 def name(self) -> str: 57 return self._name.value 58 59 @property 60 def schema(self) -> list[list[str]]: 61 return self._schema.value 62 63 @property 64 def supported_events(self) -> list[str]: 65 return self._supported_events.value 66 67 def _useAttributes(self, attributes: dict[str, Any]) -> None: 68 if "events" in attributes: # pragma no branch 69 self._events = self._makeListOfStringsAttribute(attributes["events"]) 70 if "name" in attributes: # pragma no branch 71 self._name = self._makeStringAttribute(attributes["name"]) 72 if "schema" in attributes: # pragma no branch 73 self._schema = self._makeListOfListOfStringsAttribute(attributes["schema"]) 74 if "supported_events" in attributes: # pragma no branch 75 self._supported_events = self._makeListOfStringsAttribute(attributes["supported_events"])