public/Get-VSAWorkOrders.ps1
function Get-VSAWorkOrders { <# .Synopsis Returns all WorkOrders .DESCRIPTION Returns all WorkOrders for the given customer Id and within the scope of the sessionId. Takes either persistent or non-persistent connection information. .PARAMETER VSAConnection Specifies existing non-persistent VSAConnection. .PARAMETER URISuffix Specifies URI suffix if it differs from the default. .PARAMETER CustomerId Specifies id of the customer. .PARAMETER Filter Specifies REST API Filter. .PARAMETER Paging Specifies REST API Paging. .PARAMETER Sort Specifies REST API Sorting. .EXAMPLE Get-VSAWorkOrders -CustomerId 34243223232 .EXAMPLE Get-VSACustomers -VSAConnection $connection -CustomerId 34243223232 .INPUTS Accepts piped non-persistent VSAConnection .OUTPUTS Array of items that represent workOrders #> [CmdletBinding()] param ( [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'NonPersistent')] [VSAConnection] $VSAConnection, [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ParameterSetName = 'NonPersistent')] [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ParameterSetName = 'Persistent')] [ValidateNotNullOrEmpty()] [string] $URISuffix = 'api/v1.0/system/customers/{0}/workorders', [ValidateNotNullOrEmpty()] [parameter(ParameterSetName = 'Persistent', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [parameter(ParameterSetName = 'NonPersistent', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $CustomerId, [Parameter(ParameterSetName = 'Persistent', Mandatory = $false)] [Parameter(ParameterSetName = 'NonPersistent', Mandatory = $false)] [ValidateNotNullOrEmpty()] [string] $Filter, [Parameter(ParameterSetName = 'Persistent', Mandatory = $false)] [Parameter(ParameterSetName = 'NonPersistent', Mandatory = $false)] [ValidateNotNullOrEmpty()] [string] $Paging, [Parameter(ParameterSetName = 'Persistent', Mandatory = $false)] [Parameter(ParameterSetName = 'NonPersistent', Mandatory = $false)] [ValidateNotNullOrEmpty()] [string] $Sort ) $URISuffix = $URISuffix -f $CustomerId [hashtable]$Params =@{ URISuffix = $URISuffix } if($VSAConnection) {$Params.Add('VSAConnection', $VSAConnection)} if($Filter) {$Params.Add('Filter', $Filter)} if($Paging) {$Params.Add('Paging', $Paging)} if($Sort) {$Params.Add('Sort', $Sort)} return Get-VSAItems @Params } Export-ModuleMember -Function Get-VSAWorkOrders |