public/build/Add-PSTSBuildDefinition.ps1
function Add-PSTSBuildDefinition { [CmdletBinding()] param( [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string] $project, [Parameter(ParameterSetName="set1", Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string] $inFile, [Parameter(ParameterSetName="set2", Mandatory = $true, ValueFromPipelineByPropertyName = $true)][object] $buildDefinition ) process { $content = $null if ($PSCmdlet.ParameterSetName -eq "set1" ) { $content = ` _PSTSAPI ` -project $project ` -resource "Build/Definitions" ` -method "POST" ` -inFile $inFile ` -contentType "application/json" ` -apiVersion "api-version=5.0" } else { $content = _PSTSAPI ` -project $project ` -resource "Build/Definitions" ` -method "POST" ` -contentType "application/json" ` -body (ConvertTo-Json $buildDefinition -Depth 100)` -apiVersion "api-version=5.0" } return [BuildDefinition]$content } } |