|
| 1 | +############################ Copyrights and license ############################ |
| 2 | +# # |
| 3 | +# Copyright 2024 Pasha Fateev <[email protected]> # |
| 4 | +# # |
| 5 | +# This file is part of PyGithub. # |
| 6 | +# http://pygithub.readthedocs.io/ # |
| 7 | +# # |
| 8 | +# PyGithub is free software: you can redistribute it and/or modify it under # |
| 9 | +# the terms of the GNU Lesser General Public License as published by the Free # |
| 10 | +# Software Foundation, either version 3 of the License, or (at your option) # |
| 11 | +# any later version. # |
| 12 | +# # |
| 13 | +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # |
| 14 | +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # |
| 15 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # |
| 16 | +# details. # |
| 17 | +# # |
| 18 | +# You should have received a copy of the GNU Lesser General Public License # |
| 19 | +# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # |
| 20 | +# # |
| 21 | +################################################################################ |
| 22 | + |
| 23 | +from __future__ import annotations |
| 24 | + |
| 25 | +from datetime import datetime |
| 26 | +from typing import Any |
| 27 | + |
| 28 | +import github.NamedUser |
| 29 | +import github.Team |
| 30 | +from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet, _NotSetType |
| 31 | + |
| 32 | + |
| 33 | +class CopilotSeat(NonCompletableGithubObject): |
| 34 | + def _initAttributes(self) -> None: |
| 35 | + self._created_at: Attribute[datetime] | _NotSetType = NotSet |
| 36 | + self._updated_at: Attribute[datetime] | _NotSetType = NotSet |
| 37 | + self._pending_cancellation_date: Attribute[datetime] | _NotSetType = NotSet |
| 38 | + self._last_activity_at: Attribute[datetime] | _NotSetType = NotSet |
| 39 | + self._last_activity_editor: Attribute[str] | _NotSetType = NotSet |
| 40 | + self._plan_type: Attribute[str] | _NotSetType = NotSet |
| 41 | + self._assignee: Attribute[github.NamedUser.NamedUser] | _NotSetType = NotSet |
| 42 | + self._assigning_team: Attribute[github.Team.Team] | _NotSetType = NotSet |
| 43 | + |
| 44 | + def _useAttributes(self, attributes: dict[str, Any]) -> None: |
| 45 | + if "created_at" in attributes: |
| 46 | + self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) |
| 47 | + if "updated_at" in attributes: |
| 48 | + self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) |
| 49 | + if "pending_cancellation_date" in attributes: |
| 50 | + self._pending_cancellation_date = self._makeDatetimeAttribute(attributes["pending_cancellation_date"]) |
| 51 | + if "last_activity_at" in attributes: |
| 52 | + self._last_activity_at = self._makeDatetimeAttribute(attributes["last_activity_at"]) |
| 53 | + if "last_activity_editor" in attributes: |
| 54 | + self._last_activity_editor = self._makeStringAttribute(attributes["last_activity_editor"]) |
| 55 | + if "plan_type" in attributes: |
| 56 | + self._plan_type = self._makeStringAttribute(attributes["plan_type"]) |
| 57 | + if "assignee" in attributes: |
| 58 | + self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"]) |
| 59 | + if "assigning_team" in attributes: |
| 60 | + self._assigning_team = self._makeClassAttribute(github.Team.Team, attributes["assigning_team"]) |
| 61 | + |
| 62 | + def __repr__(self) -> str: |
| 63 | + return self.get__repr__({"assignee": self._assignee.value}) |
| 64 | + |
| 65 | + @property |
| 66 | + def created_at(self) -> datetime: |
| 67 | + return self._created_at.value |
| 68 | + |
| 69 | + @property |
| 70 | + def updated_at(self) -> datetime: |
| 71 | + return self._updated_at.value |
| 72 | + |
| 73 | + @property |
| 74 | + def pending_cancellation_date(self) -> datetime: |
| 75 | + return self._pending_cancellation_date.value |
| 76 | + |
| 77 | + @property |
| 78 | + def last_activity_at(self) -> datetime: |
| 79 | + return self._last_activity_at.value |
| 80 | + |
| 81 | + @property |
| 82 | + def last_activity_editor(self) -> str: |
| 83 | + return self._last_activity_editor.value |
| 84 | + |
| 85 | + @property |
| 86 | + def plan_type(self) -> str: |
| 87 | + return self._plan_type.value |
| 88 | + |
| 89 | + @property |
| 90 | + def assignee(self) -> github.NamedUser.NamedUser: |
| 91 | + return self._assignee.value |
| 92 | + |
| 93 | + @property |
| 94 | + def assigning_team(self) -> github.Team.Team: |
| 95 | + return self._assigning_team.value |
0 commit comments