public/core/Add-PSTSProject.ps1
function Add-PSTSProject { param( [Parameter(Mandatory=$true)][string] $name, [Parameter(Mandatory=$true)][string] $processTemplateId, [Parameter(Mandatory=$false)][string] $description = [string]::Empty, [Parameter(Mandatory=$false)][switch] $Tfvc ) process { $project = [project]::new() $project.name = $name $project.description = $description $versionControl = new-Object -TypeName "PSObject" $versionControl | Add-Member -MemberType NoteProperty "sourceControlType" -Value ( IIf $Tfvc.IsPresent "Tfvc" "Git" ) $project.capabilities.Add("versioncontrol", $versionControl) $processTemplate = new-Object -TypeName "PSObject" $processTemplate | Add-Member -MemberType NoteProperty "templateTypeId" -Value $processTemplateId $project.capabilities.Add("processTemplate", $processTemplate) $content = ` _PSTSAPI ` -resource "Projects" ` -method "POST" ` -body ($project | ConvertTo-Json -Depth 100) return [Project]$content } } |