public/release/Add-PSTSReleaseDefinition.ps1
function Add-PSTSReleaseDefinition { [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] $releaseDefinition ) process { $content = $null if ($PSCmdlet.ParameterSetName -eq "set1" ) { $content = ` _PSTSAPI ` -subDomain "vsrm" ` -project $project ` -resource "Release/Definitions" ` -method "POST" ` -inFile $inFile ` -contentType "application/json" ` -apiVersion "api-version=5.1" } else { $content = _PSTSAPI ` -subDomain "vsrm" ` -project $project ` -resource "Release/Definitions" ` -method "POST" ` -contentType "application/json" ` -body (ConvertTo-Json $releaseDefinition -Depth 100)` -apiVersion "api-version=5.1" } return [ReleaseDefinition]$content } } |