public/git/Get-PSTSGitRepositoryItemBatch.ps1
function Get-PSTSGitRepositoryRefItemBatch { param( [Parameter(Mandatory=$true)][string] $project, [Parameter(Mandatory=$true)][string] $repository, [Parameter(Mandatory=$true)][string] $branch, [Parameter(Mandatory=$true)][string] $folderPath ) process { $id=Get-PSTSGitRepository -project $project | Where-Object { $_.name -eq $repository } | Select-Object -ExpandProperty id if ($null -eq $id) { throw [exception]::new("repository Id for $repository could not be found") return } $gitItemBatch = [GitItemBatch]::new() $gitItemDescriptor = [gitItemDescriptor]::new() $gitItemDescriptor.path = $folderPath $gitItemDescriptor.version = $branch $gitItemDescriptor.versionType = 0 $gitItemDescriptor.versionOptions = 0 $gitItemDescriptor.recursionLevel = 4 $gitItemBatch.itemDescriptors = @() $gitItemBatch.itemDescriptors += $gitItemDescriptor $content = ` _PSTSAPI ` -resource "git/repositories/$id/itemsBatch" ` -method "POST" ` -project $project ` -contentType "application/json" ` -body $($gitItemBatch | ConvertTo-Json) ` -apiVersion "api-version=5.0-preview.1" ` return [GitItem[]]$content.Value } } |