NamedEnterpriseUser.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2023 Yugo Hino <henom06@gmail.com> # 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 from typing import Any, Dict 23 24 from github.GithubObject import Attribute, CompletableGithubObject, NotSet 25 26 27 class NamedEnterpriseUser(CompletableGithubObject): 28 """ 29 This class represents NamedEnterpriseUsers. The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses 30 """ 31 32 def _initAttributes(self) -> None: 33 self._github_com_login: Attribute[str] = NotSet 34 self._github_com_name: Attribute[str] = NotSet 35 self._enterprise_server_user_ids: Attribute[list] = NotSet 36 self._github_com_user: Attribute[bool] = NotSet 37 self._enterprise_server_user: Attribute[bool] = NotSet 38 self._visual_studio_subscription_user: Attribute[bool] = NotSet 39 self._license_type: Attribute[str] = NotSet 40 self._github_com_profile: Attribute[str] = NotSet 41 self._github_com_member_roles: Attribute[list] = NotSet 42 self._github_com_enterprise_roles: Attribute[list] = NotSet 43 self._github_com_verified_domain_emails: Attribute[list] = NotSet 44 self._github_com_saml_name_id: Attribute[str] = NotSet 45 self._github_com_orgs_with_pending_invites: Attribute[list] = NotSet 46 self._github_com_two_factor_auth: Attribute[bool] = NotSet 47 self._enterprise_server_primary_emails: Attribute[list] = NotSet 48 self._visual_studio_license_status: Attribute[str] = NotSet 49 self._visual_studio_subscription_email: Attribute[str] = NotSet 50 self._total_user_accounts: Attribute[int] = NotSet 51 52 def __repr__(self) -> str: 53 return self.get__repr__({"login": self._github_com_login.value}) 54 55 @property 56 def github_com_login(self) -> str: 57 self._completeIfNotSet(self._github_com_login) 58 return self._github_com_login.value 59 60 @property 61 def github_com_name(self) -> str: 62 self._completeIfNotSet(self._github_com_name) 63 return self._github_com_name.value 64 65 @property 66 def enterprise_server_user_ids(self) -> list: 67 self._completeIfNotSet(self._enterprise_server_user_ids) 68 return self._enterprise_server_user_ids.value 69 70 @property 71 def github_com_user(self) -> bool: 72 self._completeIfNotSet(self._github_com_user) 73 return self._github_com_user.value 74 75 @property 76 def enterprise_server_user(self) -> bool: 77 self._completeIfNotSet(self._enterprise_server_user) 78 return self._enterprise_server_user.value 79 80 @property 81 def visual_studio_subscription_user(self) -> bool: 82 self._completeIfNotSet(self._visual_studio_subscription_user) 83 return self._visual_studio_subscription_user.value 84 85 @property 86 def license_type(self) -> str: 87 self._completeIfNotSet(self._license_type) 88 return self._license_type.value 89 90 @property 91 def github_com_profile(self) -> str: 92 self._completeIfNotSet(self._github_com_profile) 93 return self._github_com_profile.value 94 95 @property 96 def github_com_member_roles(self) -> list: 97 self._completeIfNotSet(self._github_com_member_roles) 98 return self._github_com_member_roles.value 99 100 @property 101 def github_com_enterprise_roles(self) -> list: 102 self._completeIfNotSet(self._github_com_enterprise_roles) 103 return self._github_com_enterprise_roles.value 104 105 @property 106 def github_com_verified_domain_emails(self) -> list: 107 self._completeIfNotSet(self._github_com_verified_domain_emails) 108 return self._github_com_verified_domain_emails.value 109 110 @property 111 def github_com_saml_name_id(self) -> str: 112 self._completeIfNotSet(self._github_com_saml_name_id) 113 return self._github_com_saml_name_id.value 114 115 @property 116 def github_com_orgs_with_pending_invites(self) -> list: 117 self._completeIfNotSet(self._github_com_orgs_with_pending_invites) 118 return self._github_com_orgs_with_pending_invites.value 119 120 @property 121 def github_com_two_factor_auth(self) -> bool: 122 self._completeIfNotSet(self._github_com_two_factor_auth) 123 return self._github_com_two_factor_auth.value 124 125 @property 126 def enterprise_server_primary_emails(self) -> list: 127 self._completeIfNotSet(self._enterprise_server_primary_emails) 128 return self._enterprise_server_primary_emails.value 129 130 @property 131 def visual_studio_license_status(self) -> str: 132 self._completeIfNotSet(self._visual_studio_license_status) 133 return self._visual_studio_license_status.value 134 135 @property 136 def visual_studio_subscription_email(self) -> str: 137 self._completeIfNotSet(self._visual_studio_subscription_email) 138 return self._visual_studio_subscription_email.value 139 140 @property 141 def total_user_accounts(self) -> int: 142 self._completeIfNotSet(self._total_user_accounts) 143 return self._total_user_accounts.value 144 145 def _useAttributes(self, attributes: Dict[str, Any]) -> None: 146 if "github_com_login" in attributes: # pragma no branch 147 self._github_com_login = self._makeStringAttribute(attributes["github_com_login"]) 148 if "github_com_name" in attributes: # pragma no branch 149 self._github_com_name = self._makeStringAttribute(attributes["github_com_name"]) 150 if "enterprise_server_user_ids" in attributes: # pragma no branch 151 self._enterprise_server_user_ids = self._makeListOfStringsAttribute( 152 attributes["enterprise_server_user_ids"] 153 ) 154 if "github_com_user" in attributes: # pragma no branch 155 self._github_com_user = self._makeBoolAttribute(attributes["github_com_user"]) 156 if "enterprise_server_user" in attributes: # pragma no branch 157 self._enterprise_server_user = self._makeBoolAttribute(attributes["enterprise_server_user"]) 158 if "visual_studio_subscription_user" in attributes: # pragma no branch 159 self._visual_studio_subscription_user = self._makeBoolAttribute( 160 attributes["visual_studio_subscription_user"] 161 ) 162 if "license_type" in attributes: # pragma no branch 163 self._license_type = self._makeStringAttribute(attributes["license_type"]) 164 if "github_com_profile" in attributes: # pragma no branch 165 self._github_com_profile = self._makeStringAttribute(attributes["github_com_profile"]) 166 if "github_com_member_roles" in attributes: # pragma no branch 167 self._github_com_member_roles = self._makeListOfStringsAttribute(attributes["github_com_member_roles"]) 168 if "github_com_enterprise_roles" in attributes: # pragma no branch 169 self._github_com_enterprise_roles = self._makeListOfStringsAttribute( 170 attributes["github_com_enterprise_roles"] 171 ) 172 if "github_com_verified_domain_emails" in attributes: # pragma no branch 173 self._github_com_verified_domain_emails = self._makeListOfStringsAttribute( 174 attributes["github_com_verified_domain_emails"] 175 ) 176 if "github_com_saml_name_id" in attributes: # pragma no branch 177 self._github_com_saml_name_id = self._makeStringAttribute(attributes["github_com_saml_name_id"]) 178 if "github_com_orgs_with_pending_invites" in attributes: # pragma no branch 179 self._github_com_orgs_with_pending_invites = self._makeListOfStringsAttribute( 180 attributes["github_com_orgs_with_pending_invites"] 181 ) 182 if "github_com_two_factor_auth" in attributes: # pragma no branch 183 self._github_com_two_factor_auth = self._makeBoolAttribute(attributes["github_com_two_factor_auth"]) 184 if "enterprise_server_primary_emails" in attributes: # pragma no branch 185 self._enterprise_server_primary_emails = self._makeListOfStringsAttribute( 186 attributes["enterprise_server_primary_emails"] 187 ) 188 if "visual_studio_license_status" in attributes: # pragma no branch 189 self._visual_studio_license_status = self._makeStringAttribute(attributes["visual_studio_license_status"]) 190 if "visual_studio_subscription_email" in attributes: # pragma no branch 191 self._visual_studio_subscription_email = self._makeStringAttribute( 192 attributes["visual_studio_subscription_email"] 193 ) 194 if "total_user_accounts" in attributes: # pragma no branch 195 self._total_user_accounts = self._makeIntAttribute(attributes["total_user_accounts"])