From ae717441f39941c37b6f9b807e01e552ad7f1420 Mon Sep 17 00:00:00 2001 From: Mikey O'Toole Date: Mon, 1 Jun 2026 11:38:42 +0100 Subject: [PATCH 1/3] Add ExcludeSLA to Get-HaloTicket --- Public/Get/Get-HaloTicket.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Public/Get/Get-HaloTicket.ps1 b/Public/Get/Get-HaloTicket.ps1 index 8b5801b..47635af 100644 --- a/Public/Get/Get-HaloTicket.ps1 +++ b/Public/Get/Get-HaloTicket.ps1 @@ -76,6 +76,9 @@ function Get-HaloTicket { # Include next activity date in the results. [Parameter( ParameterSetName = 'Multi' )] [switch]$IncludeNextActivityDate, + # Exclude SLA calculations in the results. + [Parameter( ParameterSetName = 'Multi' )] + [switch]$ExcludeSLA, # Filter by the specified ticket area. [Parameter( ParameterSetName = 'Multi' )] [int32]$TicketAreaID, From c9c6c2f031f99b3cfffd0083d4ad019505ca5840 Mon Sep 17 00:00:00 2001 From: Mikey O'Toole Date: Mon, 1 Jun 2026 11:38:49 +0100 Subject: [PATCH 2/3] Fix Invoke-HaloRequest Fragment handling (#84) --- Public/Invoke/Invoke-HaloRequest.ps1 | 11 +++++++++-- Tests/HaloAPI.Unit.Tests.ps1 | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Public/Invoke/Invoke-HaloRequest.ps1 b/Public/Invoke/Invoke-HaloRequest.ps1 index d2a8f4f..f628bcc 100644 --- a/Public/Invoke/Invoke-HaloRequest.ps1 +++ b/Public/Invoke/Invoke-HaloRequest.ps1 @@ -46,9 +46,16 @@ function Invoke-HaloRequest { $Retries = 0 $BaseDelay = 5 # Base delay of 5 seconds $MaxDelay = 60 # Maximum delay of 60 seconds - # Check if $WebRequestParams contains a full URI, if not, append the base URL + $BaseUri = [System.Uri]$Script:HAPIConnectionInformation.URL + # Check for a fragment first so callers can supply just the path portion. + if ($WebRequestParams.Fragment) { + $WebRequestParams.Uri = [System.Uri]::new($BaseUri, $WebRequestParams.Fragment).AbsoluteUri + $WebRequestParams.Remove('Fragment') | Out-Null + } + + # Check if $WebRequestParams contains a full URI, if not, append the base URL. if (-not ([System.Uri]$WebRequestParams.Uri).IsAbsoluteUri) { - $WebRequestParams.Uri = $Script:HAPIConnectionInformation.URL + $WebRequestParams.Uri + $WebRequestParams.Uri = [System.Uri]::new($BaseUri, $WebRequestParams.Uri).AbsoluteUri } do { $Retries++ diff --git a/Tests/HaloAPI.Unit.Tests.ps1 b/Tests/HaloAPI.Unit.Tests.ps1 index 63d0832..b042970 100644 --- a/Tests/HaloAPI.Unit.Tests.ps1 +++ b/Tests/HaloAPI.Unit.Tests.ps1 @@ -267,6 +267,26 @@ Describe 'Invoke-HaloRequest' { } } + It 'resolves Fragment values against the base URL' { + Mock -CommandName 'Invoke-WebRequest' -ModuleName 'HaloAPI' -MockWith { + [pscustomobject]@{ Content = '{"ok":true}' } + } + + InModuleScope 'HaloAPI' { + $Result = Invoke-HaloRequest -WebRequestParams @{ + Method = 'POST' + Fragment = '/api/customtable' + } + + $Result.ok | Should -BeTrue + } + + Should -Invoke -CommandName 'Invoke-WebRequest' -ModuleName 'HaloAPI' -Times 1 -Exactly -ParameterFilter { + $Uri -eq 'https://example.halo/api/customtable' -and + -not $PSBoundParameters.ContainsKey('Fragment') + } + } + It 'returns the raw web response when RawResult is specified' { Mock -CommandName 'Invoke-WebRequest' -ModuleName 'HaloAPI' -MockWith { [pscustomobject]@{ Content = '{"ok":true}'; StatusCode = 200 } From 01a4f0a0df1f5c935544879faebd239aa8e4d7ef Mon Sep 17 00:00:00 2001 From: Mikey O'Toole Date: Mon, 22 Jun 2026 21:00:57 +0100 Subject: [PATCH 3/3] Update Connect-HaloAPI unit tests for renamed parameter and Key Vault behavior --- Tests/HaloAPI.Unit.Tests.ps1 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Tests/HaloAPI.Unit.Tests.ps1 b/Tests/HaloAPI.Unit.Tests.ps1 index 5c0db89..94c695e 100644 --- a/Tests/HaloAPI.Unit.Tests.ps1 +++ b/Tests/HaloAPI.Unit.Tests.ps1 @@ -998,9 +998,9 @@ Describe 'Connect-HaloAPI' { Mock -CommandName 'Get-AzKeyVaultSecret' -ModuleName 'HaloAPI' -MockWith { switch ($Name) { - 'halo_URL' { [pscustomobject]@{ SecretValueText = 'https://vault.example/' } } - 'halo_ClientID' { [pscustomobject]@{ SecretValueText = 'vault-client' } } - 'halo_ClientSecret' { [pscustomobject]@{ SecretValueText = 'vault-secret' } } + 'halo-URL' { 'https://vault.example/' } + 'halo-ClientID' { 'vault-client' } + 'halo-ClientSecret' { 'vault-secret' } } } @@ -1016,7 +1016,7 @@ Describe 'Connect-HaloAPI' { $Method -eq 'POST' } - $Result = Connect-HaloAPI -URL 'https://placeholder.example/' -ClientID 'unused' -ClientSecret 'unused' -Scopes 'all' -UseKeyVault $true -VaultName 'vault' -SecretName 'halo' -Identity 'mi-1' + $Result = Connect-HaloAPI -URL 'https://placeholder.example/' -ClientID 'unused' -ClientSecret 'unused' -Scopes 'all' -UseKeyVault $true -VaultName 'vault' -SecretName 'halo' -UseManagedIdentity $Result | Should -BeTrue Should -Invoke -CommandName 'Connect-AzAccount' -ModuleName 'HaloAPI' -Times 1 -Exactly -ParameterFilter { @@ -1054,20 +1054,20 @@ Describe 'Connect-HaloAPI' { $Method -eq 'POST' } - $Result = Connect-HaloAPI -URL 'https://example.halo/' -ClientID 'client-save' -ClientSecret 'secret-save' -Scopes 'all' -SaveToKeyVault $true -VaultName 'vault' -SecretName 'halo' -Identity 'mi-2' + $Result = Connect-HaloAPI -URL 'https://example.halo/' -ClientID 'client-save' -ClientSecret 'secret-save' -Scopes 'all' -SaveToKeyVault $true -VaultName 'vault' -SecretName 'halo' -UseManagedIdentity $Result | Should -BeTrue Should -Invoke -CommandName 'Connect-AzAccount' -ModuleName 'HaloAPI' -Times 1 -Exactly -ParameterFilter { $Identity } Should -Invoke -CommandName 'Set-AzKeyVaultSecret' -ModuleName 'HaloAPI' -Times 1 -Exactly -ParameterFilter { - $VaultName -eq 'vault' -and $Name -eq 'halo_URL' + $VaultName -eq 'vault' -and $Name -eq 'halo-URL' } Should -Invoke -CommandName 'Set-AzKeyVaultSecret' -ModuleName 'HaloAPI' -Times 1 -Exactly -ParameterFilter { - $VaultName -eq 'vault' -and $Name -eq 'halo_ClientID' + $VaultName -eq 'vault' -and $Name -eq 'halo-ClientID' } Should -Invoke -CommandName 'Set-AzKeyVaultSecret' -ModuleName 'HaloAPI' -Times 1 -Exactly -ParameterFilter { - $VaultName -eq 'vault' -and $Name -eq 'halo_ClientSecret' + $VaultName -eq 'vault' -and $Name -eq 'halo-ClientSecret' } } @@ -1078,9 +1078,9 @@ Describe 'Connect-HaloAPI' { Mock -CommandName 'Get-AzKeyVaultSecret' -ModuleName 'HaloAPI' -MockWith { switch ($Name) { - 'halo_URL' { [pscustomobject]@{ SecretValueText = 'https://interactive.example/' } } - 'halo_ClientID' { [pscustomobject]@{ SecretValueText = 'interactive-client' } } - 'halo_ClientSecret' { [pscustomobject]@{ SecretValueText = 'interactive-secret' } } + 'halo-URL' { 'https://interactive.example/' } + 'halo-ClientID' { 'interactive-client' } + 'halo-ClientSecret' { 'interactive-secret' } } }