Public/Get-GCFlows.ps1
|
<# .SYNOPSIS Retrieves a list of flows from Genesys Cloud. .DESCRIPTION Queries the Genesys Cloud API to retrieve a paginated list of architect flows. Supports filtering by name, type, description, and sorting options. API Endpoint: GET /api/v2/flows .PARAMETER PageSize The number of results per page. Default is 25. .PARAMETER PageNumber The page number to retrieve. Default is 1. .PARAMETER SortBy The field to sort results by. .PARAMETER SortOrder The sort order for results. Valid values are 'asc' or 'desc'. .PARAMETER Name An array of flow names to filter by. Supports partial matching. .PARAMETER Type An array of flow types to filter by (e.g., 'inboundcall', 'inboundemail', 'outboundcall'). .PARAMETER Description Filter flows by description text. .EXAMPLE Get-GCFlows Retrieves the first page of flows with default page size. .EXAMPLE Get-GCFlows -PageSize 50 -Type @('inboundcall') -Name @('Main IVR') Retrieves inbound call flows matching the name 'Main IVR'. .NOTES Genesys Cloud API: GET /api/v2/flows #> function Get-GCFlows { [CmdletBinding()] param( [Parameter(Mandatory = $false)] [int]$PageSize = 25, [Parameter(Mandatory = $false)] [int]$PageNumber = 1, [Parameter(Mandatory = $false)] [string]$SortBy, [Parameter(Mandatory = $false)] [string]$SortOrder, [Parameter(Mandatory = $false)] [string[]]$Name, [Parameter(Mandatory = $false)] [string[]]$Type, [Parameter(Mandatory = $false)] [string]$Description ) $queryParams = @{ pageSize = $PageSize pageNumber = $PageNumber } if ($SortBy) { $queryParams['sortBy'] = $SortBy } if ($SortOrder) { $queryParams['sortOrder'] = $SortOrder } if ($Name) { $queryParams['name'] = $Name -join ',' } if ($Type) { $queryParams['type'] = $Type -join ',' } if ($Description) { $queryParams['description'] = $Description } $endpoint = "flows" return Invoke-GCApiRequest -Endpoint $endpoint -Method GET -QueryParameters $queryParams } |