Public/Get-JoinableCollection.ps1
|
<# .SYNOPSIS Gets joinable collections from the Fortytwo Collections API. .DESCRIPTION This function retrieves joinable collections from the Fortytwo Collections API. It supports pagination to handle large result sets. #> function Get-JoinableCollection { [CmdletBinding(DefaultParameterSetName = "Default")] param ( [Parameter(Mandatory = $true, ParameterSetName = "Single", ValueFromPipeline = $true)] [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", ErrorMessage = "Id must be a valid GUID.")] # Is a guid connector object id [string] $Id ) process { if (-not $Script:APIRoot -or -not $Script:AccessTokenProfile) { throw "Not connected to Fortytwo Collections. Please run Connect-Collections first." } if ($PSCmdlet.ParameterSetName -eq "Single") { Write-Verbose "Getting Joinable Collection with Id: $Id" Get-CollectionObject -CollectionType "collections-joinable" -Id $Id } else { Get-CollectionObject -CollectionType "collections-joinable" } } } |