A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/microsoft/PowerShellForGitHub/commit/eedfaa3740ac5330128fea27038f213c8abf1d4b below:

Update GitHubRepositories Tests and Refactor Get-GitHubRepository Fun… · microsoft/PowerShellForGitHub@eedfaa3 · GitHub

@@ -658,8 +658,10 @@ filter Get-GitHubRepository

658 658

SupportsShouldProcess,

659 659

DefaultParameterSetName='AuthenticatedUser')]

660 660

[OutputType({$script:GitHubRepositoryTypeName})]

661 -

[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]

662 -

[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]

661 +

[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "",

662 +

Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]

663 +

[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "",

664 +

Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]

663 665

param(

664 666

[Parameter(

665 667

ValueFromPipelineByPropertyName,

@@ -687,6 +689,7 @@ filter Get-GitHubRepository

687 689

[string] $Visibility,

688 690 689 691

[Parameter(ParameterSetName='AuthenticatedUser')]

692 +

[ValidateSet('Owner', 'Collaborator', 'OrganizationMember')]

690 693

[string[]] $Affiliation,

691 694 692 695

[Parameter(ParameterSetName='AuthenticatedUser')]

@@ -736,11 +739,11 @@ filter Get-GitHubRepository

736 739

$description = [String]::Empty

737 740

switch ($PSCmdlet.ParameterSetName)

738 741

{

739 -

{ ('ElementsOrUser', 'Uri') -contains $_ } {

742 +

'ElementsOrUser' {

740 743

# This is a little tricky. Ideally we'd have two separate ParameterSets (Elements, User),

741 744

# however PowerShell would be unable to disambiguate between the two, so unfortunately

742 745

# we need to do some additional work here. And because fallthru doesn't appear to be

743 -

# working right, we're combining both of those, along with Uri.

746 +

# working right, we're combining both of those.

744 747 745 748

if ([String]::IsNullOrWhiteSpace($OwnerName))

746 749

{

@@ -750,37 +753,24 @@ filter Get-GitHubRepository

750 753

}

751 754

elseif ([String]::IsNullOrWhiteSpace($RepositoryName))

752 755

{

753 -

if ($PSCmdlet.ParameterSetName -eq 'ElementsOrUser')

754 -

{

755 -

$telemetryProperties['UsageType'] = 'User'

756 -

$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName

756 +

$telemetryProperties['UsageType'] = 'User'

757 +

$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName

757 758 758 -

$uriFragment = "users/$OwnerName/repos"

759 -

$description = "Getting repos for $OwnerName"

760 -

}

761 -

else

762 -

{

763 -

$message = 'RepositoryName could not be determined.'

764 -

Write-Log -Message $message -Level Error

765 -

throw $message

766 -

}

759 +

$uriFragment = "users/$OwnerName/repos"

760 +

$description = "Getting repos for $OwnerName"

767 761

}

768 762

else

769 763

{

770 -

if ($PSCmdlet.ParameterSetName -eq 'ElementsOrUser')

764 +

if ($PSBoundParameters.ContainsKey('Type') -or

765 +

$PSBoundParameters.ContainsKey('Sort') -or

766 +

$PSBoundParameters.ContainsKey('Direction'))

771 767

{

772 -

$telemetryProperties['UsageType'] = 'Elements'

773 - 774 -

if ($PSBoundParameters.ContainsKey('Type') -or

775 -

$PSBoundParameters.ContainsKey('Sort') -or

776 -

$PSBoundParameters.ContainsKey('Direction'))

777 -

{

778 -

$message = 'Unable to specify -Type, -Sort and/or -Direction when retrieving a specific repository.'

779 -

Write-Log -Message $message -Level Error

780 -

throw $message

781 -

}

768 +

$message = 'Unable to specify -Type, -Sort and/or -Direction when retrieving a specific repository.'

769 +

Write-Log -Message $message -Level Error

770 +

throw $message

782 771

}

783 772 773 +

$telemetryProperties['UsageType'] = 'Elements'

784 774

$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName

785 775

$telemetryProperties['RepositoryName'] = Get-PiiSafeString -PlainText $RepositoryName

786 776

@@ -791,20 +781,30 @@ filter Get-GitHubRepository

791 781

break

792 782

}

793 783 794 -

'Organization' {

795 -

$telemetryProperties['OrganizationName'] = Get-PiiSafeString -PlainText $OrganizationName

784 +

'Uri' {

785 +

if ($PSBoundParameters.ContainsKey('Type') -or

786 +

$PSBoundParameters.ContainsKey('Sort') -or

787 +

$PSBoundParameters.ContainsKey('Direction'))

788 +

{

789 +

$message = 'Unable to specify -Type, -Sort and/or -Direction when retrieving a specific repository.'

790 +

Write-Log -Message $message -Level Error

791 +

throw $message

792 +

}

796 793 797 -

$uriFragment = "orgs/$OrganizationName/repos"

798 -

$description = "Getting repos for $OrganizationName"

794 +

$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName

795 +

$telemetryProperties['RepositoryName'] = Get-PiiSafeString -PlainText $RepositoryName

796 + 797 +

$uriFragment = "repos/$OwnerName/$RepositoryName"

798 +

$description = "Getting $OwnerName/$RepositoryName"

799 799 800 800

break

801 801

}

802 802 803 -

'User' {

804 -

$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName

803 +

'Organization' {

804 +

$telemetryProperties['OrganizationName'] = Get-PiiSafeString -PlainText $OrganizationName

805 805 806 -

$uriFragment = "users/$OwnerName/repos"

807 -

$description = "Getting repos for $OwnerName"

806 +

$uriFragment = "orgs/$OrganizationName/repos"

807 +

$description = "Getting repos for $OrganizationName"

808 808 809 809

break

810 810

}

@@ -857,7 +857,18 @@ filter Get-GitHubRepository

857 857

if ($PSBoundParameters.ContainsKey('Direction')) { $getParams += "direction=$($directionConverter[$Direction])" }

858 858

if ($PSBoundParameters.ContainsKey('Affiliation') -and $Affiliation.Count -gt 0)

859 859

{

860 -

$getParams += "affiliation=$($Affiliation -join ',')"

860 +

$affiliationMap = @{

861 +

Owner = 'owner'

862 +

Collaborator = 'collaborator'

863 +

OrganizationMember = 'organization_member'

864 +

}

865 +

$affiliationParam = @()

866 + 867 +

foreach ($member in $Affiliation)

868 +

{

869 +

$affiliationParam += $affiliationMap[$member]

870 +

}

871 +

$getParams += "affiliation=$($affiliationParam -join ',')"

861 872

}

862 873

if ($PSBoundParameters.ContainsKey('Since')) { $getParams += "since=$Since" }

863 874

@@ -1602,8 +1613,12 @@ filter Get-GitHubRepositoryContributor

1602 1613

.EXAMPLE

1603 1614

Get-GitHubRepositoryContributor -OwnerName microsoft -RepositoryName PowerShellForGitHub

1604 1615 1616 +

Gets a list of contributors for the PowerShellForGithub repository.

1617 + 1605 1618

.EXAMPLE

1606 1619

Get-GitHubRepositoryContributor -Uri 'https://github.com/PowerShell/PowerShellForGitHub' -IncludeStatistics

1620 + 1621 +

Gets a list of contributors for the PowerShellForGithub repository including statistics.

1607 1622

#>

1608 1623

[CmdletBinding(

1609 1624

SupportsShouldProcess,

@@ -1691,10 +1706,10 @@ filter Get-GitHubRepositoryCollaborator

1691 1706

{

1692 1707

<#

1693 1708

.SYNOPSIS

1694 -

Retrieve list of contributors for a given repository.

1709 +

Retrieve list of collaborators for a given repository.

1695 1710 1696 1711

.DESCRIPTION

1697 -

Retrieve list of contributors for a given repository.

1712 +

Retrieve list of collaborators for a given repository.

1698 1713 1699 1714

The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub

1700 1715

@@ -1749,8 +1764,12 @@ filter Get-GitHubRepositoryCollaborator

1749 1764

.EXAMPLE

1750 1765

Get-GitHubRepositoryCollaborator -OwnerName microsoft -RepositoryName PowerShellForGitHub

1751 1766 1767 +

Gets a list of collaborators for the PowerShellForGithub repository.

1768 + 1752 1769

.EXAMPLE

1753 1770

Get-GitHubRepositoryCollaborator -Uri 'https://github.com/PowerShell/PowerShellForGitHub'

1771 + 1772 +

Gets a list of collaborators for the PowerShellForGithub repository.

1754 1773

#>

1755 1774

[CmdletBinding(

1756 1775

SupportsShouldProcess,

@@ -2027,10 +2046,10 @@ filter Move-GitHubRepositoryOwnership

2027 2046

{

2028 2047

<#

2029 2048

.SYNOPSIS

2030 -

Creates a new repository on GitHub.

2049 +

Changes the ownership of a repository on GitHub.

2031 2050 2032 2051

.DESCRIPTION

2033 -

Creates a new repository on GitHub.

2052 +

Changes the ownership of a repository on GitHub.

2034 2053 2035 2054

The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub

2036 2055

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4