|
181 | 181 |
|
182 | 182 | GitHubOrganization() {}
|
183 | 183 |
|
| 184 | + GitHubOrganization([PSCustomObject] $Object) { |
| 185 | + $this.InitializeFromObject($Object) |
| 186 | + } |
| 187 | + |
184 | 188 | GitHubOrganization([PSCustomObject] $Object, [GitHubContext] $Context) {
|
| 189 | + $this.InitializeFromObject($Object) |
| 190 | + $this.Url = "https://$($Context.HostName)/$($Object.login)" |
| 191 | + } |
| 192 | + |
| 193 | + hidden [void] InitializeFromObject([PSCustomObject] $Object) { |
185 | 194 | # From GitHubNode
|
186 | 195 | $this.ID = $Object.databaseId ?? $Object.id
|
187 |
| - $this.NodeID = $Object.node_id ?? $Object.id |
| 196 | + $this.NodeID = $Object.node_id ?? $Object.NodeID ?? $Object.id |
188 | 197 |
|
189 | 198 | # From GitHubOwner
|
190 |
| - $this.Name = $Object.login |
191 |
| - $this.DisplayName = $Object.name |
| 199 | + $this.Name = $Object.login ?? $Object.Name |
| 200 | + $this.DisplayName = $Object.name ?? $Object.DisplayName |
192 | 201 | $this.AvatarUrl = $Object.avatar_url ?? $Object.avatarUrl
|
193 |
| - $this.Url = $Object.html_url ?? $Object.url ?? "https://$($Context.HostName)/$($Object.login)" |
| 202 | + $this.Url = $Object.html_url ?? $Object.url |
194 | 203 | $this.Type = $Object.type ?? 'Organization'
|
195 | 204 | $this.Location = $Object.location
|
196 | 205 | $this.Description = $Object.description
|
|
202 | 211 | $this.Email = $Object.email
|
203 | 212 | $this.TwitterUsername = $Object.twitter_username ?? $Object.twitterUsername
|
204 | 213 | $this.Plan = [GitHubPlan]::New($Object.plan)
|
205 |
| - $this.PublicRepos = $Object.public_repos |
206 |
| - $this.PublicGists = $Object.public_gists |
| 214 | + $this.PublicRepos = $Object.public_repos ?? $Object.PublicRepos |
| 215 | + $this.PublicGists = $Object.public_gists ?? $Object.PublicGists |
207 | 216 | $this.Followers = $Object.followers
|
208 | 217 | $this.Following = $Object.following
|
209 |
| - $this.PrivateGists = $Object.total_private_gists |
210 |
| - $this.TotalPrivateRepos = $Object.total_private_repos |
211 |
| - $this.OwnedPrivateRepos = $Object.owned_private_repos |
212 |
| - if ($null -ne $Object.disk_usage) { |
213 |
| - $this.Size = [uint64]($Object.disk_usage * 1KB) |
| 218 | + $this.PrivateGists = $Object.total_private_gists ?? $Object.PrivateGists |
| 219 | + $this.TotalPrivateRepos = $Object.total_private_repos ?? $Object.TotalPrivateRepos |
| 220 | + $this.OwnedPrivateRepos = $Object.owned_private_repos ?? $Object.OwnedPrivateRepos |
| 221 | + $this.Size = if ($null -ne $Object.disk_usage) { |
| 222 | + [uint64]($Object.disk_usage * 1KB) |
| 223 | + } else { |
| 224 | + $Object.Size |
214 | 225 | }
|
215 | 226 | $this.Collaborators = $Object.collaborators
|
216 | 227 | $this.IsVerified = $Object.is_verified ?? $Object.isVerified
|
217 |
| - $this.HasOrganizationProjects = $Object.has_organization_projects |
218 |
| - $this.HasRepositoryProjects = $Object.has_repository_projects |
219 |
| - $this.BillingEmail = $Object.billing_email |
220 |
| - $this.DefaultRepositoryPermission = $Object.default_repository_permission |
221 |
| - $this.MembersCanCreateRepositories = $Object.members_can_create_repositories |
222 |
| - $this.RequiresTwoFactorAuthentication = $Object.two_factor_requirement_enabled ?? $Object.requiresTwoFactorAuthentication |
223 |
| - $this.MembersAllowedRepositoryCreationType = $Object.members_allowed_repository_creation_type |
224 |
| - $this.MembersCanCreatePublicRepositories = $Object.members_can_create_public_repositories |
225 |
| - $this.MembersCanCreatePrivateRepositories = $Object.members_can_create_private_repositories |
226 |
| - $this.MembersCanCreateInternalRepositories = $Object.members_can_create_internal_repositories |
227 |
| - $this.MembersCanInviteCollaborators = $Object.members_can_invite_collaborators |
228 |
| - $this.MembersCanCreatePages = $Object.members_can_create_pages |
| 228 | + $this.HasOrganizationProjects = $Object.has_organization_projects ?? $Object.HasOrganizationProjects |
| 229 | + $this.HasRepositoryProjects = $Object.has_repository_projects ?? $Object.HasRepositoryProjects |
| 230 | + $this.BillingEmail = $Object.billing_email ?? $Object.BillingEmail |
| 231 | + $this.DefaultRepositoryPermission = $Object.default_repository_permission ?? $Object.DefaultRepositoryPermission |
| 232 | + $this.MembersCanCreateRepositories = $Object.members_can_create_repositories ?? $Object.MembersCanCreateRepositories |
| 233 | + $this.RequiresTwoFactorAuthentication = $Object.two_factor_requirement_enabled ?? $Object.requiresTwoFactorAuthentication ?? |
| 234 | + $Object.RequiresTwoFactorAuthentication |
| 235 | + $this.MembersAllowedRepositoryCreationType = $Object.members_allowed_repository_creation_type ?? $Object.MembersAllowedRepositoryCreationType |
| 236 | + $this.MembersCanCreatePublicRepositories = $Object.members_can_create_public_repositories ?? $Object.MembersCanCreatePublicRepositories |
| 237 | + $this.MembersCanCreatePrivateRepositories = $Object.members_can_create_private_repositories ?? $Object.MembersCanCreatePrivateRepositories |
| 238 | + $this.MembersCanCreateInternalRepositories = $Object.members_can_create_internal_repositories ?? $Object.MembersCanCreateInternalRepositories |
| 239 | + $this.MembersCanInviteCollaborators = $Object.members_can_invite_collaborators ?? $Object.MembersCanInviteCollaborators |
| 240 | + $this.MembersCanCreatePages = $Object.members_can_create_pages ?? $Object.MembersCanCreatePages |
229 | 241 | $this.MembersCanForkPrivateRepositories = $Object.members_can_fork_private_repositories ?? $Object.membersCanForkPrivateRepositories
|
230 |
| - $this.RequireWebCommitSignoff = $Object.web_commit_signoff_required ?? $Object.webCommitSignoffRequired |
231 |
| - $this.DeployKeysEnabledForRepositories = $Object.deploy_keys_enabled_for_repositories |
232 |
| - $this.MembersCanCreatePublicPages = $Object.members_can_create_public_pages |
233 |
| - $this.MembersCanCreatePrivatePages = $Object.members_can_create_private_pages |
234 |
| - $this.AdvancedSecurityEnabledForNewRepositories = $Object.advanced_security_enabled_for_new_repositories |
235 |
| - $this.DependabotAlertsEnabledForNewRepositories = $Object.dependabot_alerts_enabled_for_new_repositories |
236 |
| - $this.DependabotSecurityUpdatesEnabledForNewRepositories = $Object.dependabot_security_updates_enabled_for_new_repositories |
237 |
| - $this.DependencyGraphEnabledForNewRepositories = $Object.dependency_graph_enabled_for_new_repositories |
238 |
| - $this.SecretScanningEnabledForNewRepositories = $Object.secret_scanning_enabled_for_new_repositories |
239 |
| - $this.SecretScanningPushProtectionEnabledForNewRepositories = $Object.secret_scanning_push_protection_enabled_for_new_repositories |
240 |
| - $this.SecretScanningPushProtectionCustomLinkEnabled = $Object.secret_scanning_push_protection_custom_link_enabled |
241 |
| - $this.SecretScanningPushProtectionCustomLink = $Object.secret_scanning_push_protection_custom_link |
242 |
| - $this.SecretScanningValidityChecksEnabled = $Object.secret_scanning_validity_checks_enabled |
| 242 | + $this.RequireWebCommitSignoff = $Object.web_commit_signoff_required ?? $Object.webCommitSignoffRequired ?? $Object.RequireWebCommitSignoff |
| 243 | + $this.DeployKeysEnabledForRepositories = $Object.deploy_keys_enabled_for_repositories ?? $Object.deployKeysEnabledForRepositories |
| 244 | + $this.MembersCanCreatePublicPages = $Object.members_can_create_public_pages ?? $Object.MembersCanCreatePublicPages |
| 245 | + $this.MembersCanCreatePrivatePages = $Object.members_can_create_private_pages ?? $Object.MembersCanCreatePrivatePages |
| 246 | + $this.AdvancedSecurityEnabledForNewRepositories = $Object.advanced_security_enabled_for_new_repositories ?? |
| 247 | + $Object.advancedSecurityEnabledForNewRepositories |
| 248 | + $this.DependabotAlertsEnabledForNewRepositories = $Object.dependabot_alerts_enabled_for_new_repositories ?? |
| 249 | + $Object.dependabotAlertsEnabledForNewRepositories |
| 250 | + $this.DependabotSecurityUpdatesEnabledForNewRepositories = $Object.dependabot_security_updates_enabled_for_new_repositories ?? |
| 251 | + $Object.dependabotSecurityUpdatesEnabledForNewRepositories |
| 252 | + $this.DependencyGraphEnabledForNewRepositories = $Object.dependency_graph_enabled_for_new_repositories ?? |
| 253 | + $Object.dependencyGraphEnabledForNewRepositories |
| 254 | + $this.SecretScanningEnabledForNewRepositories = $Object.secret_scanning_enabled_for_new_repositories ?? |
| 255 | + $Object.secretScanningEnabledForNewRepositories |
| 256 | + $this.SecretScanningPushProtectionEnabledForNewRepositories = $Object.secret_scanning_push_protection_enabled_for_new_repositories ?? |
| 257 | + $Object.secretScanningPushProtectionEnabledForNewRepositories |
| 258 | + $this.SecretScanningPushProtectionCustomLinkEnabled = $Object.secret_scanning_push_protection_custom_link_enabled ?? |
| 259 | + $Object.secretScanningPushProtectionCustomLinkEnabled |
| 260 | + $this.SecretScanningPushProtectionCustomLink = $Object.secret_scanning_push_protection_custom_link ?? |
| 261 | + $Object.secretScanningPushProtectionCustomLink |
| 262 | + $this.SecretScanningValidityChecksEnabled = $Object.secret_scanning_validity_checks_enabled ?? |
| 263 | + $Object.secretScanningValidityChecksEnabled |
243 | 264 | $this.ArchivedAt = $Object.archived_at ?? $Object.archivedAt
|
244 | 265 | }
|
245 | 266 |
|
|
0 commit comments