functions/Set-BBCourseProperty.ps1
function Set-BBCourseProperty { <# .SYNOPSIS Given a course determined by ID update the provided properties. This method is a work in progress, be sure to use the -whatif param liberally. So far it only supports updating those items that are explicitally put in params. .DESCRIPTION Given a course determined by ID update the provided properties. This method is a work in progress, be sure to use the -whatif param liberally. So far it only supports updating those items that are explicitally put in params. .EXAMPLE Set-CourseProperty -CourseID '' -whatif #> [CmdletBinding(SupportsShouldProcess)] [Alias()] Param ( [Parameter(ValueFromPipelineByPropertyName)] [string]$Id, [Parameter(ValueFromPipelineByPropertyName)] [string]$uuid, [Parameter(ValueFromPipelineByPropertyName)] [string]$externalId, [Parameter(ValueFromPipelineByPropertyName)] [string]$dataSourceId, [Parameter(ValueFromPipelineByPropertyName)] [string]$courseId, [Parameter(ValueFromPipelineByPropertyName)] [string]$Name, [Parameter(ValueFromPipelineByPropertyName)] [string]$Description, [Parameter(ValueFromPipelineByPropertyName)] [string]$Created, [Parameter(ValueFromPipelineByPropertyName)] [string]$Modified, [Parameter(ValueFromPipelineByPropertyName)] [bool]$Organization, [Parameter(ValueFromPipelineByPropertyName)] [string]$UltraStatus, [Parameter(ValueFromPipelineByPropertyName)] [bool]$AllowGuests, [Parameter(ValueFromPipelineByPropertyName)] [bool]$ClosedComplete, [Parameter(ValueFromPipelineByPropertyName)] [string]$termId, [Parameter(ValueFromPipelineByPropertyName)] $Availability, [Parameter(ValueFromPipelineByPropertyName)] $Enrollment, [Parameter(ValueFromPipelineByPropertyName)] $Local, [Parameter(ValueFromPipelineByPropertyName)] [bool]$hastChildern, [Parameter(ValueFromPipelineByPropertyName)] [string]$ParentId, [Parameter(ValueFromPipelineByPropertyName)] [string]$externalAccessUrl, [Parameter(ValueFromPipelineByPropertyName)] [string]$guestAccessUrl, [string]$Environment = 'Production' ) Begin { } Process { $Body = @{} if($externalId){$Body.Add('externalId', $externalId)} if($dataSourceId){$Body.Add('dataSourceId', $dataSourceId)} if($Name){$Body.Add('name', $Name)} if($Description){$Body.Add('description', $Description)} if($AllowGuests){$Body.Add('allowGuests', $AllowGuests)} if($ClosedComplete){$Body.Add('closedComplete', $ClosedComplete)} if($termId){$Body.Add('termId', $termId)} if($Availability){$Body.Add('availability', $Availability)} if($Enrollment){$Body.Add('enrollment', $enrollment)} if($Local){$Body.Add('local', $Local)} if($(!$Id -eq "")){ Invoke-BBRestMethod -API "/learn/api/public/v3/courses/$id" ` -Method Patch ` -ContentType application/json ` -Body $Body ` -Environment $Environment } } End { } } |