Public/Get-Biller.ps1
|
function Get-Biller { <# .SYNOPSIS Retrieves biller entries. .DESCRIPTION Gets one or more billers from the data store. Can filter by name or ID. .PARAMETER Name Filter billers by name. .PARAMETER Id Get a specific biller by ID. .PARAMETER Budget Optional budget name to target. Uses active budget if not specified. .PARAMETER DataPath Optional custom path for data storage. Overrides budget-based paths. .EXAMPLE Get-Biller .EXAMPLE Get-Biller -Name "Electric Bill" .EXAMPLE Get-Biller -Budget "japan-holiday-2026" .OUTPUTS Array of Biller objects #> [CmdletBinding(DefaultParameterSetName = 'All')] param( [Parameter(ParameterSetName = 'ByName')] [string]$Name, [Parameter(ParameterSetName = 'ById')] [string]$Id, [Parameter()] [string]$Budget, [Parameter()] [string]$DataPath ) $resolvedPath = Resolve-DataPath -DataPath $DataPath -Budget $Budget if (-not $resolvedPath) { return @() } $billers = Read-EntityData -EntityType 'Biller' -DataPath $resolvedPath if ($PSCmdlet.ParameterSetName -eq 'ByName') { $billers = $billers | Where-Object { $_.Name -like "*$Name*" } } elseif ($PSCmdlet.ParameterSetName -eq 'ById') { $billers = $billers | Where-Object { $_.Id -eq $Id } } return $billers } |