Generated.ps1
#Requires -Version 3.0 Set-StrictMode -Version 2 <# This code was generated by a tool Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. #> function Get-CommunityAbuseAppeal { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByAppealId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$AppealId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$AbuseId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentAuthorId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AppealState, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('AppealId')) { $restParams['AppealId'] = $AppealId } if($PSBoundParameters.ContainsKey('AbuseId')) { $restParams['AbuseId'] = $AbuseId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentAuthorId')) { $restParams['ContentAuthorId'] = $ContentAuthorId } if($PSBoundParameters.ContainsKey('AppealState')) { $restParams['AppealState'] = $AppealState } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ShowByAppealId' { $endpoint= "api.ashx/v2/abuseappeals/${appealid}.json" $method = 'GET' $pageable = $False $restParams.Remove('appealid') } 'List1' { $endpoint= "api.ashx/v2/abuseappeals.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityAbuseAppeal { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByAppealIdAppealState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$AppealId, [Parameter(ParameterSetName='UpdateByAppealIdAppealState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$AppealState, [Parameter(ParameterSetName='UpdateByAppealIdAppealState', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AuthorResponse, [Parameter(ParameterSetName='UpdateByAppealIdAppealState', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$BoardResponse, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('AppealId')) { $restParams['AppealId'] = $AppealId } if($PSBoundParameters.ContainsKey('AppealState')) { $restParams['AppealState'] = $AppealState } if($PSBoundParameters.ContainsKey('AuthorResponse')) { $restParams['AuthorResponse'] = $AuthorResponse } if($PSBoundParameters.ContainsKey('BoardResponse')) { $restParams['BoardResponse'] = $BoardResponse } switch($PSCmdlet.ParameterSetName){ 'UpdateByAppealIdAppealState' { $endpoint= "api.ashx/v2/abuseappeals/${appealid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('appealid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityAbuseReport { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByContentIdContentTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='CreateByContentIdContentTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='CreateByContentIdContentTypeId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$AbuseReasonId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('AbuseReasonId')) { $restParams['AbuseReasonId'] = $AbuseReasonId } switch($PSCmdlet.ParameterSetName){ 'CreateByContentIdContentTypeId' { $endpoint= "api.ashx/v2/abusereports.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityAbuseReport { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByAbuseReportId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$AbuseReportId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$AuthorUserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ReportingUserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$AbusiveContentId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$EndDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AppealState, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$AppealId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$AssignedToAppeal, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('AbuseReportId')) { $restParams['AbuseReportId'] = $AbuseReportId } if($PSBoundParameters.ContainsKey('AuthorUserId')) { $restParams['AuthorUserId'] = $AuthorUserId } if($PSBoundParameters.ContainsKey('ReportingUserId')) { $restParams['ReportingUserId'] = $ReportingUserId } if($PSBoundParameters.ContainsKey('AbusiveContentId')) { $restParams['AbusiveContentId'] = $AbusiveContentId } if($PSBoundParameters.ContainsKey('StartDate')) { $restParams['StartDate'] = $StartDate } if($PSBoundParameters.ContainsKey('EndDate')) { $restParams['EndDate'] = $EndDate } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('AppealState')) { $restParams['AppealState'] = $AppealState } if($PSBoundParameters.ContainsKey('AppealId')) { $restParams['AppealId'] = $AppealId } if($PSBoundParameters.ContainsKey('AssignedToAppeal')) { $restParams['AssignedToAppeal'] = $AssignedToAppeal } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ShowByAbuseReportId' { $endpoint= "api.ashx/v2/abusereports/${abusereportid}.json" $method = 'GET' $pageable = $False $restParams.Remove('abusereportid') } 'List1' { $endpoint= "api.ashx/v2/abusereports.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityAbuseReport { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByAbuseReportId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$AbuseReportId, [Parameter(ParameterSetName='UpdateByAbuseReportId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$AbuseReasonId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('AbuseReportId')) { $restParams['AbuseReportId'] = $AbuseReportId } if($PSBoundParameters.ContainsKey('AbuseReasonId')) { $restParams['AbuseReasonId'] = $AbuseReasonId } switch($PSCmdlet.ParameterSetName){ 'UpdateByAbuseReportId' { $endpoint= "api.ashx/v2/abusereports/${abusereportid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('abusereportid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityAbusiveContent { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$AuthorUserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartCreateDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$EndCreateDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartReportDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$EndReportDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AbuseState, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AppealState, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('AuthorUserId')) { $restParams['AuthorUserId'] = $AuthorUserId } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('StartCreateDate')) { $restParams['StartCreateDate'] = $StartCreateDate } if($PSBoundParameters.ContainsKey('EndCreateDate')) { $restParams['EndCreateDate'] = $EndCreateDate } if($PSBoundParameters.ContainsKey('StartReportDate')) { $restParams['StartReportDate'] = $StartReportDate } if($PSBoundParameters.ContainsKey('EndReportDate')) { $restParams['EndReportDate'] = $EndReportDate } if($PSBoundParameters.ContainsKey('AbuseState')) { $restParams['AbuseState'] = $AbuseState } if($PSBoundParameters.ContainsKey('AppealState')) { $restParams['AppealState'] = $AppealState } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/abusivecontent.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityActivityMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Include, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$BeforeDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$AfterDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeStatus, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$IncludeActivityTypes, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$ExcludeActivityTypes, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('Include')) { $restParams['Include'] = $Include } if($PSBoundParameters.ContainsKey('StartDate')) { $restParams['StartDate'] = $StartDate } if($PSBoundParameters.ContainsKey('BeforeDate')) { $restParams['BeforeDate'] = $BeforeDate } if($PSBoundParameters.ContainsKey('AfterDate')) { $restParams['AfterDate'] = $AfterDate } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('IncludeStatus')) { $restParams['IncludeStatus'] = $IncludeStatus } if($PSBoundParameters.ContainsKey('IncludeActivityTypes')) { $restParams['IncludeActivityTypes'] = $IncludeActivityTypes } if($PSBoundParameters.ContainsKey('ExcludeActivityTypes')) { $restParams['ExcludeActivityTypes'] = $ExcludeActivityTypes } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/activities.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityActivityStorySitePreference { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Preferences, [Parameter(ParameterSetName='ShowByStoryTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$StoryTypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Preferences')) { $restParams['Preferences'] = $Preferences } if($PSBoundParameters.ContainsKey('StoryTypeId')) { $restParams['StoryTypeId'] = $StoryTypeId } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/activitystorysitepreferences.json" $method = 'GET' $pageable = $False } 'ShowByStoryTypeId' { $endpoint= "api.ashx/v2/activitystorysitepreference/${storytypeid}.json" $method = 'GET' $pageable = $False $restParams.Remove('storytypeid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityActivityStorySitePreference { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByStoryTypeIdLoggingPreference', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$StoryTypeId, [Parameter(ParameterSetName='UpdateByStoryTypeIdLoggingPreference', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$LoggingPreference, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('StoryTypeId')) { $restParams['StoryTypeId'] = $StoryTypeId } if($PSBoundParameters.ContainsKey('LoggingPreference')) { $restParams['LoggingPreference'] = $LoggingPreference } switch($PSCmdlet.ParameterSetName){ 'UpdateByStoryTypeIdLoggingPreference' { $endpoint= "api.ashx/v2/activitystorysitepreference/${storytypeid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('storytypeid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityActivityStoryType { [CmdletBinding(SupportsShouldProcess = $true)] param( [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/activitystorytypes.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityActivityStoryUserPreference { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByStoryTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$StoryTypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('StoryTypeId')) { $restParams['StoryTypeId'] = $StoryTypeId } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/activitystoryuserpreferences.json" $method = 'GET' $pageable = $False } 'ShowByStoryTypeId' { $endpoint= "api.ashx/v2/activitystoryuserpreference/${storytypeid}.json" $method = 'GET' $pageable = $False $restParams.Remove('storytypeid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityActivityStoryUserPreference { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByStoryTypeIdIsLoggingEnabled', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$StoryTypeId, [Parameter(ParameterSetName='UpdateByStoryTypeIdIsLoggingEnabled', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsLoggingEnabled, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('StoryTypeId')) { $restParams['StoryTypeId'] = $StoryTypeId } if($PSBoundParameters.ContainsKey('IsLoggingEnabled')) { $restParams['IsLoggingEnabled'] = $IsLoggingEnabled } switch($PSCmdlet.ParameterSetName){ 'UpdateByStoryTypeIdIsLoggingEnabled' { $endpoint= "api.ashx/v2/activitystoryuserpreference/${storytypeid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('storytypeid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityAggregateTaggedContent { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ContainerIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ApplicationIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ApplicationTypeIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ContentTypeIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$ContentCreatedAfterDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$ContentCreatedBeforeDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$LogicallyOrTags, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContainerIds')) { $restParams['ContainerIds'] = $ContainerIds } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationIds')) { $restParams['ApplicationIds'] = $ApplicationIds } if($PSBoundParameters.ContainsKey('ApplicationTypeIds')) { $restParams['ApplicationTypeIds'] = $ApplicationTypeIds } if($PSBoundParameters.ContainsKey('ContentTypeIds')) { $restParams['ContentTypeIds'] = $ContentTypeIds } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('ContentCreatedAfterDate')) { $restParams['ContentCreatedAfterDate'] = $ContentCreatedAfterDate } if($PSBoundParameters.ContainsKey('ContentCreatedBeforeDate')) { $restParams['ContentCreatedBeforeDate'] = $ContentCreatedBeforeDate } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('LogicallyOrTags')) { $restParams['LogicallyOrTags'] = $LogicallyOrTags } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/aggregatetaggedcontent.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityAggregateTag { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByTagName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='DeleteByTagName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationTypeId, [Parameter(ParameterSetName='DeleteByTagName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='DeleteByTagName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$TagName, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ApplicationTypeId')) { $restParams['ApplicationTypeId'] = $ApplicationTypeId } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('TagName')) { $restParams['TagName'] = $TagName } switch($PSCmdlet.ParameterSetName){ 'DeleteByTagName' { $endpoint= "api.ashx/v2/aggregatetags.json" $method = 'DELETE' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityAggregateTag { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$TagNameFilter, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$LogicallyOrTags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$MinimumContentCount, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ApplicationTypeId')) { $restParams['ApplicationTypeId'] = $ApplicationTypeId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('TagNameFilter')) { $restParams['TagNameFilter'] = $TagNameFilter } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('LogicallyOrTags')) { $restParams['LogicallyOrTags'] = $LogicallyOrTags } if($PSBoundParameters.ContainsKey('MinimumContentCount')) { $restParams['MinimumContentCount'] = $MinimumContentCount } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/aggregatetags.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityBlogContactRequest { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByBlogIdContactRequestId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='ListByBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsModerated, [Parameter(ParameterSetName='ListByBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByBlogIdContactRequestId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ContactRequestId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('IsModerated')) { $restParams['IsModerated'] = $IsModerated } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('ContactRequestId')) { $restParams['ContactRequestId'] = $ContactRequestId } switch($PSCmdlet.ParameterSetName){ 'ListByBlogId' { $endpoint= "api.ashx/v2/blogs/${blogid}/contactrequests.json" $method = 'GET' $pageable = $True $restParams.Remove('blogid') } 'ShowByBlogIdContactRequestId' { $endpoint= "api.ashx/v2/blogs/${blogid}/contactrequests/${contactrequestid}.json" $method = 'GET' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('contactrequestid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityBlogContactRequest { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByBlogIdSubjectBodyNameEmailAddressIPAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='CreateByBlogIdSubjectBodyNameEmailAddressIPAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Subject, [Parameter(ParameterSetName='CreateByBlogIdSubjectBodyNameEmailAddressIPAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByBlogIdSubjectBodyNameEmailAddressIPAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByBlogIdSubjectBodyNameEmailAddressIPAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$EmailAddress, [Parameter(ParameterSetName='CreateByBlogIdSubjectBodyNameEmailAddressIPAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$IPAddress, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('Subject')) { $restParams['Subject'] = $Subject } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('EmailAddress')) { $restParams['EmailAddress'] = $EmailAddress } if($PSBoundParameters.ContainsKey('IPAddress')) { $restParams['IPAddress'] = $IPAddress } switch($PSCmdlet.ParameterSetName){ 'CreateByBlogIdSubjectBodyNameEmailAddressIPAddress' { $endpoint= "api.ashx/v2/blogs/${blogid}/contactrequests.json" $method = 'POST' $pageable = $False $restParams.Remove('blogid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityBlogPost { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByIdBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByBlogIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByIdBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByBlogIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='ShowByBlogIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='ShowByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByBlogIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$AuthorId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int[]]$BlogIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeUnpublished, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$LogicallyOrTags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$DateFilter, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DateFilterType, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } if($PSBoundParameters.ContainsKey('AuthorId')) { $restParams['AuthorId'] = $AuthorId } if($PSBoundParameters.ContainsKey('BlogIds')) { $restParams['BlogIds'] = $BlogIds } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('IncludeUnpublished')) { $restParams['IncludeUnpublished'] = $IncludeUnpublished } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('LogicallyOrTags')) { $restParams['LogicallyOrTags'] = $LogicallyOrTags } if($PSBoundParameters.ContainsKey('DateFilter')) { $restParams['DateFilter'] = $DateFilter } if($PSBoundParameters.ContainsKey('DateFilterType')) { $restParams['DateFilterType'] = $DateFilterType } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ShowByIdBlogId' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('id') } 'ShowByBlogIdName' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${name}.json" $method = 'GET' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('name') } 'ShowByIdBlogId' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${id}/${filename}" $method = 'GET' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('id') $restParams.Remove('filename') } 'ShowByBlogIdName' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${name}/${filename}" $method = 'GET' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('name') $restParams.Remove('filename') } 'List1' { $endpoint= "api.ashx/v2/blogs/posts.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityBlogPost { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Title, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Slug, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Excerpt, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ExcerptSize, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$UsePostSummary, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$GeneratePostSummary, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PublishedDate, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApproved, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsCrossPostingEnabled, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostImageUrl, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostImageFileName, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$PostImageFileData, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostImageFileUploadContext, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphTitle, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphDescription, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageContext, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageFileName, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaTitle, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaKeywords, [Parameter(ParameterSetName='CreateByBlogIdTitleBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaDescription, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('Title')) { $restParams['Title'] = $Title } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('Slug')) { $restParams['Slug'] = $Slug } if($PSBoundParameters.ContainsKey('Excerpt')) { $restParams['Excerpt'] = $Excerpt } if($PSBoundParameters.ContainsKey('ExcerptSize')) { $restParams['ExcerptSize'] = $ExcerptSize } if($PSBoundParameters.ContainsKey('UsePostSummary')) { $restParams['UsePostSummary'] = $UsePostSummary } if($PSBoundParameters.ContainsKey('GeneratePostSummary')) { $restParams['GeneratePostSummary'] = $GeneratePostSummary } if($PSBoundParameters.ContainsKey('PublishedDate')) { $restParams['PublishedDate'] = $PublishedDate } if($PSBoundParameters.ContainsKey('IsApproved')) { $restParams['IsApproved'] = $IsApproved } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('IsCrossPostingEnabled')) { $restParams['IsCrossPostingEnabled'] = $IsCrossPostingEnabled } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('PostImageUrl')) { $restParams['PostImageUrl'] = $PostImageUrl } if($PSBoundParameters.ContainsKey('PostImageFileName')) { $restParams['PostImageFileName'] = $PostImageFileName } if($PSBoundParameters.ContainsKey('PostImageFileData')) { $restParams['PostImageFileData'] = $PostImageFileData } if($PSBoundParameters.ContainsKey('PostImageFileUploadContext')) { $restParams['PostImageFileUploadContext'] = $PostImageFileUploadContext } if($PSBoundParameters.ContainsKey('OpenGraphTitle')) { $restParams['OpenGraphTitle'] = $OpenGraphTitle } if($PSBoundParameters.ContainsKey('OpenGraphDescription')) { $restParams['OpenGraphDescription'] = $OpenGraphDescription } if($PSBoundParameters.ContainsKey('OpenGraphImageContext')) { $restParams['OpenGraphImageContext'] = $OpenGraphImageContext } if($PSBoundParameters.ContainsKey('OpenGraphImageFileName')) { $restParams['OpenGraphImageFileName'] = $OpenGraphImageFileName } if($PSBoundParameters.ContainsKey('MetaTitle')) { $restParams['MetaTitle'] = $MetaTitle } if($PSBoundParameters.ContainsKey('MetaKeywords')) { $restParams['MetaKeywords'] = $MetaKeywords } if($PSBoundParameters.ContainsKey('MetaDescription')) { $restParams['MetaDescription'] = $MetaDescription } switch($PSCmdlet.ParameterSetName){ 'CreateByBlogIdTitleBody' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts.json" $method = 'POST' $pageable = $False $restParams.Remove('blogid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityBlogPost { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Title, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Slug, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Excerpt, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ExcerptSize, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$UsePostSummary, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$GeneratePostSummary, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PublishedDate, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApproved, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsCrossPostingEnabled, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$RemoveAttachment, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostImageUrl, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostImageFileName, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$PostImageFileData, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostImageFileUploadContext, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$RemovePostImage, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphTitle, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphDescription, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageContext, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageFileName, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$RemoveOpenGraphImage, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaTitle, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaKeywords, [Parameter(ParameterSetName='UpdateByIdBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaDescription, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('Title')) { $restParams['Title'] = $Title } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('Slug')) { $restParams['Slug'] = $Slug } if($PSBoundParameters.ContainsKey('Excerpt')) { $restParams['Excerpt'] = $Excerpt } if($PSBoundParameters.ContainsKey('ExcerptSize')) { $restParams['ExcerptSize'] = $ExcerptSize } if($PSBoundParameters.ContainsKey('UsePostSummary')) { $restParams['UsePostSummary'] = $UsePostSummary } if($PSBoundParameters.ContainsKey('GeneratePostSummary')) { $restParams['GeneratePostSummary'] = $GeneratePostSummary } if($PSBoundParameters.ContainsKey('PublishedDate')) { $restParams['PublishedDate'] = $PublishedDate } if($PSBoundParameters.ContainsKey('IsApproved')) { $restParams['IsApproved'] = $IsApproved } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('IsCrossPostingEnabled')) { $restParams['IsCrossPostingEnabled'] = $IsCrossPostingEnabled } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('RemoveAttachment')) { $restParams['RemoveAttachment'] = $RemoveAttachment } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('PostImageUrl')) { $restParams['PostImageUrl'] = $PostImageUrl } if($PSBoundParameters.ContainsKey('PostImageFileName')) { $restParams['PostImageFileName'] = $PostImageFileName } if($PSBoundParameters.ContainsKey('PostImageFileData')) { $restParams['PostImageFileData'] = $PostImageFileData } if($PSBoundParameters.ContainsKey('PostImageFileUploadContext')) { $restParams['PostImageFileUploadContext'] = $PostImageFileUploadContext } if($PSBoundParameters.ContainsKey('RemovePostImage')) { $restParams['RemovePostImage'] = $RemovePostImage } if($PSBoundParameters.ContainsKey('OpenGraphTitle')) { $restParams['OpenGraphTitle'] = $OpenGraphTitle } if($PSBoundParameters.ContainsKey('OpenGraphDescription')) { $restParams['OpenGraphDescription'] = $OpenGraphDescription } if($PSBoundParameters.ContainsKey('OpenGraphImageContext')) { $restParams['OpenGraphImageContext'] = $OpenGraphImageContext } if($PSBoundParameters.ContainsKey('OpenGraphImageFileName')) { $restParams['OpenGraphImageFileName'] = $OpenGraphImageFileName } if($PSBoundParameters.ContainsKey('RemoveOpenGraphImage')) { $restParams['RemoveOpenGraphImage'] = $RemoveOpenGraphImage } if($PSBoundParameters.ContainsKey('MetaTitle')) { $restParams['MetaTitle'] = $MetaTitle } if($PSBoundParameters.ContainsKey('MetaKeywords')) { $restParams['MetaKeywords'] = $MetaKeywords } if($PSBoundParameters.ContainsKey('MetaDescription')) { $restParams['MetaDescription'] = $MetaDescription } switch($PSCmdlet.ParameterSetName){ 'UpdateByIdBlogId' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityBlogPost { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByIdBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='DeleteByIdBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } switch($PSCmdlet.ParameterSetName){ 'DeleteByIdBlogId' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityBlogPostSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByBlogIdBlogPostId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='ShowByBlogIdBlogPostId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogPostId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('BlogPostId')) { $restParams['BlogPostId'] = $BlogPostId } switch($PSCmdlet.ParameterSetName){ 'ShowByBlogIdBlogPostId' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${blogpostid}/subscriptions.json" $method = 'GET' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('blogpostid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityBlogPostSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByBlogIdBlogPostIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='UpdateByBlogIdBlogPostIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogPostId, [Parameter(ParameterSetName='UpdateByBlogIdBlogPostIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsSubscribed, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('BlogPostId')) { $restParams['BlogPostId'] = $BlogPostId } if($PSBoundParameters.ContainsKey('IsSubscribed')) { $restParams['IsSubscribed'] = $IsSubscribed } switch($PSCmdlet.ParameterSetName){ 'UpdateByBlogIdBlogPostIdIsSubscribed' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${blogpostid}/subscriptions.json" $method = 'PUT' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('blogpostid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityBlogPostSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByBlogIdBlogPostId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='CreateByBlogIdBlogPostId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogPostId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('BlogPostId')) { $restParams['BlogPostId'] = $BlogPostId } switch($PSCmdlet.ParameterSetName){ 'CreateByBlogIdBlogPostId' { $endpoint= "api.ashx/v2/blogs/${blogid}/posts/${blogpostid}/subscriptions.json" $method = 'POST' $pageable = $False $restParams.Remove('blogid') $restParams.Remove('blogpostid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityBlogPostSummary { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByBlogId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$BlogId, [Parameter(ParameterSetName='ListByBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$Month, [Parameter(ParameterSetName='ListByBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByBlogId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('BlogId')) { $restParams['BlogId'] = $BlogId } if($PSBoundParameters.ContainsKey('Month')) { $restParams['Month'] = $Month } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ListByBlogId' { $endpoint= "api.ashx/v2/blogs/${blogid}/postsummaries.json" $method = 'GET' $pageable = $True $restParams.Remove('blogid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityBlog { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ApplicationIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$OwnerUserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('ApplicationIds')) { $restParams['ApplicationIds'] = $ApplicationIds } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('OwnerUserId')) { $restParams['OwnerUserId'] = $OwnerUserId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/blogs.json" $method = 'GET' $pageable = $True } 'ShowById' { $endpoint= "api.ashx/v2/blogs/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } 'ShowByApplicationId' { $endpoint= "api.ashx/v2/blogs/${applicationId}.json" $method = 'GET' $pageable = $False $restParams.Remove('applicationId') } 'ShowByKeyGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/blogs/${key}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('key') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityBlog { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Authors, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DefaultPostImageUrl, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } if($PSBoundParameters.ContainsKey('Authors')) { $restParams['Authors'] = $Authors } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('DefaultPostImageUrl')) { $restParams['DefaultPostImageUrl'] = $DefaultPostImageUrl } switch($PSCmdlet.ParameterSetName){ 'CreateByGroupIdName' { $endpoint= "api.ashx/v2/blogs.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityBlog { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Authors, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DefaultPostImageUrl, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } if($PSBoundParameters.ContainsKey('Authors')) { $restParams['Authors'] = $Authors } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('DefaultPostImageUrl')) { $restParams['DefaultPostImageUrl'] = $DefaultPostImageUrl } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/blogs/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityBlog { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/blogs/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityBookmark { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Create1' { $endpoint= "api.ashx/v2/bookmark.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityBookmark { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ContentTypeIds, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentTypeIds')) { $restParams['ContentTypeIds'] = $ContentTypeIds } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'Show1' { $endpoint= "api.ashx/v2/bookmark.json" $method = 'GET' $pageable = $False } 'List2' { $endpoint= "api.ashx/v2/bookmarks.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityBookmark { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Delete1' { $endpoint= "api.ashx/v2/bookmark.json" $method = 'DELETE' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityCf { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByFileStoreFilePathFilename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$FileStore, [Parameter(ParameterSetName='ShowByFileStoreFilePathFilename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$FilePath, [Parameter(ParameterSetName='ShowByFileStoreFilePathFilename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Filename, [Parameter(ParameterSetName='ShowByFileStoreFilePathFilename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Width, [Parameter(ParameterSetName='ShowByFileStoreFilePathFilename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Height, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('FileStore')) { $restParams['FileStore'] = $FileStore } if($PSBoundParameters.ContainsKey('FilePath')) { $restParams['FilePath'] = $FilePath } if($PSBoundParameters.ContainsKey('Filename')) { $restParams['Filename'] = $Filename } if($PSBoundParameters.ContainsKey('Width')) { $restParams['Width'] = $Width } if($PSBoundParameters.ContainsKey('Height')) { $restParams['Height'] = $Height } switch($PSCmdlet.ParameterSetName){ 'ShowByFileStoreFilePathFilename' { $endpoint= "api.ashx/v2/cfs/${fileStore}/${filepath}/${filename}" $method = 'GET' $pageable = $False $restParams.Remove('fileStore') $restParams.Remove('filepath') $restParams.Remove('filename') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityComment { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ParentCommentId, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Url, [Parameter(ParameterSetName='CreateByBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$CommentTypeId, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApproved, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='CreateByBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedDate, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('ParentCommentId')) { $restParams['ParentCommentId'] = $ParentCommentId } if($PSBoundParameters.ContainsKey('Url')) { $restParams['Url'] = $Url } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('CommentTypeId')) { $restParams['CommentTypeId'] = $CommentTypeId } if($PSBoundParameters.ContainsKey('IsApproved')) { $restParams['IsApproved'] = $IsApproved } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('CreatedDate')) { $restParams['CreatedDate'] = $CreatedDate } switch($PSCmdlet.ParameterSetName){ 'CreateByBody' { $endpoint= "api.ashx/v2/comments.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityComment { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByCommentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$CommentId, [Parameter(ParameterSetName='ShowByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$CommentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$CommentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApproved, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeChildren, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ParentCommentId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('CommentId')) { $restParams['CommentId'] = $CommentId } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } if($PSBoundParameters.ContainsKey('CommentIds')) { $restParams['CommentIds'] = $CommentIds } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('CommentTypeId')) { $restParams['CommentTypeId'] = $CommentTypeId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('IsApproved')) { $restParams['IsApproved'] = $IsApproved } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('IncludeChildren')) { $restParams['IncludeChildren'] = $IncludeChildren } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('ParentCommentId')) { $restParams['ParentCommentId'] = $ParentCommentId } switch($PSCmdlet.ParameterSetName){ 'ShowByCommentId' { $endpoint= "api.ashx/v2/comments/${commentid}.json" $method = 'GET' $pageable = $False $restParams.Remove('commentid') } 'List1' { $endpoint= "api.ashx/v2/comments.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityComment { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$CommentId, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$CommentTypeId, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedDate, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$SortOrder, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApproved, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='UpdateByCommentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('CommentId')) { $restParams['CommentId'] = $CommentId } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('CommentTypeId')) { $restParams['CommentTypeId'] = $CommentTypeId } if($PSBoundParameters.ContainsKey('CreatedDate')) { $restParams['CreatedDate'] = $CreatedDate } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('IsApproved')) { $restParams['IsApproved'] = $IsApproved } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'UpdateByCommentId' { $endpoint= "api.ashx/v2/comments/${commentid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('commentid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityComment { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByCommentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$CommentId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('CommentId')) { $restParams['CommentId'] = $CommentId } switch($PSCmdlet.ParameterSetName){ 'DeleteByCommentId' { $endpoint= "api.ashx/v2/comments/${commentid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('commentid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityContent { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByContentTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } switch($PSCmdlet.ParameterSetName){ 'ShowByContentTypeId' { $endpoint= "api.ashx/v2/content.json" $method = 'GET' $pageable = $False } 'ShowByContentTypeId' { $endpoint= "api.ashx/v2/content/${contenttypeid}/services.json" $method = 'GET' $pageable = $False $restParams.Remove('contenttypeid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityContentTag { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='CreateByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='CreateByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='CreateByTags', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'CreateByTags' { $endpoint= "api.ashx/v2/contenttags.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityContentTag { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/contenttags.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityContentTag { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='DeleteByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='DeleteByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='DeleteByTags', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='DeleteByTags', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'DeleteByTags' { $endpoint= "api.ashx/v2/contenttags.json" $method = 'DELETE' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityContentTag { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Update1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Update1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='Update1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Update1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='Update1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Update1' { $endpoint= "api.ashx/v2/contenttags.json" $method = 'PUT' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityContentView { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByContentIdContentTypeIdViewTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='CreateByContentIdContentTypeIdViewTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='CreateByContentIdContentTypeIdViewTypeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ViewTypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ViewTypeId')) { $restParams['ViewTypeId'] = $ViewTypeId } switch($PSCmdlet.ParameterSetName){ 'CreateByContentIdContentTypeIdViewTypeId' { $endpoint= "api.ashx/v2/contentviews.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityConversationMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByIdBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Id, [Parameter(ParameterSetName='CreateByIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Subject, [Parameter(ParameterSetName='CreateByIdBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('Subject')) { $restParams['Subject'] = $Subject } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } switch($PSCmdlet.ParameterSetName){ 'CreateByIdBody' { $endpoint= "api.ashx/v2/conversations/${id}/messages.json" $method = 'POST' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityConversationMessage { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Id, [Parameter(ParameterSetName='ListById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ListById' { $endpoint= "api.ashx/v2/conversations/${id}/messages.json" $method = 'GET' $pageable = $True $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityConversationMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByConversationIdId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ConversationId, [Parameter(ParameterSetName='DeleteByConversationIdId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ConversationId')) { $restParams['ConversationId'] = $ConversationId } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteByConversationIdId' { $endpoint= "api.ashx/v2/conversations/${conversationid}/messages/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('conversationid') $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityConversation { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/conversations/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityEndpoint { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/info/endpoints.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityFeature { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Application, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Count, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Application')) { $restParams['Application'] = $Application } if($PSBoundParameters.ContainsKey('Count')) { $restParams['Count'] = $Count } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/features.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityFollower { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='ListByUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='ListByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='ListByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ListByUserId' { $endpoint= "api.ashx/v2/users/${userid}/followers.json" $method = 'GET' $pageable = $True $restParams.Remove('userid') } 'ListByUsername' { $endpoint= "api.ashx/v2/users/${username}/followers.json" $method = 'GET' $pageable = $True $restParams.Remove('username') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityFollowing { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByFollowerId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$FollowerId, [Parameter(ParameterSetName='ListByFollowerName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FollowerName, [Parameter(ParameterSetName='ListByFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='ListByFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListByFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('FollowerId')) { $restParams['FollowerId'] = $FollowerId } if($PSBoundParameters.ContainsKey('FollowerName')) { $restParams['FollowerName'] = $FollowerName } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ListByFollowerId' { $endpoint= "api.ashx/v2/users/${followerid}/following.json" $method = 'GET' $pageable = $True $restParams.Remove('followerid') } 'ListByFollowerName' { $endpoint= "api.ashx/v2/users/${followername}/following.json" $method = 'GET' $pageable = $True $restParams.Remove('followername') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityFollowing { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByFollowerIdFollowingId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByFollowerNameFollowingId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$FollowerId, [Parameter(ParameterSetName='CreateByFollowerNameFollowingId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByFollowerIdFollowingId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FollowerName, [Parameter(ParameterSetName='CreateByFollowerIdFollowingId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByFollowerNameFollowingId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$FollowingId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('FollowerId')) { $restParams['FollowerId'] = $FollowerId } if($PSBoundParameters.ContainsKey('FollowerName')) { $restParams['FollowerName'] = $FollowerName } if($PSBoundParameters.ContainsKey('FollowingId')) { $restParams['FollowingId'] = $FollowingId } switch($PSCmdlet.ParameterSetName){ 'CreateByFollowerIdFollowingId' { $endpoint= "api.ashx/v2/users/${followerid}/following.json" $method = 'POST' $pageable = $False $restParams.Remove('followerid') } 'CreateByFollowerNameFollowingId' { $endpoint= "api.ashx/v2/users/${followername}/following.json" $method = 'POST' $pageable = $False $restParams.Remove('followername') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityFollowing { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByFollowingIdFollowerId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByFollowingNameFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$FollowingId, [Parameter(ParameterSetName='DeleteByFollowingNameFollowerName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByFollowingIdFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FollowingName, [Parameter(ParameterSetName='DeleteByFollowingIdFollowerId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByFollowingNameFollowerName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$FollowerId, [Parameter(ParameterSetName='DeleteByFollowingNameFollowerName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByFollowingIdFollowerId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FollowerName, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('FollowingId')) { $restParams['FollowingId'] = $FollowingId } if($PSBoundParameters.ContainsKey('FollowingName')) { $restParams['FollowingName'] = $FollowingName } if($PSBoundParameters.ContainsKey('FollowerId')) { $restParams['FollowerId'] = $FollowerId } if($PSBoundParameters.ContainsKey('FollowerName')) { $restParams['FollowerName'] = $FollowerName } switch($PSCmdlet.ParameterSetName){ 'DeleteByFollowingIdFollowerId' { $endpoint= "api.ashx/v2/users/${followerid}/following/${followingid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('followerid') $restParams.Remove('followingid') } 'DeleteByFollowingNameFollowerName' { $endpoint= "api.ashx/v2/users/${followername}/following/${followingname}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('followername') $restParams.Remove('followingname') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityForumReply { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentReplyId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ForumReplyQueryType, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='ShowByReplyId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ReplyId, [Parameter(ParameterSetName='ShowByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('ParentReplyId')) { $restParams['ParentReplyId'] = $ParentReplyId } if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('ForumReplyQueryType')) { $restParams['ForumReplyQueryType'] = $ForumReplyQueryType } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ReplyId')) { $restParams['ReplyId'] = $ReplyId } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/forums/threads/replies/moderated.json" $method = 'GET' $pageable = $True } 'ShowByReplyId' { $endpoint= "api.ashx/v2/forums/threads/replies/${replyid}.json" $method = 'GET' $pageable = $False $restParams.Remove('replyid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityForumReply { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentReplyId, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PostDate, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsSuggestedAnswer, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsAnswer, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SubscribeToThread, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsAnonymous, [Parameter(ParameterSetName='CreateByThreadIdBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('ParentReplyId')) { $restParams['ParentReplyId'] = $ParentReplyId } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('PostDate')) { $restParams['PostDate'] = $PostDate } if($PSBoundParameters.ContainsKey('IsSuggestedAnswer')) { $restParams['IsSuggestedAnswer'] = $IsSuggestedAnswer } if($PSBoundParameters.ContainsKey('IsAnswer')) { $restParams['IsAnswer'] = $IsAnswer } if($PSBoundParameters.ContainsKey('SubscribeToThread')) { $restParams['SubscribeToThread'] = $SubscribeToThread } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('IsAnonymous')) { $restParams['IsAnonymous'] = $IsAnonymous } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'CreateByThreadIdBody' { $endpoint= "api.ashx/v2/forums/threads/${threadid}/replies.json" $method = 'POST' $pageable = $False $restParams.Remove('threadid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityForumReply { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ReplyId, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentReplyId, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PostDate, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsSuggestedAnswer, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsAnswer, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SubscribeToThread, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$RemoveAttachment, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EditNotes, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsAnonymous, [Parameter(ParameterSetName='UpdateByReplyIdThreadIdForumId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ReplyId')) { $restParams['ReplyId'] = $ReplyId } if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('ParentReplyId')) { $restParams['ParentReplyId'] = $ParentReplyId } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('PostDate')) { $restParams['PostDate'] = $PostDate } if($PSBoundParameters.ContainsKey('IsSuggestedAnswer')) { $restParams['IsSuggestedAnswer'] = $IsSuggestedAnswer } if($PSBoundParameters.ContainsKey('IsAnswer')) { $restParams['IsAnswer'] = $IsAnswer } if($PSBoundParameters.ContainsKey('SubscribeToThread')) { $restParams['SubscribeToThread'] = $SubscribeToThread } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('RemoveAttachment')) { $restParams['RemoveAttachment'] = $RemoveAttachment } if($PSBoundParameters.ContainsKey('EditNotes')) { $restParams['EditNotes'] = $EditNotes } if($PSBoundParameters.ContainsKey('IsAnonymous')) { $restParams['IsAnonymous'] = $IsAnonymous } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'UpdateByReplyIdThreadIdForumId' { $endpoint= "api.ashx/v2/forums/${forumid}/threads/${threadid}/replies/${replyid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('forumid') $restParams.Remove('threadid') $restParams.Remove('replyid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityForumReply { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByReplyId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ReplyId, [Parameter(ParameterSetName='DeleteByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='DeleteByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='DeleteByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$DeleteChildren, [Parameter(ParameterSetName='DeleteByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SendAuthorDeleteNotification, [Parameter(ParameterSetName='DeleteByReplyId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DeleteReason, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ReplyId')) { $restParams['ReplyId'] = $ReplyId } if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('DeleteChildren')) { $restParams['DeleteChildren'] = $DeleteChildren } if($PSBoundParameters.ContainsKey('SendAuthorDeleteNotification')) { $restParams['SendAuthorDeleteNotification'] = $SendAuthorDeleteNotification } if($PSBoundParameters.ContainsKey('DeleteReason')) { $restParams['DeleteReason'] = $DeleteReason } switch($PSCmdlet.ParameterSetName){ 'DeleteByReplyId' { $endpoint= "api.ashx/v2/forums/threads/replies/${replyid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('replyid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityForum { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ApplicationIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('ApplicationIds')) { $restParams['ApplicationIds'] = $ApplicationIds } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/forums.json" $method = 'GET' $pageable = $True } 'ShowById' { $endpoint= "api.ashx/v2/forums/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } 'ShowByApplicationId' { $endpoint= "api.ashx/v2/forums/${applicationid}.json" $method = 'GET' $pageable = $False $restParams.Remove('applicationid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityForum { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AllowedThreadTypes, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DefaultThreadType, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IndexPosts, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ModeratePosts, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnablePostStatistics, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnablePostPoints, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableMailingList, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MailingListName, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MailingListAddress, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EmailFooter, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnablePassiveMode, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PassiveModeAddress, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$MappedGalleryId, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$SuggestedAnswerVoteThreshold, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$VerifiedAnswerVoteThreshold, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('AllowedThreadTypes')) { $restParams['AllowedThreadTypes'] = $AllowedThreadTypes } if($PSBoundParameters.ContainsKey('DefaultThreadType')) { $restParams['DefaultThreadType'] = $DefaultThreadType } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } if($PSBoundParameters.ContainsKey('IndexPosts')) { $restParams['IndexPosts'] = $IndexPosts } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('ModeratePosts')) { $restParams['ModeratePosts'] = $ModeratePosts } if($PSBoundParameters.ContainsKey('EnablePostStatistics')) { $restParams['EnablePostStatistics'] = $EnablePostStatistics } if($PSBoundParameters.ContainsKey('EnablePostPoints')) { $restParams['EnablePostPoints'] = $EnablePostPoints } if($PSBoundParameters.ContainsKey('EnableMailingList')) { $restParams['EnableMailingList'] = $EnableMailingList } if($PSBoundParameters.ContainsKey('MailingListName')) { $restParams['MailingListName'] = $MailingListName } if($PSBoundParameters.ContainsKey('MailingListAddress')) { $restParams['MailingListAddress'] = $MailingListAddress } if($PSBoundParameters.ContainsKey('EmailFooter')) { $restParams['EmailFooter'] = $EmailFooter } if($PSBoundParameters.ContainsKey('EnablePassiveMode')) { $restParams['EnablePassiveMode'] = $EnablePassiveMode } if($PSBoundParameters.ContainsKey('PassiveModeAddress')) { $restParams['PassiveModeAddress'] = $PassiveModeAddress } if($PSBoundParameters.ContainsKey('MappedGalleryId')) { $restParams['MappedGalleryId'] = $MappedGalleryId } if($PSBoundParameters.ContainsKey('SuggestedAnswerVoteThreshold')) { $restParams['SuggestedAnswerVoteThreshold'] = $SuggestedAnswerVoteThreshold } if($PSBoundParameters.ContainsKey('VerifiedAnswerVoteThreshold')) { $restParams['VerifiedAnswerVoteThreshold'] = $VerifiedAnswerVoteThreshold } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'CreateByGroupIdName' { $endpoint= "api.ashx/v2/forums.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityForum { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AllowedThreadTypes, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DefaultThreadType, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IndexPosts, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ModeratePosts, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnablePostStatistics, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnablePostPoints, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableMailingList, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MailingListName, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MailingListAddress, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EmailFooter, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnablePassiveMode, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PassiveModeAddress, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$MappedGalleryId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$SuggestedAnswerVoteThreshold, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$VerifiedAnswerVoteThreshold, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('AllowedThreadTypes')) { $restParams['AllowedThreadTypes'] = $AllowedThreadTypes } if($PSBoundParameters.ContainsKey('DefaultThreadType')) { $restParams['DefaultThreadType'] = $DefaultThreadType } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } if($PSBoundParameters.ContainsKey('IndexPosts')) { $restParams['IndexPosts'] = $IndexPosts } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('ModeratePosts')) { $restParams['ModeratePosts'] = $ModeratePosts } if($PSBoundParameters.ContainsKey('EnablePostStatistics')) { $restParams['EnablePostStatistics'] = $EnablePostStatistics } if($PSBoundParameters.ContainsKey('EnablePostPoints')) { $restParams['EnablePostPoints'] = $EnablePostPoints } if($PSBoundParameters.ContainsKey('EnableMailingList')) { $restParams['EnableMailingList'] = $EnableMailingList } if($PSBoundParameters.ContainsKey('MailingListName')) { $restParams['MailingListName'] = $MailingListName } if($PSBoundParameters.ContainsKey('MailingListAddress')) { $restParams['MailingListAddress'] = $MailingListAddress } if($PSBoundParameters.ContainsKey('EmailFooter')) { $restParams['EmailFooter'] = $EmailFooter } if($PSBoundParameters.ContainsKey('EnablePassiveMode')) { $restParams['EnablePassiveMode'] = $EnablePassiveMode } if($PSBoundParameters.ContainsKey('PassiveModeAddress')) { $restParams['PassiveModeAddress'] = $PassiveModeAddress } if($PSBoundParameters.ContainsKey('MappedGalleryId')) { $restParams['MappedGalleryId'] = $MappedGalleryId } if($PSBoundParameters.ContainsKey('SuggestedAnswerVoteThreshold')) { $restParams['SuggestedAnswerVoteThreshold'] = $SuggestedAnswerVoteThreshold } if($PSBoundParameters.ContainsKey('VerifiedAnswerVoteThreshold')) { $restParams['VerifiedAnswerVoteThreshold'] = $VerifiedAnswerVoteThreshold } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/forums/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityForum { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/forums/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityForumThread { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$AuthorId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ForumThreadQueryType, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$PopularOnly, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeDiscussions, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeQuestions, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedAfterDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedBeforeDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByThreadId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='ShowByContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='ShowByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [Parameter(ParameterSetName='ShowByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$MarkAsRead, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('AuthorId')) { $restParams['AuthorId'] = $AuthorId } if($PSBoundParameters.ContainsKey('ForumThreadQueryType')) { $restParams['ForumThreadQueryType'] = $ForumThreadQueryType } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PopularOnly')) { $restParams['PopularOnly'] = $PopularOnly } if($PSBoundParameters.ContainsKey('IncludeDiscussions')) { $restParams['IncludeDiscussions'] = $IncludeDiscussions } if($PSBoundParameters.ContainsKey('IncludeQuestions')) { $restParams['IncludeQuestions'] = $IncludeQuestions } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('CreatedAfterDate')) { $restParams['CreatedAfterDate'] = $CreatedAfterDate } if($PSBoundParameters.ContainsKey('CreatedBeforeDate')) { $restParams['CreatedBeforeDate'] = $CreatedBeforeDate } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } if($PSBoundParameters.ContainsKey('MarkAsRead')) { $restParams['MarkAsRead'] = $MarkAsRead } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/forums/threads.json" $method = 'GET' $pageable = $True } 'List2' { $endpoint= "api.ashx/v2/forums/threads/unanswered.json" $method = 'GET' $pageable = $True } 'List3' { $endpoint= "api.ashx/v2/forums/threads/active.json" $method = 'GET' $pageable = $True } 'List4' { $endpoint= "api.ashx/v2/forums/threads/unread.json" $method = 'GET' $pageable = $True } 'List5' { $endpoint= "api.ashx/v2/forums/threads/mythreads.json" $method = 'GET' $pageable = $True } 'List6' { $endpoint= "api.ashx/v2/forums/threads/moderated.json" $method = 'GET' $pageable = $True } 'List7' { $endpoint= "api.ashx/v2/forums/threads/authored.json" $method = 'GET' $pageable = $True } 'ShowByThreadId' { $endpoint= "api.ashx/v2/forums/threads/${threadid}.json" $method = 'GET' $pageable = $False $restParams.Remove('threadid') } 'ShowByContentId' { $endpoint= "api.ashx/v2/forums/threads/${contentid}.json" $method = 'GET' $pageable = $False $restParams.Remove('contentid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityForumThread { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Subject, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsSticky, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StickyDate, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PostDate, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsQuestion, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsLocked, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SubscribeToThread, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsAnonymous, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$HasPoll, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PollTitle, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PollDescription, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PollExpirationDate, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='CreateByForumIdSubjectBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$MarkAsRead, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('Subject')) { $restParams['Subject'] = $Subject } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('IsSticky')) { $restParams['IsSticky'] = $IsSticky } if($PSBoundParameters.ContainsKey('StickyDate')) { $restParams['StickyDate'] = $StickyDate } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('PostDate')) { $restParams['PostDate'] = $PostDate } if($PSBoundParameters.ContainsKey('IsQuestion')) { $restParams['IsQuestion'] = $IsQuestion } if($PSBoundParameters.ContainsKey('IsLocked')) { $restParams['IsLocked'] = $IsLocked } if($PSBoundParameters.ContainsKey('SubscribeToThread')) { $restParams['SubscribeToThread'] = $SubscribeToThread } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('IsAnonymous')) { $restParams['IsAnonymous'] = $IsAnonymous } if($PSBoundParameters.ContainsKey('HasPoll')) { $restParams['HasPoll'] = $HasPoll } if($PSBoundParameters.ContainsKey('PollTitle')) { $restParams['PollTitle'] = $PollTitle } if($PSBoundParameters.ContainsKey('PollDescription')) { $restParams['PollDescription'] = $PollDescription } if($PSBoundParameters.ContainsKey('PollExpirationDate')) { $restParams['PollExpirationDate'] = $PollExpirationDate } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('MarkAsRead')) { $restParams['MarkAsRead'] = $MarkAsRead } switch($PSCmdlet.ParameterSetName){ 'CreateByForumIdSubjectBody' { $endpoint= "api.ashx/v2/forums/${forumid}/threads.json" $method = 'POST' $pageable = $False $restParams.Remove('forumid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityForumThread { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Subject, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsSticky, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StickyDate, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PostDate, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsQuestion, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsLocked, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SubscribeToThread, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$RemoveAttachment, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsAnonymous, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$HasPoll, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PollTitle, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PollDescription, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PollExpirationDate, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EditNotes, [Parameter(ParameterSetName='UpdateByForumIdThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('Subject')) { $restParams['Subject'] = $Subject } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('IsSticky')) { $restParams['IsSticky'] = $IsSticky } if($PSBoundParameters.ContainsKey('StickyDate')) { $restParams['StickyDate'] = $StickyDate } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('PostDate')) { $restParams['PostDate'] = $PostDate } if($PSBoundParameters.ContainsKey('IsQuestion')) { $restParams['IsQuestion'] = $IsQuestion } if($PSBoundParameters.ContainsKey('IsLocked')) { $restParams['IsLocked'] = $IsLocked } if($PSBoundParameters.ContainsKey('SubscribeToThread')) { $restParams['SubscribeToThread'] = $SubscribeToThread } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('RemoveAttachment')) { $restParams['RemoveAttachment'] = $RemoveAttachment } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('IsAnonymous')) { $restParams['IsAnonymous'] = $IsAnonymous } if($PSBoundParameters.ContainsKey('HasPoll')) { $restParams['HasPoll'] = $HasPoll } if($PSBoundParameters.ContainsKey('PollTitle')) { $restParams['PollTitle'] = $PollTitle } if($PSBoundParameters.ContainsKey('PollDescription')) { $restParams['PollDescription'] = $PollDescription } if($PSBoundParameters.ContainsKey('PollExpirationDate')) { $restParams['PollExpirationDate'] = $PollExpirationDate } if($PSBoundParameters.ContainsKey('EditNotes')) { $restParams['EditNotes'] = $EditNotes } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'UpdateByForumIdThreadId' { $endpoint= "api.ashx/v2/forums/${forumid}/threads/${threadid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('forumid') $restParams.Remove('threadid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityForumThread { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByThreadId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='DeleteByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumId, [Parameter(ParameterSetName='DeleteByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$DeleteChildren, [Parameter(ParameterSetName='DeleteByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SendAuthorDeleteNotification, [Parameter(ParameterSetName='DeleteByThreadId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DeleteReason, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('ForumId')) { $restParams['ForumId'] = $ForumId } if($PSBoundParameters.ContainsKey('DeleteChildren')) { $restParams['DeleteChildren'] = $DeleteChildren } if($PSBoundParameters.ContainsKey('SendAuthorDeleteNotification')) { $restParams['SendAuthorDeleteNotification'] = $SendAuthorDeleteNotification } if($PSBoundParameters.ContainsKey('DeleteReason')) { $restParams['DeleteReason'] = $DeleteReason } switch($PSCmdlet.ParameterSetName){ 'DeleteByThreadId' { $endpoint= "api.ashx/v2/forums/threads/${threadid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('threadid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityFriendship { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByRequestorIdRequesteeIdRequestMessage', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByRequestorNameRequesteeIdRequestMessage', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RequestorId, [Parameter(ParameterSetName='CreateByRequestorNameRequesteeIdRequestMessage', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByRequestorIdRequesteeIdRequestMessage', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RequestorName, [Parameter(ParameterSetName='CreateByRequestorIdRequesteeIdRequestMessage', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByRequestorNameRequesteeIdRequestMessage', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RequesteeId, [Parameter(ParameterSetName='CreateByRequestorIdRequesteeIdRequestMessage', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByRequestorNameRequesteeIdRequestMessage', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$RequestMessage, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RequestorId')) { $restParams['RequestorId'] = $RequestorId } if($PSBoundParameters.ContainsKey('RequestorName')) { $restParams['RequestorName'] = $RequestorName } if($PSBoundParameters.ContainsKey('RequesteeId')) { $restParams['RequesteeId'] = $RequesteeId } if($PSBoundParameters.ContainsKey('RequestMessage')) { $restParams['RequestMessage'] = $RequestMessage } switch($PSCmdlet.ParameterSetName){ 'CreateByRequestorIdRequesteeIdRequestMessage' { $endpoint= "api.ashx/v2/users/${requestorid}/friends.json" $method = 'POST' $pageable = $False $restParams.Remove('requestorid') } 'CreateByRequestorNameRequesteeIdRequestMessage' { $endpoint= "api.ashx/v2/users/${requestorname}/friends.json" $method = 'POST' $pageable = $False $restParams.Remove('requestorname') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityFriendship { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RequestorId, [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RequestorName, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FriendshipState, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Presence, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RecipientId, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByRequestorId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByRequestorName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RequestorId')) { $restParams['RequestorId'] = $RequestorId } if($PSBoundParameters.ContainsKey('RequestorName')) { $restParams['RequestorName'] = $RequestorName } if($PSBoundParameters.ContainsKey('FriendshipState')) { $restParams['FriendshipState'] = $FriendshipState } if($PSBoundParameters.ContainsKey('Presence')) { $restParams['Presence'] = $Presence } if($PSBoundParameters.ContainsKey('RecipientId')) { $restParams['RecipientId'] = $RecipientId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ListByRequestorId' { $endpoint= "api.ashx/v2/users/${requestorid}/friends.json" $method = 'GET' $pageable = $True $restParams.Remove('requestorid') } 'ListByRequestorName' { $endpoint= "api.ashx/v2/users/${requestorname}/friends.json" $method = 'GET' $pageable = $True $restParams.Remove('requestorname') } 'ListByRequestorId' { $endpoint= "api.ashx/v2/users/${requestorid}/friends/pending.json" $method = 'GET' $pageable = $True $restParams.Remove('requestorid') } 'ListByRequestorName' { $endpoint= "api.ashx/v2/users/${requestorname}/friends/pending.json" $method = 'GET' $pageable = $True $restParams.Remove('requestorname') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityFriendship { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByRequestorIdRequesteeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByRequestorNameRequesteeName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RequestorId, [Parameter(ParameterSetName='DeleteByRequestorNameRequesteeName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByRequestorIdRequesteeId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RequestorName, [Parameter(ParameterSetName='DeleteByRequestorIdRequesteeId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByRequestorNameRequesteeName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RequesteeId, [Parameter(ParameterSetName='DeleteByRequestorNameRequesteeName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByRequestorIdRequesteeId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RequesteeName, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RequestorId')) { $restParams['RequestorId'] = $RequestorId } if($PSBoundParameters.ContainsKey('RequestorName')) { $restParams['RequestorName'] = $RequestorName } if($PSBoundParameters.ContainsKey('RequesteeId')) { $restParams['RequesteeId'] = $RequesteeId } if($PSBoundParameters.ContainsKey('RequesteeName')) { $restParams['RequesteeName'] = $RequesteeName } switch($PSCmdlet.ParameterSetName){ 'DeleteByRequestorIdRequesteeId' { $endpoint= "api.ashx/v2/users/${requestorid}/friends/${requesteeid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('requestorid') $restParams.Remove('requesteeid') } 'DeleteByRequestorNameRequesteeName' { $endpoint= "api.ashx/v2/users/${requestorname}/friends/${requesteename}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('requestorname') $restParams.Remove('requesteename') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityFriendship { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByRequestorIdRequesteeIdFriendshipState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByRequestorNameRequesteeNameFriendshipState', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RequestorId, [Parameter(ParameterSetName='UpdateByRequestorNameRequesteeNameFriendshipState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByRequestorIdRequesteeIdFriendshipState', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RequestorName, [Parameter(ParameterSetName='UpdateByRequestorIdRequesteeIdFriendshipState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByRequestorNameRequesteeNameFriendshipState', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RequesteeId, [Parameter(ParameterSetName='UpdateByRequestorNameRequesteeNameFriendshipState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByRequestorIdRequesteeIdFriendshipState', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RequesteeName, [Parameter(ParameterSetName='UpdateByRequestorIdRequesteeIdFriendshipState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByRequestorNameRequesteeNameFriendshipState', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$FriendshipState, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RequestorId')) { $restParams['RequestorId'] = $RequestorId } if($PSBoundParameters.ContainsKey('RequestorName')) { $restParams['RequestorName'] = $RequestorName } if($PSBoundParameters.ContainsKey('RequesteeId')) { $restParams['RequesteeId'] = $RequesteeId } if($PSBoundParameters.ContainsKey('RequesteeName')) { $restParams['RequesteeName'] = $RequesteeName } if($PSBoundParameters.ContainsKey('FriendshipState')) { $restParams['FriendshipState'] = $FriendshipState } switch($PSCmdlet.ParameterSetName){ 'UpdateByRequestorIdRequesteeIdFriendshipState' { $endpoint= "api.ashx/v2/users/${requestorid}/friends/${requesteeid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('requestorid') $restParams.Remove('requesteeid') } 'UpdateByRequestorNameRequesteeNameFriendshipState' { $endpoint= "api.ashx/v2/users/${requestorname}/friends/${requesteename}.json" $method = 'PUT' $pageable = $False $restParams.Remove('requestorname') $restParams.Remove('requesteename') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityGallery { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ApplicationIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$NameQuery, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('ApplicationIds')) { $restParams['ApplicationIds'] = $ApplicationIds } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } if($PSBoundParameters.ContainsKey('NameQuery')) { $restParams['NameQuery'] = $NameQuery } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/galleries.json" $method = 'GET' $pageable = $True } 'ShowById' { $endpoint= "api.ashx/v2/galleries/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } 'ShowByApplicationId' { $endpoint= "api.ashx/v2/galleries/${applicationid}.json" $method = 'GET' $pageable = $False $restParams.Remove('applicationid') } 'ShowByKeyGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/galleries/${key}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('key') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityGallery { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'CreateByGroupIdName' { $endpoint= "api.ashx/v2/galleries.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityGallery { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/galleries/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityGallery { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/galleries/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityGroupAvatar { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } switch($PSCmdlet.ParameterSetName){ 'ShowByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/avatar.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityGroupAvatar { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='UpdateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='UpdateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='UpdateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } switch($PSCmdlet.ParameterSetName){ 'UpdateByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/avatar.json" $method = 'PUT' $pageable = $False $restParams.Remove('groupid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityGroupAvatar { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } switch($PSCmdlet.ParameterSetName){ 'DeleteByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/avatar.json" $method = 'DELETE' $pageable = $False $restParams.Remove('groupid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityGroupContactRequest { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdContactRequestId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByGroupIdContactRequestId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ContactRequestId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('ContactRequestId')) { $restParams['ContactRequestId'] = $ContactRequestId } switch($PSCmdlet.ParameterSetName){ 'ListByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/contactrequests.json" $method = 'GET' $pageable = $True $restParams.Remove('groupid') } 'ShowByGroupIdContactRequestId' { $endpoint= "api.ashx/v2/groups/${groupid}/contactrequests/${contactrequestid}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('contactrequestid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityGroupContactRequest { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByGroupIdBodyEmailAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByGroupIdBodyEmailAddress', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Subject, [Parameter(ParameterSetName='CreateByGroupIdBodyEmailAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByGroupIdBodyEmailAddress', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByGroupIdBodyEmailAddress', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$EmailAddress, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Subject')) { $restParams['Subject'] = $Subject } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('EmailAddress')) { $restParams['EmailAddress'] = $EmailAddress } switch($PSCmdlet.ParameterSetName){ 'CreateByGroupIdBodyEmailAddress' { $endpoint= "api.ashx/v2/groups/${groupid}/contactrequests.json" $method = 'POST' $pageable = $False $restParams.Remove('groupid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityGroupContactRequest { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByGroupIdContactRequestId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='DeleteByGroupIdContactRequestId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ContactRequestId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('ContactRequestId')) { $restParams['ContactRequestId'] = $ContactRequestId } switch($PSCmdlet.ParameterSetName){ 'DeleteByGroupIdContactRequestId' { $endpoint= "api.ashx/v2/groups/${groupid}/contactrequests/${contactrequestid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('contactrequestid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityGroup { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludePendingMemberships, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentGroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeAllSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$GroupTypes, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$GroupNameFilter, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ContainerIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Permission, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('IncludePendingMemberships')) { $restParams['IncludePendingMemberships'] = $IncludePendingMemberships } if($PSBoundParameters.ContainsKey('ParentGroupId')) { $restParams['ParentGroupId'] = $ParentGroupId } if($PSBoundParameters.ContainsKey('IncludeAllSubGroups')) { $restParams['IncludeAllSubGroups'] = $IncludeAllSubGroups } if($PSBoundParameters.ContainsKey('GroupTypes')) { $restParams['GroupTypes'] = $GroupTypes } if($PSBoundParameters.ContainsKey('GroupNameFilter')) { $restParams['GroupNameFilter'] = $GroupNameFilter } if($PSBoundParameters.ContainsKey('ContainerIds')) { $restParams['ContainerIds'] = $ContainerIds } if($PSBoundParameters.ContainsKey('Permission')) { $restParams['Permission'] = $Permission } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/groups.json" $method = 'GET' $pageable = $True } 'Show2' { $endpoint= "api.ashx/v2/groups/${Id}.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityGroup { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentGroupId, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$GroupType, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableGroupMessages, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$AutoCreateApplications, [Parameter(ParameterSetName='CreateByNameGroupType', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('ParentGroupId')) { $restParams['ParentGroupId'] = $ParentGroupId } if($PSBoundParameters.ContainsKey('GroupType')) { $restParams['GroupType'] = $GroupType } if($PSBoundParameters.ContainsKey('EnableGroupMessages')) { $restParams['EnableGroupMessages'] = $EnableGroupMessages } if($PSBoundParameters.ContainsKey('AutoCreateApplications')) { $restParams['AutoCreateApplications'] = $AutoCreateApplications } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'CreateByNameGroupType' { $endpoint= "api.ashx/v2/groups.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityGroup { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentGroupId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$GroupType, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableGroupMessages, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('ParentGroupId')) { $restParams['ParentGroupId'] = $ParentGroupId } if($PSBoundParameters.ContainsKey('GroupType')) { $restParams['GroupType'] = $GroupType } if($PSBoundParameters.ContainsKey('EnableGroupMessages')) { $restParams['EnableGroupMessages'] = $EnableGroupMessages } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/groups/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityGroup { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='DeleteById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$DeleteApplications, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('DeleteApplications')) { $restParams['DeleteApplications'] = $DeleteApplications } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/groups/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityGroupUser { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRolename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='ShowByGroupIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRolename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$JoinedAfterDate, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MembershipType, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$UsernameFilter, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MemberType, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeRoleMembers, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByGroupIdUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRolename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='ShowByGroupIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRolename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='ShowByGroupIdRolename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByGroupIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Rolename, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('JoinedAfterDate')) { $restParams['JoinedAfterDate'] = $JoinedAfterDate } if($PSBoundParameters.ContainsKey('MembershipType')) { $restParams['MembershipType'] = $MembershipType } if($PSBoundParameters.ContainsKey('UsernameFilter')) { $restParams['UsernameFilter'] = $UsernameFilter } if($PSBoundParameters.ContainsKey('MemberType')) { $restParams['MemberType'] = $MemberType } if($PSBoundParameters.ContainsKey('IncludeRoleMembers')) { $restParams['IncludeRoleMembers'] = $IncludeRoleMembers } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('Rolename')) { $restParams['Rolename'] = $Rolename } switch($PSCmdlet.ParameterSetName){ 'ListByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/users.json" $method = 'GET' $pageable = $True $restParams.Remove('groupid') } 'ListByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/roles.json" $method = 'GET' $pageable = $True $restParams.Remove('groupid') } 'ShowByGroupIdUserId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/users/${userid}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('userid') } 'ShowByGroupIdUsername' { $endpoint= "api.ashx/v2/groups/${groupid}/members/users/${username}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('username') } 'ShowByGroupIdRoleId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/roles/${roleid}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('roleid') } 'ShowByGroupIdRolename' { $endpoint= "api.ashx/v2/groups/${groupid}/members/roles/${rolename}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('rolename') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityGroupUser { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='CreateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='CreateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$GroupMembershipType, [Parameter(ParameterSetName='CreateByGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Message, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('GroupMembershipType')) { $restParams['GroupMembershipType'] = $GroupMembershipType } if($PSBoundParameters.ContainsKey('Message')) { $restParams['Message'] = $Message } switch($PSCmdlet.ParameterSetName){ 'CreateByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/users.json" $method = 'POST' $pageable = $False $restParams.Remove('groupid') } 'CreateByGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/roles.json" $method = 'POST' $pageable = $False $restParams.Remove('groupid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityGroupUser { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByGroupIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRolename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='DeleteByGroupIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRolename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='DeleteByGroupIdUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRolename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='DeleteByGroupIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRolename', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='DeleteByGroupIdRolename', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByGroupIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Rolename, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('Rolename')) { $restParams['Rolename'] = $Rolename } switch($PSCmdlet.ParameterSetName){ 'DeleteByGroupIdUserId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/users/${userid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('userid') } 'DeleteByGroupIdUsername' { $endpoint= "api.ashx/v2/groups/${groupid}/members/users/${username}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('username') } 'DeleteByGroupIdRoleId' { $endpoint= "api.ashx/v2/groups/${groupid}/members/roles/${roleid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('roleid') } 'DeleteByGroupIdRolename' { $endpoint= "api.ashx/v2/groups/${groupid}/members/roles/${rolename}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('rolename') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityHashTag { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ListByQueryText', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$QueryText, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationTypeId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('QueryText')) { $restParams['QueryText'] = $QueryText } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ApplicationTypeId')) { $restParams['ApplicationTypeId'] = $ApplicationTypeId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } switch($PSCmdlet.ParameterSetName){ 'ListByQueryText' { $endpoint= "api.ashx/v2/hashtags.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityInfo { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show8', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show9', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show10', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show11', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ShowSiteSettings, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show8', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show9', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show10', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show11', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ShowApplicationConfiguration, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show3', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show4', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show5', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show6', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show7', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show8', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show9', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show10', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show11', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ApplicationType, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ShowSiteSettings')) { $restParams['ShowSiteSettings'] = $ShowSiteSettings } if($PSBoundParameters.ContainsKey('ShowApplicationConfiguration')) { $restParams['ShowApplicationConfiguration'] = $ShowApplicationConfiguration } if($PSBoundParameters.ContainsKey('ApplicationType')) { $restParams['ApplicationType'] = $ApplicationType } switch($PSCmdlet.ParameterSetName){ 'Show1' { $endpoint= "api.ashx/v2/info.json" $method = 'GET' $pageable = $False } 'Show2' { $endpoint= "api.ashx/v2/info/sitesettings.json" $method = 'GET' $pageable = $False } 'Show3' { $endpoint= "api.ashx/v2/info/forumconfiguration.json" $method = 'GET' $pageable = $False } 'Show4' { $endpoint= "api.ashx/v2/info/wikiconfiguration.json" $method = 'GET' $pageable = $False } 'Show5' { $endpoint= "api.ashx/v2/info/galleryconfiguration.json" $method = 'GET' $pageable = $False } 'Show6' { $endpoint= "api.ashx/v2/info/blogconfiguration.json" $method = 'GET' $pageable = $False } 'Show7' { $endpoint= "api.ashx/v2/info/mailgatewayconfiguration.json" $method = 'GET' $pageable = $False } 'Show8' { $endpoint= "api.ashx/v2/info/adconfiguration.json" $method = 'GET' $pageable = $False } 'Show9' { $endpoint= "api.ashx/v2/info/spamconfiguration.json" $method = 'GET' $pageable = $False } 'Show10' { $endpoint= "api.ashx/v2/info/searchconfiguration.json" $method = 'GET' $pageable = $False } 'Show11' { $endpoint= "api.ashx/v2/info/solrconfiguration.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityLike { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Create1' { $endpoint= "api.ashx/v2/likes.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityLike { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$ContentCreatedAfterDate, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$ContentCreatedBeforeDate, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('ContentCreatedAfterDate')) { $restParams['ContentCreatedAfterDate'] = $ContentCreatedAfterDate } if($PSBoundParameters.ContainsKey('ContentCreatedBeforeDate')) { $restParams['ContentCreatedBeforeDate'] = $ContentCreatedBeforeDate } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'Show1' { $endpoint= "api.ashx/v2/like.json" $method = 'GET' $pageable = $False } 'List2' { $endpoint= "api.ashx/v2/likes.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityLike { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Delete1' { $endpoint= "api.ashx/v2/like.json" $method = 'DELETE' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityMedia { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Preview, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphTitle, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphDescription, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageContext, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageFileName, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaTitle, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaKeywords, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaDescription, [Parameter(ParameterSetName='CreateByMediaGalleryIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$PostDate, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('Preview')) { $restParams['Preview'] = $Preview } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('OpenGraphTitle')) { $restParams['OpenGraphTitle'] = $OpenGraphTitle } if($PSBoundParameters.ContainsKey('OpenGraphDescription')) { $restParams['OpenGraphDescription'] = $OpenGraphDescription } if($PSBoundParameters.ContainsKey('OpenGraphImageContext')) { $restParams['OpenGraphImageContext'] = $OpenGraphImageContext } if($PSBoundParameters.ContainsKey('OpenGraphImageFileName')) { $restParams['OpenGraphImageFileName'] = $OpenGraphImageFileName } if($PSBoundParameters.ContainsKey('MetaTitle')) { $restParams['MetaTitle'] = $MetaTitle } if($PSBoundParameters.ContainsKey('MetaKeywords')) { $restParams['MetaKeywords'] = $MetaKeywords } if($PSBoundParameters.ContainsKey('MetaDescription')) { $restParams['MetaDescription'] = $MetaDescription } if($PSBoundParameters.ContainsKey('PostDate')) { $restParams['PostDate'] = $PostDate } switch($PSCmdlet.ParameterSetName){ 'CreateByMediaGalleryIdName' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files.json" $method = 'POST' $pageable = $False $restParams.Remove('mediagalleryid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityMedia { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$FileId, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUrl, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Preview, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphTitle, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphDescription, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageContext, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OpenGraphImageFileName, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$RemoveOpenGraphImage, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaTitle, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaKeywords, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaDescription, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('FileId')) { $restParams['FileId'] = $FileId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } if($PSBoundParameters.ContainsKey('FileUrl')) { $restParams['FileUrl'] = $FileUrl } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('Preview')) { $restParams['Preview'] = $Preview } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('OpenGraphTitle')) { $restParams['OpenGraphTitle'] = $OpenGraphTitle } if($PSBoundParameters.ContainsKey('OpenGraphDescription')) { $restParams['OpenGraphDescription'] = $OpenGraphDescription } if($PSBoundParameters.ContainsKey('OpenGraphImageContext')) { $restParams['OpenGraphImageContext'] = $OpenGraphImageContext } if($PSBoundParameters.ContainsKey('OpenGraphImageFileName')) { $restParams['OpenGraphImageFileName'] = $OpenGraphImageFileName } if($PSBoundParameters.ContainsKey('RemoveOpenGraphImage')) { $restParams['RemoveOpenGraphImage'] = $RemoveOpenGraphImage } if($PSBoundParameters.ContainsKey('MetaTitle')) { $restParams['MetaTitle'] = $MetaTitle } if($PSBoundParameters.ContainsKey('MetaKeywords')) { $restParams['MetaKeywords'] = $MetaKeywords } if($PSBoundParameters.ContainsKey('MetaDescription')) { $restParams['MetaDescription'] = $MetaDescription } switch($PSCmdlet.ParameterSetName){ 'UpdateByMediaGalleryIdFileId' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${fileid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('fileid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityMedia { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='DeleteByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$FileId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('FileId')) { $restParams['FileId'] = $FileId } switch($PSCmdlet.ParameterSetName){ 'DeleteByMediaGalleryIdFileId' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${fileid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('fileid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityMedia { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByMediaGalleryIdFileContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GalleryId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int[]]$MediaGalleryIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int[]]$GalleryIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeUnpublished, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByMediaGalleryIdFileContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByMediaGalleryIdFileContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$FileId, [Parameter(ParameterSetName='ShowByMediaGalleryIdFileContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$FileContentId, [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByMediaGalleryIdFileContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Filename, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('GalleryId')) { $restParams['GalleryId'] = $GalleryId } if($PSBoundParameters.ContainsKey('MediaGalleryIds')) { $restParams['MediaGalleryIds'] = $MediaGalleryIds } if($PSBoundParameters.ContainsKey('GalleryIds')) { $restParams['GalleryIds'] = $GalleryIds } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('IncludeUnpublished')) { $restParams['IncludeUnpublished'] = $IncludeUnpublished } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('FileId')) { $restParams['FileId'] = $FileId } if($PSBoundParameters.ContainsKey('FileContentId')) { $restParams['FileContentId'] = $FileContentId } if($PSBoundParameters.ContainsKey('Filename')) { $restParams['Filename'] = $Filename } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/media/files.json" $method = 'GET' $pageable = $True } 'ShowByMediaGalleryIdFileId' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${fileid}.json" $method = 'GET' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('fileid') } 'ShowByMediaGalleryIdFileContentId' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${filecontentid}.json" $method = 'GET' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('filecontentid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityMediaSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='ShowByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$FileId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('FileId')) { $restParams['FileId'] = $FileId } switch($PSCmdlet.ParameterSetName){ 'ShowByMediaGalleryIdFileId' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${fileid}/subscriptions.json" $method = 'GET' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('fileid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityMediaSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$FileId, [Parameter(ParameterSetName='UpdateByMediaGalleryIdFileIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsSubscribed, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('FileId')) { $restParams['FileId'] = $FileId } if($PSBoundParameters.ContainsKey('IsSubscribed')) { $restParams['IsSubscribed'] = $IsSubscribed } switch($PSCmdlet.ParameterSetName){ 'UpdateByMediaGalleryIdFileIdIsSubscribed' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${fileid}/subscriptions.json" $method = 'PUT' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('fileid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityMediaSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$MediaGalleryId, [Parameter(ParameterSetName='CreateByMediaGalleryIdFileId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$FileId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MediaGalleryId')) { $restParams['MediaGalleryId'] = $MediaGalleryId } if($PSBoundParameters.ContainsKey('FileId')) { $restParams['FileId'] = $FileId } switch($PSCmdlet.ParameterSetName){ 'CreateByMediaGalleryIdFileId' { $endpoint= "api.ashx/v2/media/${mediagalleryid}/files/${fileid}/subscriptions.json" $method = 'POST' $pageable = $False $restParams.Remove('mediagalleryid') $restParams.Remove('fileid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityMentionable { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ListByQueryText', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$QueryText, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationTypeId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerTypeId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='ListByQueryText', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('QueryText')) { $restParams['QueryText'] = $QueryText } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ApplicationTypeId')) { $restParams['ApplicationTypeId'] = $ApplicationTypeId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('ContainerTypeId')) { $restParams['ContainerTypeId'] = $ContainerTypeId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } switch($PSCmdlet.ParameterSetName){ 'ListByQueryText' { $endpoint= "api.ashx/v2/mentionables.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityMention { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentionedApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentionedApplicationTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentionedContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$MentionedContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentionedContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentioningApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentioningApplicationTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentioningContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$MentioningContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MentioningContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MentioningPropertyName, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MentionedApplicationId')) { $restParams['MentionedApplicationId'] = $MentionedApplicationId } if($PSBoundParameters.ContainsKey('MentionedApplicationTypeId')) { $restParams['MentionedApplicationTypeId'] = $MentionedApplicationTypeId } if($PSBoundParameters.ContainsKey('MentionedContainerId')) { $restParams['MentionedContainerId'] = $MentionedContainerId } if($PSBoundParameters.ContainsKey('MentionedContentIds')) { $restParams['MentionedContentIds'] = $MentionedContentIds } if($PSBoundParameters.ContainsKey('MentionedContentTypeId')) { $restParams['MentionedContentTypeId'] = $MentionedContentTypeId } if($PSBoundParameters.ContainsKey('MentioningApplicationId')) { $restParams['MentioningApplicationId'] = $MentioningApplicationId } if($PSBoundParameters.ContainsKey('MentioningApplicationTypeId')) { $restParams['MentioningApplicationTypeId'] = $MentioningApplicationTypeId } if($PSBoundParameters.ContainsKey('MentioningContainerId')) { $restParams['MentioningContainerId'] = $MentioningContainerId } if($PSBoundParameters.ContainsKey('MentioningContentIds')) { $restParams['MentioningContentIds'] = $MentioningContentIds } if($PSBoundParameters.ContainsKey('MentioningContentTypeId')) { $restParams['MentioningContentTypeId'] = $MentioningContentTypeId } if($PSBoundParameters.ContainsKey('MentioningPropertyName')) { $restParams['MentioningPropertyName'] = $MentioningPropertyName } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/mentions.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityNodePermission { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByApplicationApplicationIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Application, [Parameter(ParameterSetName='ShowByApplicationApplicationIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$ApplicationId, [Parameter(ParameterSetName='ShowByApplicationApplicationIdPermissionId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostType, [Parameter(ParameterSetName='ShowByApplicationApplicationIdPermissionId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PostId, [Parameter(ParameterSetName='ShowByApplicationApplicationIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Application')) { $restParams['Application'] = $Application } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('PostType')) { $restParams['PostType'] = $PostType } if($PSBoundParameters.ContainsKey('PostId')) { $restParams['PostId'] = $PostId } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } switch($PSCmdlet.ParameterSetName){ 'ShowByApplicationApplicationIdPermissionId' { $endpoint= "api.ashx/v2/permissions/${permissionid}.json" $method = 'GET' $pageable = $False $restParams.Remove('permissionid') } 'ShowByApplicationApplicationIdPermissionId' { $endpoint= "api.ashx/v2/${application}/${applicationid}/permissions/${permissionid}.json" $method = 'GET' $pageable = $False $restParams.Remove('application') $restParams.Remove('applicationid') $restParams.Remove('permissionid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityNotificationDistributionType { [CmdletBinding(SupportsShouldProcess = $true)] param( [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/notificationdistributiontypes.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityNotificationPreference { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByNotificationTypeIdIsEnabled', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$NotificationTypeId, [Parameter(ParameterSetName='UpdateByNotificationTypeIdIsEnabled', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$DistributionTypeId, [Parameter(ParameterSetName='UpdateByNotificationTypeIdIsEnabled', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsEnabled, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('NotificationTypeId')) { $restParams['NotificationTypeId'] = $NotificationTypeId } if($PSBoundParameters.ContainsKey('DistributionTypeId')) { $restParams['DistributionTypeId'] = $DistributionTypeId } if($PSBoundParameters.ContainsKey('IsEnabled')) { $restParams['IsEnabled'] = $IsEnabled } switch($PSCmdlet.ParameterSetName){ 'UpdateByNotificationTypeIdIsEnabled' { $endpoint= "api.ashx/v2/notificationpreference.json" $method = 'PUT' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityNotificationPreference { [CmdletBinding(SupportsShouldProcess = $true)] param( [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/notificationpreferences.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityNotification { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByNotificationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$NotificationId, [Parameter(ParameterSetName='UpdateByNotificationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$MarkAsRead, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('NotificationId')) { $restParams['NotificationId'] = $NotificationId } if($PSBoundParameters.ContainsKey('MarkAsRead')) { $restParams['MarkAsRead'] = $MarkAsRead } switch($PSCmdlet.ParameterSetName){ 'UpdateByNotificationId' { $endpoint= "api.ashx/v2/notification/${notificationid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('notificationid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityNotification { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByNotificationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$NotificationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsRead, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$Filters, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('NotificationId')) { $restParams['NotificationId'] = $NotificationId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('IsRead')) { $restParams['IsRead'] = $IsRead } if($PSBoundParameters.ContainsKey('Filters')) { $restParams['Filters'] = $Filters } switch($PSCmdlet.ParameterSetName){ 'ShowByNotificationId' { $endpoint= "api.ashx/v2/notification/${notificationid}.json" $method = 'GET' $pageable = $False $restParams.Remove('notificationid') } 'List1' { $endpoint= "api.ashx/v2/notifications.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityNotification { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByNotificationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$NotificationId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('NotificationId')) { $restParams['NotificationId'] = $NotificationId } switch($PSCmdlet.ParameterSetName){ 'DeleteByNotificationId' { $endpoint= "api.ashx/v2/notification/${notificationid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('notificationid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityNotificationType { [CmdletBinding(SupportsShouldProcess = $true)] param( [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/notificationtypes.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityOAuth { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByClientTypeClientUserIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ClientType, [Parameter(ParameterSetName='CreateByClientTypeClientUserIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ClientUserId, [Parameter(ParameterSetName='CreateByClientTypeClientUserIdUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ClientType')) { $restParams['ClientType'] = $ClientType } if($PSBoundParameters.ContainsKey('ClientUserId')) { $restParams['ClientUserId'] = $ClientUserId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } switch($PSCmdlet.ParameterSetName){ 'CreateByClientTypeClientUserIdUserId' { $endpoint= "api.ashx/v2/users/oauth/${clienttype}/${clientuserid}.json" $method = 'POST' $pageable = $False $restParams.Remove('clienttype') $restParams.Remove('clientuserid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityOAuth { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByClientTypeClientUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ClientType, [Parameter(ParameterSetName='ShowByClientTypeClientUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ClientUserId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ClientType')) { $restParams['ClientType'] = $ClientType } if($PSBoundParameters.ContainsKey('ClientUserId')) { $restParams['ClientUserId'] = $ClientUserId } switch($PSCmdlet.ParameterSetName){ 'ShowByClientTypeClientUserId' { $endpoint= "api.ashx/v2/users/oauth/${clienttype}/${clientuserid}.json" $method = 'GET' $pageable = $False $restParams.Remove('clienttype') $restParams.Remove('clientuserid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityPermission { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByApplicationIdRoleIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Application, [Parameter(ParameterSetName='ShowByApplicationIdRoleIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByApplicationIdRoleIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='ShowByApplicationIdRoleIdPermissionId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [Parameter(ParameterSetName='ShowByApplicationIdRoleIdPermissionId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Include, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Application')) { $restParams['Application'] = $Application } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } if($PSBoundParameters.ContainsKey('Include')) { $restParams['Include'] = $Include } switch($PSCmdlet.ParameterSetName){ 'ShowByApplicationIdRoleIdPermissionId' { $endpoint= "api.ashx/v2/roles/${roleid}/permissions/${permissionid}.json" $method = 'GET' $pageable = $False $restParams.Remove('roleid') $restParams.Remove('permissionid') } 'ShowByApplicationIdRoleIdPermissionId' { $endpoint= "api.ashx/v2/${application}/${id}/roles/${roleid}/permissions/${permissionid}.json" $method = 'GET' $pageable = $False $restParams.Remove('application') $restParams.Remove('id') $restParams.Remove('roleid') $restParams.Remove('permissionid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityRatedItem { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/rateditems.json" $method = 'GET' $pageable = $True } 'Show2' { $endpoint= "api.ashx/v2/rateditem.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityRating { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [double]$Value, [Parameter(ParameterSetName='Create1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('Value')) { $restParams['Value'] = $Value } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Create1' { $endpoint= "api.ashx/v2/ratings.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityRating { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Show1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'Show1' { $endpoint= "api.ashx/v2/rating.json" $method = 'GET' $pageable = $False } 'List2' { $endpoint= "api.ashx/v2/ratings.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityRating { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='Delete1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } switch($PSCmdlet.ParameterSetName){ 'Delete1' { $endpoint= "api.ashx/v2/rating.json" $method = 'DELETE' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityReplyMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByParentMessageIdAuthorIdMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByParentMessageIdAuthorNameMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ParentMessageId, [Parameter(ParameterSetName='CreateByParentMessageIdAuthorIdMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByParentMessageIdAuthorNameMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$AuthorId, [Parameter(ParameterSetName='CreateByParentMessageIdAuthorNameMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByParentMessageIdAuthorIdMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AuthorName, [Parameter(ParameterSetName='CreateByParentMessageIdAuthorIdMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByParentMessageIdAuthorNameMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$MessageBody, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ParentMessageId')) { $restParams['ParentMessageId'] = $ParentMessageId } if($PSBoundParameters.ContainsKey('AuthorId')) { $restParams['AuthorId'] = $AuthorId } if($PSBoundParameters.ContainsKey('AuthorName')) { $restParams['AuthorName'] = $AuthorName } if($PSBoundParameters.ContainsKey('MessageBody')) { $restParams['MessageBody'] = $MessageBody } switch($PSCmdlet.ParameterSetName){ 'CreateByParentMessageIdAuthorIdMessageBody' { $endpoint= "api.ashx/v2/users/${authorid}/statuses/${parentmessageid}/replies.json" $method = 'POST' $pageable = $False $restParams.Remove('authorid') $restParams.Remove('parentmessageid') } 'CreateByParentMessageIdAuthorNameMessageBody' { $endpoint= "api.ashx/v2/users/${authorname}/statuses/${parentmessageid}/replies.json" $method = 'POST' $pageable = $False $restParams.Remove('authorname') $restParams.Remove('parentmessageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityReplyMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByParentMessageIdMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ParentMessageId, [Parameter(ParameterSetName='DeleteByParentMessageIdMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$MessageId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('ParentMessageId')) { $restParams['ParentMessageId'] = $ParentMessageId } if($PSBoundParameters.ContainsKey('MessageId')) { $restParams['MessageId'] = $MessageId } switch($PSCmdlet.ParameterSetName){ 'DeleteByParentMessageIdMessageId' { $endpoint= "api.ashx/v2/activities/${parentmessageid}/replies/${messageid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('parentmessageid') $restParams.Remove('messageid') } 'DeleteByParentMessageIdMessageId' { $endpoint= "api.ashx/v2/statuses/${parentmessageid}/replies/${messageid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('parentmessageid') $restParams.Remove('messageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityRole { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ListByApplication', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Application, [Parameter(ParameterSetName='ShowByApplicationIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludePermissions, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationIdRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Include, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeWithAvatarOnly, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByApplication', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByApplicationIdRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Application')) { $restParams['Application'] = $Application } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('IncludePermissions')) { $restParams['IncludePermissions'] = $IncludePermissions } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } if($PSBoundParameters.ContainsKey('Include')) { $restParams['Include'] = $Include } if($PSBoundParameters.ContainsKey('IncludeWithAvatarOnly')) { $restParams['IncludeWithAvatarOnly'] = $IncludeWithAvatarOnly } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } switch($PSCmdlet.ParameterSetName){ 'ListByApplication' { $endpoint= "api.ashx/v2/roles/permissions.json" $method = 'GET' $pageable = $True } 'ListByApplication' { $endpoint= "api.ashx/v2/roles.json" $method = 'GET' $pageable = $True } 'ShowByApplicationIdRoleId' { $endpoint= "api.ashx/v2/roles/${roleid}/permissions.json" $method = 'GET' $pageable = $False $restParams.Remove('roleid') } 'ShowByApplicationIdRoleId' { $endpoint= "api.ashx/v2/roles/${roleid}.json" $method = 'GET' $pageable = $False $restParams.Remove('roleid') } 'ShowByApplicationIdRoleId' { $endpoint= "api.ashx/v2/${application}/${id}/roles/${roleid}/permissions.json" $method = 'GET' $pageable = $False $restParams.Remove('application') $restParams.Remove('id') $restParams.Remove('roleid') } 'ShowByApplicationIdRoleId' { $endpoint= "api.ashx/v2/${application}/${id}/roles/${roleid}.json" $method = 'GET' $pageable = $False $restParams.Remove('application') $restParams.Remove('id') $restParams.Remove('roleid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityRole { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$RoleName, [Parameter(ParameterSetName='CreateByNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Include, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('RoleName')) { $restParams['RoleName'] = $RoleName } if($PSBoundParameters.ContainsKey('Include')) { $restParams['Include'] = $Include } switch($PSCmdlet.ParameterSetName){ 'CreateByNameDescription' { $endpoint= "api.ashx/v2/roles.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityRole { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByRoleIdNameDescription', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='UpdateByRoleIdNameDescription', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateByRoleIdNameDescription', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateByRoleIdNameDescription', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } switch($PSCmdlet.ParameterSetName){ 'UpdateByRoleIdNameDescription' { $endpoint= "api.ashx/v2/roles/${roleid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('roleid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityRole { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByRoleId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='DeleteByRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='DeleteByRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='DeleteByRoleId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Include, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('Include')) { $restParams['Include'] = $Include } switch($PSCmdlet.ParameterSetName){ 'DeleteByRoleId' { $endpoint= "api.ashx/v2/roles/${roleid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('roleid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunitySearch { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Query, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Filters, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Sort, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$EndDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Collapse, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FieldFacets, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DateRangeFacets, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FieldFilters, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DateRangeFilters, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$LogicallyOrTags, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Mlt, [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Id, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$GuidId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Category, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsContent, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApplication, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsContainer, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Query')) { $restParams['Query'] = $Query } if($PSBoundParameters.ContainsKey('Filters')) { $restParams['Filters'] = $Filters } if($PSBoundParameters.ContainsKey('Sort')) { $restParams['Sort'] = $Sort } if($PSBoundParameters.ContainsKey('StartDate')) { $restParams['StartDate'] = $StartDate } if($PSBoundParameters.ContainsKey('EndDate')) { $restParams['EndDate'] = $EndDate } if($PSBoundParameters.ContainsKey('Collapse')) { $restParams['Collapse'] = $Collapse } if($PSBoundParameters.ContainsKey('FieldFacets')) { $restParams['FieldFacets'] = $FieldFacets } if($PSBoundParameters.ContainsKey('DateRangeFacets')) { $restParams['DateRangeFacets'] = $DateRangeFacets } if($PSBoundParameters.ContainsKey('FieldFilters')) { $restParams['FieldFilters'] = $FieldFilters } if($PSBoundParameters.ContainsKey('DateRangeFilters')) { $restParams['DateRangeFilters'] = $DateRangeFilters } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('LogicallyOrTags')) { $restParams['LogicallyOrTags'] = $LogicallyOrTags } if($PSBoundParameters.ContainsKey('Mlt')) { $restParams['Mlt'] = $Mlt } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('GuidId')) { $restParams['GuidId'] = $GuidId } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('Category')) { $restParams['Category'] = $Category } if($PSBoundParameters.ContainsKey('IsContent')) { $restParams['IsContent'] = $IsContent } if($PSBoundParameters.ContainsKey('IsApplication')) { $restParams['IsApplication'] = $IsApplication } if($PSBoundParameters.ContainsKey('IsContainer')) { $restParams['IsContainer'] = $IsContainer } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/search.json" $method = 'GET' $pageable = $True } 'ShowById' { $endpoint= "api.ashx/v2/search/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunitySearch { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Collapse, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Content, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ContentId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$CreatedBy, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [DateTime]$Date, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EditedBy, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [double]$Rating, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Roles, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$SectionId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Title, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$CustomFields, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$GuidId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Category, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsContent, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApplication, [Parameter(ParameterSetName='CreateByContentContentIdContentTypeContentUrlDateRolesTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsContainer, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Collapse')) { $restParams['Collapse'] = $Collapse } if($PSBoundParameters.ContainsKey('Content')) { $restParams['Content'] = $Content } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('CreatedBy')) { $restParams['CreatedBy'] = $CreatedBy } if($PSBoundParameters.ContainsKey('Date')) { $restParams['Date'] = $Date } if($PSBoundParameters.ContainsKey('EditedBy')) { $restParams['EditedBy'] = $EditedBy } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Rating')) { $restParams['Rating'] = $Rating } if($PSBoundParameters.ContainsKey('Roles')) { $restParams['Roles'] = $Roles } if($PSBoundParameters.ContainsKey('SectionId')) { $restParams['SectionId'] = $SectionId } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('Title')) { $restParams['Title'] = $Title } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('CustomFields')) { $restParams['CustomFields'] = $CustomFields } if($PSBoundParameters.ContainsKey('GuidId')) { $restParams['GuidId'] = $GuidId } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('Category')) { $restParams['Category'] = $Category } if($PSBoundParameters.ContainsKey('IsContent')) { $restParams['IsContent'] = $IsContent } if($PSBoundParameters.ContainsKey('IsApplication')) { $restParams['IsApplication'] = $IsApplication } if($PSBoundParameters.ContainsKey('IsContainer')) { $restParams['IsContainer'] = $IsContainer } switch($PSCmdlet.ParameterSetName){ 'CreateByContentContentIdContentTypeContentUrlDateRolesTitle' { $endpoint= "api.ashx/v2/search.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunitySearch { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Collapse, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Content, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentType, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$CreatedBy, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$Date, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EditedBy, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [double]$Rating, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Roles, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$SectionId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ThreadId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Title, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$CustomFields, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$GuidId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContainerId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Category, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsContent, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsApplication, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsContainer, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('Collapse')) { $restParams['Collapse'] = $Collapse } if($PSBoundParameters.ContainsKey('Content')) { $restParams['Content'] = $Content } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentType')) { $restParams['ContentType'] = $ContentType } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('CreatedBy')) { $restParams['CreatedBy'] = $CreatedBy } if($PSBoundParameters.ContainsKey('Date')) { $restParams['Date'] = $Date } if($PSBoundParameters.ContainsKey('EditedBy')) { $restParams['EditedBy'] = $EditedBy } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Rating')) { $restParams['Rating'] = $Rating } if($PSBoundParameters.ContainsKey('Roles')) { $restParams['Roles'] = $Roles } if($PSBoundParameters.ContainsKey('SectionId')) { $restParams['SectionId'] = $SectionId } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ThreadId')) { $restParams['ThreadId'] = $ThreadId } if($PSBoundParameters.ContainsKey('Title')) { $restParams['Title'] = $Title } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('CustomFields')) { $restParams['CustomFields'] = $CustomFields } if($PSBoundParameters.ContainsKey('GuidId')) { $restParams['GuidId'] = $GuidId } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('ContainerId')) { $restParams['ContainerId'] = $ContainerId } if($PSBoundParameters.ContainsKey('Category')) { $restParams['Category'] = $Category } if($PSBoundParameters.ContainsKey('IsContent')) { $restParams['IsContent'] = $IsContent } if($PSBoundParameters.ContainsKey('IsApplication')) { $restParams['IsApplication'] = $IsApplication } if($PSBoundParameters.ContainsKey('IsContainer')) { $restParams['IsContainer'] = $IsContainer } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/search/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunitySearch { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/search/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityStatusMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByUserIdMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByUsernameMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='CreateByUsernameMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByUserIdMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='CreateByUserIdMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByUsernameMessageBody', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$MessageBody, [Parameter(ParameterSetName='CreateByUserIdMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByUsernameMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByUserIdMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='CreateByUsernameMessageBody', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AttachedUrl, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('MessageBody')) { $restParams['MessageBody'] = $MessageBody } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('AttachedUrl')) { $restParams['AttachedUrl'] = $AttachedUrl } switch($PSCmdlet.ParameterSetName){ 'CreateByUserIdMessageBody' { $endpoint= "api.ashx/v2/users/${userid}/statuses.json" $method = 'POST' $pageable = $False $restParams.Remove('userid') } 'CreateByUsernameMessageBody' { $endpoint= "api.ashx/v2/users/${username}/statuses.json" $method = 'POST' $pageable = $False $restParams.Remove('username') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityStatusMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByUserIdMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUsernameMessageId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='ShowByUsernameMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUserIdMessageId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUserIdMessageId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUsernameMessageId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Include, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$BeforeDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$AfterDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ShowByUserIdMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUsernameMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$MessageId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('Include')) { $restParams['Include'] = $Include } if($PSBoundParameters.ContainsKey('StartDate')) { $restParams['StartDate'] = $StartDate } if($PSBoundParameters.ContainsKey('BeforeDate')) { $restParams['BeforeDate'] = $BeforeDate } if($PSBoundParameters.ContainsKey('AfterDate')) { $restParams['AfterDate'] = $AfterDate } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('MessageId')) { $restParams['MessageId'] = $MessageId } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/statuses.json" $method = 'GET' $pageable = $False } 'ShowByUserIdMessageId' { $endpoint= "api.ashx/v2/users/${userid}/statuses/${messageid}.json" $method = 'GET' $pageable = $False $restParams.Remove('userid') $restParams.Remove('messageid') } 'ShowByUsernameMessageId' { $endpoint= "api.ashx/v2/users/${username}/statuses/${messageid}.json" $method = 'GET' $pageable = $False $restParams.Remove('username') $restParams.Remove('messageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityStatusMessage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByMessageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$MessageId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('MessageId')) { $restParams['MessageId'] = $MessageId } switch($PSCmdlet.ParameterSetName){ 'DeleteByMessageId' { $endpoint= "api.ashx/v2/statuses/${messageid}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('messageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityActivityStory { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$Id, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentTypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$TypeId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentUrl, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ContainerIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubContainers, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$StoryIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$StartDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$EndDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedStartDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedEndDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$Filters, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeUserEffectiveMemberGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeAllJoinlessGroups, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('ContentTypeId')) { $restParams['ContentTypeId'] = $ContentTypeId } if($PSBoundParameters.ContainsKey('TypeId')) { $restParams['TypeId'] = $TypeId } if($PSBoundParameters.ContainsKey('ContentUrl')) { $restParams['ContentUrl'] = $ContentUrl } if($PSBoundParameters.ContainsKey('ContainerIds')) { $restParams['ContainerIds'] = $ContainerIds } if($PSBoundParameters.ContainsKey('IncludeSubContainers')) { $restParams['IncludeSubContainers'] = $IncludeSubContainers } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('StoryIds')) { $restParams['StoryIds'] = $StoryIds } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('StartDate')) { $restParams['StartDate'] = $StartDate } if($PSBoundParameters.ContainsKey('EndDate')) { $restParams['EndDate'] = $EndDate } if($PSBoundParameters.ContainsKey('CreatedStartDate')) { $restParams['CreatedStartDate'] = $CreatedStartDate } if($PSBoundParameters.ContainsKey('CreatedEndDate')) { $restParams['CreatedEndDate'] = $CreatedEndDate } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Filters')) { $restParams['Filters'] = $Filters } if($PSBoundParameters.ContainsKey('IncludeUserEffectiveMemberGroups')) { $restParams['IncludeUserEffectiveMemberGroups'] = $IncludeUserEffectiveMemberGroups } if($PSBoundParameters.ContainsKey('IncludeAllJoinlessGroups')) { $restParams['IncludeAllJoinlessGroups'] = $IncludeAllJoinlessGroups } switch($PSCmdlet.ParameterSetName){ 'ShowById' { $endpoint= "api.ashx/v2/stories/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } 'List1' { $endpoint= "api.ashx/v2/stories.json" $method = 'GET' $pageable = $True } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityActivityStory { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/stories/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityUserAvatar { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } switch($PSCmdlet.ParameterSetName){ 'ShowByUserId' { $endpoint= "api.ashx/v2/users/${userid}/avatar.json" $method = 'GET' $pageable = $False $restParams.Remove('userid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityUserAvatar { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='UpdateByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AvatarUrl, [Parameter(ParameterSetName='UpdateByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='UpdateByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='UpdateByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('AvatarUrl')) { $restParams['AvatarUrl'] = $AvatarUrl } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } switch($PSCmdlet.ParameterSetName){ 'UpdateByUserId' { $endpoint= "api.ashx/v2/users/${userid}/avatar.json" $method = 'PUT' $pageable = $False $restParams.Remove('userid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityUserAvatar { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } switch($PSCmdlet.ParameterSetName){ 'DeleteByUserId' { $endpoint= "api.ashx/v2/users/${userid}/avatar.json" $method = 'DELETE' $pageable = $False $restParams.Remove('userid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityUserInvitation { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByInvitationKeyUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByInvitationKeyUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$InvitationKey, [Parameter(ParameterSetName='ShowByInvitationKeyUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByInvitationKeyUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='ShowByInvitationKeyUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByInvitationKeyUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('InvitationKey')) { $restParams['InvitationKey'] = $InvitationKey } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } switch($PSCmdlet.ParameterSetName){ 'ShowByInvitationKeyUserId' { $endpoint= "api.ashx/v2/users/${userid}/invitations/${invitationkey}.json" $method = 'GET' $pageable = $False $restParams.Remove('userid') $restParams.Remove('invitationkey') } 'ShowByInvitationKeyUsername' { $endpoint= "api.ashx/v2/users/${username}/invitations/${invitationkey}.json" $method = 'GET' $pageable = $False $restParams.Remove('username') $restParams.Remove('invitationkey') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityUserInvitation { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByEmail', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Email, [Parameter(ParameterSetName='CreateByEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Message, [Parameter(ParameterSetName='CreateByEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$GroupMembershipType, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Email')) { $restParams['Email'] = $Email } if($PSBoundParameters.ContainsKey('Message')) { $restParams['Message'] = $Message } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('GroupMembershipType')) { $restParams['GroupMembershipType'] = $GroupMembershipType } switch($PSCmdlet.ParameterSetName){ 'CreateByEmail' { $endpoint= "api.ashx/v2/users/invitations.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityUserInvitation { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByInvitationKeyUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByInvitationKeyUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$InvitationKey, [Parameter(ParameterSetName='UpdateByInvitationKeyUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByInvitationKeyUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='UpdateByInvitationKeyUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByInvitationKeyUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('InvitationKey')) { $restParams['InvitationKey'] = $InvitationKey } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } switch($PSCmdlet.ParameterSetName){ 'UpdateByInvitationKeyUserId' { $endpoint= "api.ashx/v2/users/${userid}/invitations/${invitationkey}.json" $method = 'PUT' $pageable = $False $restParams.Remove('userid') $restParams.Remove('invitationkey') } 'UpdateByInvitationKeyUsername' { $endpoint= "api.ashx/v2/users/${username}/invitations/${invitationkey}.json" $method = 'PUT' $pageable = $False $restParams.Remove('username') $restParams.Remove('invitationkey') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityUserPresence { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByUserId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='ShowByUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByUserId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Location, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('Location')) { $restParams['Location'] = $Location } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/userpresence.json" $method = 'GET' $pageable = $True } 'ShowByUserId' { $endpoint= "api.ashx/v2/userpresence/${userid}.json" $method = 'GET' $pageable = $False $restParams.Remove('userid') } 'ShowByUsername' { $endpoint= "api.ashx/v2/userpresence/${username}.json" $method = 'GET' $pageable = $False $restParams.Remove('username') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityUserPresence { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByUserIdIsOnline', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByUsernameIsOnline', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='UpdateByUsernameIsOnline', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByUserIdIsOnline', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='UpdateByUserIdIsOnline', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByUsernameIsOnline', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsOnline, [Parameter(ParameterSetName='UpdateByUserIdIsOnline', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByUsernameIsOnline', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Location, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('IsOnline')) { $restParams['IsOnline'] = $IsOnline } if($PSBoundParameters.ContainsKey('Location')) { $restParams['Location'] = $Location } switch($PSCmdlet.ParameterSetName){ 'UpdateByUserIdIsOnline' { $endpoint= "api.ashx/v2/userpresence/${userid}.json" $method = 'PUT' $pageable = $False $restParams.Remove('userid') } 'UpdateByUsernameIsOnline' { $endpoint= "api.ashx/v2/userpresence/${username}.json" $method = 'PUT' $pageable = $False $restParams.Remove('username') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityUserProfileFieldGroup { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeUserProfileFields, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('IncludeUserProfileFields')) { $restParams['IncludeUserProfileFields'] = $IncludeUserProfileFields } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/userprofilefieldgroups.json" $method = 'GET' $pageable = $True } 'ShowById' { $endpoint= "api.ashx/v2/userprofilefieldgroups/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityUserProfileField { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserProfileFieldGroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsSearchable, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowByName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('UserProfileFieldGroupId')) { $restParams['UserProfileFieldGroupId'] = $UserProfileFieldGroupId } if($PSBoundParameters.ContainsKey('IsSearchable')) { $restParams['IsSearchable'] = $IsSearchable } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/userprofilefields.json" $method = 'GET' $pageable = $True } 'ShowByName' { $endpoint= "api.ashx/v2/userprofilefields/${name}.json" $method = 'GET' $pageable = $False $restParams.Remove('name') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityUser { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Users, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Password, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$PrivateEmail, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DisplayName, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$AllowSitePartnersToContact, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$AllowSiteToContact, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Bio, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$Birthday, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsBirthdaySet, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EditorType, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableCommentNotifications, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableConversationNotifications, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableDisplayInMemberList, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableDisplayName, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableEmoticons, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableFavoriteSharing, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ReceiveEmails, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableHtmlEmail, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableTracking, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Gender, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Language, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Location, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostSortOrder, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PublicEmail, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Signature, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [double]$TimeZone, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$TimeZoneId, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$WebUrl, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ProfileFields, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$RssFeeds, [Parameter(ParameterSetName='CreateByUsernamePasswordPrivateEmail', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SendEmail, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Users')) { $restParams['Users'] = $Users } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('Password')) { $restParams['Password'] = $Password } if($PSBoundParameters.ContainsKey('PrivateEmail')) { $restParams['PrivateEmail'] = $PrivateEmail } if($PSBoundParameters.ContainsKey('DisplayName')) { $restParams['DisplayName'] = $DisplayName } if($PSBoundParameters.ContainsKey('AllowSitePartnersToContact')) { $restParams['AllowSitePartnersToContact'] = $AllowSitePartnersToContact } if($PSBoundParameters.ContainsKey('AllowSiteToContact')) { $restParams['AllowSiteToContact'] = $AllowSiteToContact } if($PSBoundParameters.ContainsKey('Bio')) { $restParams['Bio'] = $Bio } if($PSBoundParameters.ContainsKey('Birthday')) { $restParams['Birthday'] = $Birthday } if($PSBoundParameters.ContainsKey('IsBirthdaySet')) { $restParams['IsBirthdaySet'] = $IsBirthdaySet } if($PSBoundParameters.ContainsKey('EditorType')) { $restParams['EditorType'] = $EditorType } if($PSBoundParameters.ContainsKey('EnableCommentNotifications')) { $restParams['EnableCommentNotifications'] = $EnableCommentNotifications } if($PSBoundParameters.ContainsKey('EnableConversationNotifications')) { $restParams['EnableConversationNotifications'] = $EnableConversationNotifications } if($PSBoundParameters.ContainsKey('EnableDisplayInMemberList')) { $restParams['EnableDisplayInMemberList'] = $EnableDisplayInMemberList } if($PSBoundParameters.ContainsKey('EnableDisplayName')) { $restParams['EnableDisplayName'] = $EnableDisplayName } if($PSBoundParameters.ContainsKey('EnableEmoticons')) { $restParams['EnableEmoticons'] = $EnableEmoticons } if($PSBoundParameters.ContainsKey('EnableFavoriteSharing')) { $restParams['EnableFavoriteSharing'] = $EnableFavoriteSharing } if($PSBoundParameters.ContainsKey('ReceiveEmails')) { $restParams['ReceiveEmails'] = $ReceiveEmails } if($PSBoundParameters.ContainsKey('EnableHtmlEmail')) { $restParams['EnableHtmlEmail'] = $EnableHtmlEmail } if($PSBoundParameters.ContainsKey('EnableTracking')) { $restParams['EnableTracking'] = $EnableTracking } if($PSBoundParameters.ContainsKey('Gender')) { $restParams['Gender'] = $Gender } if($PSBoundParameters.ContainsKey('Language')) { $restParams['Language'] = $Language } if($PSBoundParameters.ContainsKey('Location')) { $restParams['Location'] = $Location } if($PSBoundParameters.ContainsKey('PostSortOrder')) { $restParams['PostSortOrder'] = $PostSortOrder } if($PSBoundParameters.ContainsKey('PublicEmail')) { $restParams['PublicEmail'] = $PublicEmail } if($PSBoundParameters.ContainsKey('Signature')) { $restParams['Signature'] = $Signature } if($PSBoundParameters.ContainsKey('TimeZone')) { $restParams['TimeZone'] = $TimeZone } if($PSBoundParameters.ContainsKey('TimeZoneId')) { $restParams['TimeZoneId'] = $TimeZoneId } if($PSBoundParameters.ContainsKey('WebUrl')) { $restParams['WebUrl'] = $WebUrl } if($PSBoundParameters.ContainsKey('ProfileFields')) { $restParams['ProfileFields'] = $ProfileFields } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('RssFeeds')) { $restParams['RssFeeds'] = $RssFeeds } if($PSBoundParameters.ContainsKey('SendEmail')) { $restParams['SendEmail'] = $SendEmail } switch($PSCmdlet.ParameterSetName){ 'CreateByUsernamePasswordPrivateEmail' { $endpoint= "api.ashx/v2/users.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityUser { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$JoinDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Usernames, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EmailAddress, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$RoleId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AccountStatus, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeHidden, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$LastUpdatedUtcDate, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$MembershipId, [Parameter(ParameterSetName='Show2', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('JoinDate')) { $restParams['JoinDate'] = $JoinDate } if($PSBoundParameters.ContainsKey('Usernames')) { $restParams['Usernames'] = $Usernames } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('EmailAddress')) { $restParams['EmailAddress'] = $EmailAddress } if($PSBoundParameters.ContainsKey('RoleId')) { $restParams['RoleId'] = $RoleId } if($PSBoundParameters.ContainsKey('AccountStatus')) { $restParams['AccountStatus'] = $AccountStatus } if($PSBoundParameters.ContainsKey('IncludeHidden')) { $restParams['IncludeHidden'] = $IncludeHidden } if($PSBoundParameters.ContainsKey('LastUpdatedUtcDate')) { $restParams['LastUpdatedUtcDate'] = $LastUpdatedUtcDate } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('MembershipId')) { $restParams['MembershipId'] = $MembershipId } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/users.json" $method = 'GET' $pageable = $True } 'Show2' { $endpoint= "api.ashx/v2/user.json" $method = 'GET' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityUser { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$LookupUsername, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$User, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$OldPassword, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$NewPassword, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PrivateEmail, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsIgnored, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ForceLogin, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DisplayName, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$AllowSitePartnersToContact, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$AllowSiteToContact, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Bio, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$Birthday, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsBirthdaySet, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ConversationContactType, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$DateFormat, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$EditorType, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableCommentNotifications, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableConversationNotifications, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableDisplayInMemberList, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableDisplayName, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableEmoticons, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableFavoriteSharing, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ReceiveEmails, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableHtmlEmail, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableTracking, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$EnableUserSignatures, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Gender, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Language, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Location, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PublicEmail, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Signature, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [double]$TimeZone, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$TimeZoneId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$WebUrl, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$AccountStatus, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$BanReason, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$BannedUntil, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ProfileFields, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [hashtable]$ExtendedAttributes, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$RssFeeds, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$EnabledActivityMessageTypes, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='UpdateByLookupUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ModerationLevel, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('LookupUsername')) { $restParams['LookupUsername'] = $LookupUsername } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('User')) { $restParams['User'] = $User } if($PSBoundParameters.ContainsKey('OldPassword')) { $restParams['OldPassword'] = $OldPassword } if($PSBoundParameters.ContainsKey('NewPassword')) { $restParams['NewPassword'] = $NewPassword } if($PSBoundParameters.ContainsKey('PrivateEmail')) { $restParams['PrivateEmail'] = $PrivateEmail } if($PSBoundParameters.ContainsKey('IsIgnored')) { $restParams['IsIgnored'] = $IsIgnored } if($PSBoundParameters.ContainsKey('ForceLogin')) { $restParams['ForceLogin'] = $ForceLogin } if($PSBoundParameters.ContainsKey('DisplayName')) { $restParams['DisplayName'] = $DisplayName } if($PSBoundParameters.ContainsKey('AllowSitePartnersToContact')) { $restParams['AllowSitePartnersToContact'] = $AllowSitePartnersToContact } if($PSBoundParameters.ContainsKey('AllowSiteToContact')) { $restParams['AllowSiteToContact'] = $AllowSiteToContact } if($PSBoundParameters.ContainsKey('Bio')) { $restParams['Bio'] = $Bio } if($PSBoundParameters.ContainsKey('Birthday')) { $restParams['Birthday'] = $Birthday } if($PSBoundParameters.ContainsKey('IsBirthdaySet')) { $restParams['IsBirthdaySet'] = $IsBirthdaySet } if($PSBoundParameters.ContainsKey('ConversationContactType')) { $restParams['ConversationContactType'] = $ConversationContactType } if($PSBoundParameters.ContainsKey('DateFormat')) { $restParams['DateFormat'] = $DateFormat } if($PSBoundParameters.ContainsKey('EditorType')) { $restParams['EditorType'] = $EditorType } if($PSBoundParameters.ContainsKey('EnableCommentNotifications')) { $restParams['EnableCommentNotifications'] = $EnableCommentNotifications } if($PSBoundParameters.ContainsKey('EnableConversationNotifications')) { $restParams['EnableConversationNotifications'] = $EnableConversationNotifications } if($PSBoundParameters.ContainsKey('EnableDisplayInMemberList')) { $restParams['EnableDisplayInMemberList'] = $EnableDisplayInMemberList } if($PSBoundParameters.ContainsKey('EnableDisplayName')) { $restParams['EnableDisplayName'] = $EnableDisplayName } if($PSBoundParameters.ContainsKey('EnableEmoticons')) { $restParams['EnableEmoticons'] = $EnableEmoticons } if($PSBoundParameters.ContainsKey('EnableFavoriteSharing')) { $restParams['EnableFavoriteSharing'] = $EnableFavoriteSharing } if($PSBoundParameters.ContainsKey('ReceiveEmails')) { $restParams['ReceiveEmails'] = $ReceiveEmails } if($PSBoundParameters.ContainsKey('EnableHtmlEmail')) { $restParams['EnableHtmlEmail'] = $EnableHtmlEmail } if($PSBoundParameters.ContainsKey('EnableTracking')) { $restParams['EnableTracking'] = $EnableTracking } if($PSBoundParameters.ContainsKey('EnableUserSignatures')) { $restParams['EnableUserSignatures'] = $EnableUserSignatures } if($PSBoundParameters.ContainsKey('Gender')) { $restParams['Gender'] = $Gender } if($PSBoundParameters.ContainsKey('Language')) { $restParams['Language'] = $Language } if($PSBoundParameters.ContainsKey('Location')) { $restParams['Location'] = $Location } if($PSBoundParameters.ContainsKey('PublicEmail')) { $restParams['PublicEmail'] = $PublicEmail } if($PSBoundParameters.ContainsKey('Signature')) { $restParams['Signature'] = $Signature } if($PSBoundParameters.ContainsKey('TimeZone')) { $restParams['TimeZone'] = $TimeZone } if($PSBoundParameters.ContainsKey('TimeZoneId')) { $restParams['TimeZoneId'] = $TimeZoneId } if($PSBoundParameters.ContainsKey('WebUrl')) { $restParams['WebUrl'] = $WebUrl } if($PSBoundParameters.ContainsKey('AccountStatus')) { $restParams['AccountStatus'] = $AccountStatus } if($PSBoundParameters.ContainsKey('BanReason')) { $restParams['BanReason'] = $BanReason } if($PSBoundParameters.ContainsKey('BannedUntil')) { $restParams['BannedUntil'] = $BannedUntil } if($PSBoundParameters.ContainsKey('ProfileFields')) { $restParams['ProfileFields'] = $ProfileFields } if($PSBoundParameters.ContainsKey('ExtendedAttributes')) { $restParams['ExtendedAttributes'] = $ExtendedAttributes } if($PSBoundParameters.ContainsKey('RssFeeds')) { $restParams['RssFeeds'] = $RssFeeds } if($PSBoundParameters.ContainsKey('EnabledActivityMessageTypes')) { $restParams['EnabledActivityMessageTypes'] = $EnabledActivityMessageTypes } if($PSBoundParameters.ContainsKey('ModerationLevel')) { $restParams['ModerationLevel'] = $ModerationLevel } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/users/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } 'UpdateByLookupUsername' { $endpoint= "api.ashx/v2/users/${lookupusername}.json" $method = 'PUT' $pageable = $False $restParams.Remove('lookupusername') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityUser { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='DeleteByUsername', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='DeleteById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ReassignedUserId, [Parameter(ParameterSetName='DeleteById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ReassignedUsername, [Parameter(ParameterSetName='DeleteById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='DeleteByUsername', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$DeleteAllContent, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('ReassignedUserId')) { $restParams['ReassignedUserId'] = $ReassignedUserId } if($PSBoundParameters.ContainsKey('ReassignedUsername')) { $restParams['ReassignedUsername'] = $ReassignedUsername } if($PSBoundParameters.ContainsKey('DeleteAllContent')) { $restParams['DeleteAllContent'] = $DeleteAllContent } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/users/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } 'DeleteByUsername' { $endpoint= "api.ashx/v2/users/${username}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('username') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityUserValidation { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByUsernamePassword', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Username, [Parameter(ParameterSetName='CreateByUsernamePassword', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Password, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Username')) { $restParams['Username'] = $Username } if($PSBoundParameters.ContainsKey('Password')) { $restParams['Password'] = $Password } switch($PSCmdlet.ParameterSetName){ 'CreateByUsernamePassword' { $endpoint= "api.ashx/v2/users/validate.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityWikiFile { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByWikiIdFileName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='CreateByWikiIdFileName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$FileName, [Parameter(ParameterSetName='CreateByWikiIdFileName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [byte[]]$FileData, [Parameter(ParameterSetName='CreateByWikiIdFileName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FileUploadContext, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('FileName')) { $restParams['FileName'] = $FileName } if($PSBoundParameters.ContainsKey('FileData')) { $restParams['FileData'] = $FileData } if($PSBoundParameters.ContainsKey('FileUploadContext')) { $restParams['FileUploadContext'] = $FileUploadContext } switch($PSCmdlet.ParameterSetName){ 'CreateByWikiIdFileName' { $endpoint= "api.ashx/v2/wikis/${wikiid}/files.json" $method = 'POST' $pageable = $False $restParams.Remove('wikiid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityWikiPageCommentSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByWikiIdContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='ShowByWikiIdContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } switch($PSCmdlet.ParameterSetName){ 'ShowByWikiIdContentId' { $endpoint= "api.ashx/v2/wikis/${wikiId}/pages/${contentId}/commentsubscriptions.json" $method = 'GET' $pageable = $False $restParams.Remove('wikiId') $restParams.Remove('contentId') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityWikiPageCommentSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByWikiIdContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='CreateByWikiIdContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } switch($PSCmdlet.ParameterSetName){ 'CreateByWikiIdContentId' { $endpoint= "api.ashx/v2/wikis/${wikiId}/pages/${contentId}/commentsubscriptions.json" $method = 'POST' $pageable = $False $restParams.Remove('wikiId') $restParams.Remove('contentId') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityWikiPageCommentSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByWikiIdContentIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='UpdateByWikiIdContentIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='UpdateByWikiIdContentIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsSubscribed, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('IsSubscribed')) { $restParams['IsSubscribed'] = $IsSubscribed } switch($PSCmdlet.ParameterSetName){ 'UpdateByWikiIdContentIdIsSubscribed' { $endpoint= "api.ashx/v2/wikis/${wikiId}/pages/${contentId}/commentsubscriptions.json" $method = 'PUT' $pageable = $False $restParams.Remove('wikiId') $restParams.Remove('contentId') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityWikiPageRevision { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByRevisionNumberPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByRevisionNumberPageKeyWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RevisionNumber, [Parameter(ParameterSetName='ShowByRevisionNumberPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByRevisionNumberPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageId, [Parameter(ParameterSetName='ShowByRevisionNumberPageKeyWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByRevisionNumberPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PageKey, [Parameter(ParameterSetName='ShowByRevisionNumberPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByRevisionNumberPageKeyWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='ShowByRevisionNumberPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByRevisionNumberPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByPageIdWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByPageKeyWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RevisionNumber')) { $restParams['RevisionNumber'] = $RevisionNumber } if($PSBoundParameters.ContainsKey('PageId')) { $restParams['PageId'] = $PageId } if($PSBoundParameters.ContainsKey('PageKey')) { $restParams['PageKey'] = $PageKey } if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ShowByRevisionNumberPageIdWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${pageid}/revisions/${revisionnumber}.json" $method = 'GET' $pageable = $False $restParams.Remove('wikiid') $restParams.Remove('pageid') $restParams.Remove('revisionnumber') } 'ShowByRevisionNumberPageKeyWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${pagekey}/revisions/${revisionnumber}.json" $method = 'GET' $pageable = $False $restParams.Remove('wikiid') $restParams.Remove('pagekey') $restParams.Remove('revisionnumber') } 'ListByPageIdWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${pageid}/revisions.json" $method = 'GET' $pageable = $True $restParams.Remove('wikiid') $restParams.Remove('pageid') } 'ListByPageKeyWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${pagekey}/revisions.json" $method = 'GET' $pageable = $True $restParams.Remove('wikiid') $restParams.Remove('pagekey') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityWikiPageRevision { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteByRevisionNumberPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$RevisionNumber, [Parameter(ParameterSetName='DeleteByRevisionNumberPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$PageId, [Parameter(ParameterSetName='DeleteByRevisionNumberPageIdWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('RevisionNumber')) { $restParams['RevisionNumber'] = $RevisionNumber } if($PSBoundParameters.ContainsKey('PageId')) { $restParams['PageId'] = $PageId } if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } switch($PSCmdlet.ParameterSetName){ 'DeleteByRevisionNumberPageIdWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${pageid}/revisions/${revisionnumber}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('wikiid') $restParams.Remove('pageid') $restParams.Remove('revisionnumber') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityWikiPage { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByContentId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ContentId, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PageKey, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ListByWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PostTarget, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumThreadId, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByContentId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PageTitle, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentPageId, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroupContent, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeDisabledPages, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$QueryType, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$AuthorId, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$ContentIds, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortOrder, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ShowHiddenInTableOfContents, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='ListByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ContentId')) { $restParams['ContentId'] = $ContentId } if($PSBoundParameters.ContainsKey('PageKey')) { $restParams['PageKey'] = $PageKey } if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('PostTarget')) { $restParams['PostTarget'] = $PostTarget } if($PSBoundParameters.ContainsKey('ForumThreadId')) { $restParams['ForumThreadId'] = $ForumThreadId } if($PSBoundParameters.ContainsKey('PageTitle')) { $restParams['PageTitle'] = $PageTitle } if($PSBoundParameters.ContainsKey('ParentPageId')) { $restParams['ParentPageId'] = $ParentPageId } if($PSBoundParameters.ContainsKey('IncludeSubGroupContent')) { $restParams['IncludeSubGroupContent'] = $IncludeSubGroupContent } if($PSBoundParameters.ContainsKey('IncludeDisabledPages')) { $restParams['IncludeDisabledPages'] = $IncludeDisabledPages } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('QueryType')) { $restParams['QueryType'] = $QueryType } if($PSBoundParameters.ContainsKey('AuthorId')) { $restParams['AuthorId'] = $AuthorId } if($PSBoundParameters.ContainsKey('ContentIds')) { $restParams['ContentIds'] = $ContentIds } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('SortOrder')) { $restParams['SortOrder'] = $SortOrder } if($PSBoundParameters.ContainsKey('ShowHiddenInTableOfContents')) { $restParams['ShowHiddenInTableOfContents'] = $ShowHiddenInTableOfContents } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } switch($PSCmdlet.ParameterSetName){ 'ShowByWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages.json" $method = 'GET' $pageable = $False $restParams.Remove('wikiid') } 'ShowById' { $endpoint= "api.ashx/v2/wikis/pages/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } 'ShowByContentId' { $endpoint= "api.ashx/v2/wikis/pages/${contentid}.json" $method = 'GET' $pageable = $False $restParams.Remove('contentid') } 'ListByWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages.json" $method = 'GET' $pageable = $True $restParams.Remove('wikiid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityWikiPage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Title, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsLocked, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsPublished, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentPageId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumThreadId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$LastModifiedDate, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$SaveRevision, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaTitle, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaKeywords, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaDescription, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Position, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$HideInTableOfContents, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('Title')) { $restParams['Title'] = $Title } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('IsLocked')) { $restParams['IsLocked'] = $IsLocked } if($PSBoundParameters.ContainsKey('IsPublished')) { $restParams['IsPublished'] = $IsPublished } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('ParentPageId')) { $restParams['ParentPageId'] = $ParentPageId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('ForumThreadId')) { $restParams['ForumThreadId'] = $ForumThreadId } if($PSBoundParameters.ContainsKey('LastModifiedDate')) { $restParams['LastModifiedDate'] = $LastModifiedDate } if($PSBoundParameters.ContainsKey('SaveRevision')) { $restParams['SaveRevision'] = $SaveRevision } if($PSBoundParameters.ContainsKey('MetaTitle')) { $restParams['MetaTitle'] = $MetaTitle } if($PSBoundParameters.ContainsKey('MetaKeywords')) { $restParams['MetaKeywords'] = $MetaKeywords } if($PSBoundParameters.ContainsKey('MetaDescription')) { $restParams['MetaDescription'] = $MetaDescription } if($PSBoundParameters.ContainsKey('Position')) { $restParams['Position'] = $Position } if($PSBoundParameters.ContainsKey('HideInTableOfContents')) { $restParams['HideInTableOfContents'] = $HideInTableOfContents } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/wikis/pages/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityWikiPage { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Title, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Body, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsLocked, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsPublished, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IsFeatured, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$FeaturedImage, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ParentPageId, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string[]]$Tags, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$ForumThreadId, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [DateTime]$CreatedDate, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaTitle, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaKeywords, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$MetaDescription, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Position, [Parameter(ParameterSetName='CreateByWikiIdTitle', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$HideInTableOfContents, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('Title')) { $restParams['Title'] = $Title } if($PSBoundParameters.ContainsKey('Body')) { $restParams['Body'] = $Body } if($PSBoundParameters.ContainsKey('IsLocked')) { $restParams['IsLocked'] = $IsLocked } if($PSBoundParameters.ContainsKey('IsPublished')) { $restParams['IsPublished'] = $IsPublished } if($PSBoundParameters.ContainsKey('IsFeatured')) { $restParams['IsFeatured'] = $IsFeatured } if($PSBoundParameters.ContainsKey('FeaturedImage')) { $restParams['FeaturedImage'] = $FeaturedImage } if($PSBoundParameters.ContainsKey('ParentPageId')) { $restParams['ParentPageId'] = $ParentPageId } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('Tags')) { $restParams['Tags'] = $Tags } if($PSBoundParameters.ContainsKey('ForumThreadId')) { $restParams['ForumThreadId'] = $ForumThreadId } if($PSBoundParameters.ContainsKey('CreatedDate')) { $restParams['CreatedDate'] = $CreatedDate } if($PSBoundParameters.ContainsKey('MetaTitle')) { $restParams['MetaTitle'] = $MetaTitle } if($PSBoundParameters.ContainsKey('MetaKeywords')) { $restParams['MetaKeywords'] = $MetaKeywords } if($PSBoundParameters.ContainsKey('MetaDescription')) { $restParams['MetaDescription'] = $MetaDescription } if($PSBoundParameters.ContainsKey('Position')) { $restParams['Position'] = $Position } if($PSBoundParameters.ContainsKey('HideInTableOfContents')) { $restParams['HideInTableOfContents'] = $HideInTableOfContents } switch($PSCmdlet.ParameterSetName){ 'CreateByWikiIdTitle' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages.json" $method = 'POST' $pageable = $False $restParams.Remove('wikiid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityWikiPageSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByWikiIdWikiPageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='ShowByWikiIdWikiPageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiPageId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('WikiPageId')) { $restParams['WikiPageId'] = $WikiPageId } switch($PSCmdlet.ParameterSetName){ 'ShowByWikiIdWikiPageId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${wikipageid}/subscriptions.json" $method = 'GET' $pageable = $False $restParams.Remove('wikiid') $restParams.Remove('wikipageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityWikiPageSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateByWikiIdWikiPageIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='UpdateByWikiIdWikiPageIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiPageId, [Parameter(ParameterSetName='UpdateByWikiIdWikiPageIdIsSubscribed', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [bool]$IsSubscribed, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('WikiPageId')) { $restParams['WikiPageId'] = $WikiPageId } if($PSBoundParameters.ContainsKey('IsSubscribed')) { $restParams['IsSubscribed'] = $IsSubscribed } switch($PSCmdlet.ParameterSetName){ 'UpdateByWikiIdWikiPageIdIsSubscribed' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${wikipageid}/subscriptions.json" $method = 'PUT' $pageable = $False $restParams.Remove('wikiid') $restParams.Remove('wikipageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityWikiPageSubscription { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByWikiIdWikiPageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='CreateByWikiIdWikiPageId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiPageId, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('WikiPageId')) { $restParams['WikiPageId'] = $WikiPageId } switch($PSCmdlet.ParameterSetName){ 'CreateByWikiIdWikiPageId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/pages/${wikipageid}/subscriptions.json" $method = 'POST' $pageable = $False $restParams.Remove('wikiid') $restParams.Remove('wikipageid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityWiki { [CmdletBinding(SupportsShouldProcess = $true, SupportsPaging = $true)] param( [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeSubGroups, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid[]]$ApplicationIds, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$IncludeDisabled, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$PermissionId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$SortBy, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$UserId, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageSize, [Parameter(ParameterSetName='List1', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$PageIndex, [Parameter(ParameterSetName='ShowById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Guid]$ApplicationId, [Parameter(ParameterSetName='ShowByKeyGroupId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [Parameter(ParameterSetName='ShowByApplicationId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('IncludeSubGroups')) { $restParams['IncludeSubGroups'] = $IncludeSubGroups } if($PSBoundParameters.ContainsKey('ApplicationIds')) { $restParams['ApplicationIds'] = $ApplicationIds } if($PSBoundParameters.ContainsKey('IncludeDisabled')) { $restParams['IncludeDisabled'] = $IncludeDisabled } if($PSBoundParameters.ContainsKey('PermissionId')) { $restParams['PermissionId'] = $PermissionId } if($PSBoundParameters.ContainsKey('SortBy')) { $restParams['SortBy'] = $SortBy } if($PSBoundParameters.ContainsKey('UserId')) { $restParams['UserId'] = $UserId } if($PSBoundParameters.ContainsKey('PageSize')) { $restParams['PageSize'] = $PageSize } if($PSBoundParameters.ContainsKey('PageIndex')) { $restParams['PageIndex'] = $PageIndex } if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('ApplicationId')) { $restParams['ApplicationId'] = $ApplicationId } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } switch($PSCmdlet.ParameterSetName){ 'List1' { $endpoint= "api.ashx/v2/wikis.json" $method = 'GET' $pageable = $True } 'ShowById' { $endpoint= "api.ashx/v2/wikis/${id}.json" $method = 'GET' $pageable = $False $restParams.Remove('id') } 'ShowByApplicationId' { $endpoint= "api.ashx/v2/wikis/${applicationid}.json" $method = 'GET' $pageable = $False $restParams.Remove('applicationid') } 'ShowByKeyGroupId' { $endpoint= "api.ashx/v2/groups/${groupid}/wikis/${key}.json" $method = 'GET' $pageable = $False $restParams.Remove('groupid') $restParams.Remove('key') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function New-CommunityWiki { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='CreateByGroupIdName', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } switch($PSCmdlet.ParameterSetName){ 'CreateByGroupIdName' { $endpoint= "api.ashx/v2/wikis.json" $method = 'POST' $pageable = $False } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Set-CommunityWiki { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='UpdateById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$GroupId, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Name, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Description, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [string]$Key, [Parameter(ParameterSetName='UpdateById', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$Enabled, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } if($PSBoundParameters.ContainsKey('GroupId')) { $restParams['GroupId'] = $GroupId } if($PSBoundParameters.ContainsKey('Name')) { $restParams['Name'] = $Name } if($PSBoundParameters.ContainsKey('Description')) { $restParams['Description'] = $Description } if($PSBoundParameters.ContainsKey('Key')) { $restParams['Key'] = $Key } if($PSBoundParameters.ContainsKey('Enabled')) { $restParams['Enabled'] = $Enabled } switch($PSCmdlet.ParameterSetName){ 'UpdateById' { $endpoint= "api.ashx/v2/wikis/${id}.json" $method = 'PUT' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Remove-CommunityWiki { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='DeleteById', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$Id, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('Id')) { $restParams['Id'] = $Id } switch($PSCmdlet.ParameterSetName){ 'DeleteById' { $endpoint= "api.ashx/v2/wikis/${id}.json" $method = 'DELETE' $pageable = $False $restParams.Remove('id') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } function Get-CommunityWikiToc { [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [int]$WikiId, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [int]$WikiPageId, [Parameter(ParameterSetName='ShowByWikiId', Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [bool]$ShowHiddenPages, [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [CommunityCredential]$Credential, [string]$Impersonate ) process { $restParams = @{} if($PSBoundParameters.ContainsKey('WikiId')) { $restParams['WikiId'] = $WikiId } if($PSBoundParameters.ContainsKey('WikiPageId')) { $restParams['WikiPageId'] = $WikiPageId } if($PSBoundParameters.ContainsKey('ShowHiddenPages')) { $restParams['ShowHiddenPages'] = $ShowHiddenPages } switch($PSCmdlet.ParameterSetName){ 'ShowByWikiId' { $endpoint= "api.ashx/v2/wikis/${wikiid}/toc.json" $method = 'GET' $pageable = $False $restParams.Remove('wikiid') } } if($pageable) { $pagingSplat = @{} if($PSBoundParameters.ContainsKey('First')) { $pagingSplat['First'] = $PSCmdlet.PagingParameters.First } if($PSBoundParameters.ContainsKey('Skip')) { $pagingSplat['Skip'] = $PSCmdlet.PagingParameters.Skip } if($PSBoundParameters.ContainsKey('IncludeTotalCount')) { $pagingSplat['IncludeTotalCount'] = $PSCmdlet.PagingParameters.IncludeTotalCount } Invoke-CommunityRestPagedRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate ` @pagingSplat } else { Invoke-CommunityRestRequest ` -Endpoint $endpoint ` -Method $method ` -Parameter $restParams ` -Credential $Credential ` -Impersonate $Impersonate } } } Export-ModuleMember -Function Get-CommunityAbuseAppeal, Set-CommunityAbuseAppeal, New-CommunityAbuseReport, Get-CommunityAbuseReport, Set-CommunityAbuseReport, Get-CommunityAbusiveContent, Get-CommunityActivityMessage, Get-CommunityActivityStorySitePreference, Set-CommunityActivityStorySitePreference, Get-CommunityActivityStoryType, Get-CommunityActivityStoryUserPreference, Set-CommunityActivityStoryUserPreference, Get-CommunityAggregateTaggedContent, Remove-CommunityAggregateTag, Get-CommunityAggregateTag, Get-CommunityBlogContactRequest, New-CommunityBlogContactRequest, Get-CommunityBlogPost, New-CommunityBlogPost, Set-CommunityBlogPost, Remove-CommunityBlogPost, Get-CommunityBlogPostSubscription, Set-CommunityBlogPostSubscription, New-CommunityBlogPostSubscription, Get-CommunityBlogPostSummary, Get-CommunityBlog, New-CommunityBlog, Set-CommunityBlog, Remove-CommunityBlog, New-CommunityBookmark, Get-CommunityBookmark, Remove-CommunityBookmark, Get-CommunityCf, New-CommunityComment, Get-CommunityComment, Set-CommunityComment, Remove-CommunityComment, Get-CommunityContent, New-CommunityContentTag, Get-CommunityContentTag, Remove-CommunityContentTag, Set-CommunityContentTag, New-CommunityContentView, New-CommunityConversationMessage, Get-CommunityConversationMessage, Remove-CommunityConversationMessage, Remove-CommunityConversation, Get-CommunityEndpoint, Get-CommunityFeature, Get-CommunityFollower, Get-CommunityFollowing, New-CommunityFollowing, Remove-CommunityFollowing, Get-CommunityForumReply, New-CommunityForumReply, Set-CommunityForumReply, Remove-CommunityForumReply, Get-CommunityForum, New-CommunityForum, Set-CommunityForum, Remove-CommunityForum, Get-CommunityForumThread, New-CommunityForumThread, Set-CommunityForumThread, Remove-CommunityForumThread, New-CommunityFriendship, Get-CommunityFriendship, Remove-CommunityFriendship, Set-CommunityFriendship, Get-CommunityGallery, New-CommunityGallery, Set-CommunityGallery, Remove-CommunityGallery, Get-CommunityGroupAvatar, Set-CommunityGroupAvatar, Remove-CommunityGroupAvatar, Get-CommunityGroupContactRequest, New-CommunityGroupContactRequest, Remove-CommunityGroupContactRequest, Get-CommunityGroup, New-CommunityGroup, Set-CommunityGroup, Remove-CommunityGroup, Get-CommunityGroupUser, New-CommunityGroupUser, Remove-CommunityGroupUser, Get-CommunityHashTag, Get-CommunityInfo, New-CommunityLike, Get-CommunityLike, Remove-CommunityLike, New-CommunityMedia, Set-CommunityMedia, Remove-CommunityMedia, Get-CommunityMedia, Get-CommunityMediaSubscription, Set-CommunityMediaSubscription, New-CommunityMediaSubscription, Get-CommunityMentionable, Get-CommunityMention, Get-CommunityNodePermission, Get-CommunityNotificationDistributionType, Set-CommunityNotificationPreference, Get-CommunityNotificationPreference, Set-CommunityNotification, Get-CommunityNotification, Remove-CommunityNotification, Get-CommunityNotificationType, New-CommunityOAuth, Get-CommunityOAuth, Get-CommunityPermission, Get-CommunityRatedItem, New-CommunityRating, Get-CommunityRating, Remove-CommunityRating, New-CommunityReplyMessage, Remove-CommunityReplyMessage, Get-CommunityRole, New-CommunityRole, Set-CommunityRole, Remove-CommunityRole, Get-CommunitySearch, New-CommunitySearch, Set-CommunitySearch, Remove-CommunitySearch, New-CommunityStatusMessage, Get-CommunityStatusMessage, Remove-CommunityStatusMessage, Get-CommunityActivityStory, Remove-CommunityActivityStory, Get-CommunityUserAvatar, Set-CommunityUserAvatar, Remove-CommunityUserAvatar, Get-CommunityUserInvitation, New-CommunityUserInvitation, Set-CommunityUserInvitation, Get-CommunityUserPresence, Set-CommunityUserPresence, Get-CommunityUserProfileFieldGroup, Get-CommunityUserProfileField, New-CommunityUser, Get-CommunityUser, Set-CommunityUser, Remove-CommunityUser, New-CommunityUserValidation, New-CommunityWikiFile, Get-CommunityWikiPageCommentSubscription, New-CommunityWikiPageCommentSubscription, Set-CommunityWikiPageCommentSubscription, Get-CommunityWikiPageRevision, Remove-CommunityWikiPageRevision, Get-CommunityWikiPage, Set-CommunityWikiPage, New-CommunityWikiPage, Get-CommunityWikiPageSubscription, Set-CommunityWikiPageSubscription, New-CommunityWikiPageSubscription, Get-CommunityWiki, New-CommunityWiki, Set-CommunityWiki, Remove-CommunityWiki, Get-CommunityWikiToc |