Skip to content

Commit ba845e4

Browse files
committed
fix: fixed output
1 parent d0cd775 commit ba845e4

4 files changed

Lines changed: 52 additions & 28 deletions

File tree

AzureDevOpsPowerShell/Public/Api/Core/Projects/Get-AzDoProjectProperties.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,17 @@ https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/get-projec
5757
}
5858

5959
if ($PSCmdlet.ShouldProcess($CollectionUri, "Get project $ProjectName properties")) {
60-
$result = Invoke-AzDoRestMethod @params
60+
$result = (Invoke-AzDoRestMethod @params).value
6161
} else {
6262
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
6363
}
6464

6565
if ($result) {
66-
$HashTable = @{
66+
[PSCustomObject]@{
6767
CollectionURI = $CollectionUri
6868
ProjectName = $ProjectName
69+
Properties = $result
6970
}
70-
foreach ($property in $result.value) {
71-
$HashTable[$property.Name] = $property.Value
72-
}
73-
[PSCustomObject]$HashTable
7471
}
7572
}
7673
}

AzureDevOpsPowerShell/Public/Api/Git/PolicyConfigurations/Get-AzDoPipelineBranchControl.ps1

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,34 +93,33 @@ https://learn.microsoft.com/en-us/rest/api/azure/devops/git/policy-configuration
9393

9494
$params = @{
9595
Uri = "$CollectionUri/$ProjectId/_apis/git/policy/configurations"
96-
Version = "5.0-preview.1"
96+
Version = "7.1"
9797
Method = 'GET'
9898
}
9999
if (-not([string]::IsNullOrEmpty(($queryString)))) {
100100
$params.QueryParameters = $queryString
101101
}
102102
if ($PSCmdlet.ShouldProcess($CollectionUri, "Get branch policies for project $ProjectName")) {
103-
$response = Invoke-AzDoRestMethod @params
103+
$result = (Invoke-AzDoRestMethod @params).value
104104
} else {
105105
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params | ConvertTo-Json -Depth 10)"
106106
}
107-
if ($response) {
108-
$List = [System.Collections.Generic.List[Object]]::new()
109-
foreach ($property in $response.Value) {
110-
$Property | Add-Member -MemberType NoteProperty -Name "ProjectName" -Value $ProjectName
111-
$Property | Add-Member -MemberType NoteProperty -Name "CollectionURI" -Value $CollectionUri
112-
if ($RepositoryId) {
113-
$Property | Add-Member -MemberType NoteProperty -Name "RepositoryId" -Value $RepositoryId
107+
if ($result) {
108+
109+
$result | ForEach-Object {
110+
[PSCustomObject]@{
111+
CollectionUri = $CollectionUri
112+
ProjectName = $ProjectName
113+
IsEnabled = $_.isEnabled
114+
IsBlocking = $_.isBlocking
115+
Settings = $_.settings
116+
PolicyId = $_.id
117+
PolicyUrl = $_.url
118+
PolicyType = $_.PolicyTypeRef
119+
CreatedBy = $_.createdBy
120+
CreatedDate = $_.createdDate
114121
}
115-
if ($RefName) {
116-
$Property | Add-Member -MemberType NoteProperty -Name "RefName" -Value $RefName
117-
}
118-
if ($PolicyType) {
119-
$Property | Add-Member -MemberType NoteProperty -Name "PolicyType" -Value $PolicyType
120-
}
121-
$List.Add($Property)
122122
}
123-
$List
124123
}
125124
}
126125
}

AzureDevOpsPowerShell/Public/Api/Git/PullRequests/Get-AzDoPullRequest.ps1

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,24 @@ function Get-AzDoPullRequest {
157157
if ($result) {
158158
$result | ForEach-Object {
159159
[PSCustomObject]@{
160-
CollectionUri = $CollectionUri
161-
ProjectName = $ProjectName
162-
RepoName = $RepoName
163-
PullRequest = $PSItem
160+
CollectionUri = $CollectionUri
161+
ProjectName = $ProjectName
162+
RepoName = $RepoName
163+
PullRequestTitle = $_.Title
164+
PullRequestDescription = $_.Description
165+
CreatedDate = $_.CreatedDate
166+
PullRequestStatus = $_.Status
167+
SourceRefName = $_.sourceRefName
168+
TargetRefName = $_.targetRefName
169+
Reviewers = $_.reviewers | ForEach-Object {
170+
[PSCustomObject]@{
171+
Id = $_.id
172+
Name = $_.name
173+
Vote = $_.vote
174+
IsRequired = $_.isRequired
175+
}
176+
}
177+
PullRequestUrl = $_.url
164178
}
165179
}
166180
}

AzureDevOpsPowerShell/Public/Api/Git/PullRequests/Set-AzDoPullRequest.ps1

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,21 @@ function Set-AzDoPullRequest {
195195
CollectionUri = $CollectionUri
196196
ProjectName = $ProjectName
197197
RepoName = $RepoName
198-
PullRequest = $PSItem
198+
PullRequestTitle = $_.Title
199+
PullRequestDescription = $_.Description
200+
CreatedDate = $_.CreatedDate
201+
PullRequestStatus = $_.Status
202+
SourceRefName = $_.sourceRefName
203+
TargetRefName = $_.targetRefName
204+
Reviewers = $_.reviewers | ForEach-Object {
205+
[PSCustomObject]@{
206+
Id = $_.id
207+
Name = $_.name
208+
Vote = $_.vote
209+
IsRequired = $_.isRequired
210+
}
211+
}
212+
PullRequestUrl = $_.url
199213
}
200214
}
201215
}

0 commit comments

Comments
 (0)