Skip to content

Commit b709978

Browse files
committed
PowerShell 7.4.0 compatibility. Version 1.16.0.
1 parent 1361dc9 commit b709978

File tree

8 files changed

+53
-279
lines changed

8 files changed

+53
-279
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 2023-11-17 - Version 1.16.0
4+
5+
* Refactor variables in `Invoke-HaloRequest` to avoid scope confusion.
6+
* Now compatible with PowerShell 7.4.0.
7+
38
## 2023-10-23 - Version 1.15.0
49

510
* Overhaul retry handling to increase delay between subsequent retries.

HaloAPI.psd1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99
@{
1010

1111
# Script module or binary module file associated with this manifest.
12-
RootModule = '.\HaloAPI.psm1'
12+
RootModule = '.\HaloAPI.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.15.0'
15+
ModuleVersion = '1.16.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
1919

2020
# ID used to uniquely identify this module
21-
GUID = '8bc83215-4735-4029-9f40-e05fe3e8f73b'
21+
GUID = '8bc83215-4735-4029-9f40-e05fe3e8f73b'
2222

2323
# Author of this module
24-
Author = 'Mikey O''Toole / Luke Whitelock'
24+
Author = 'Mikey O''Toole / Luke Whitelock'
2525

2626
# Company or vendor of this module
27-
CompanyName = 'Unknown'
27+
CompanyName = 'Unknown'
2828

2929
# Copyright statement for this module
30-
Copyright = '(c) 2021 Mikey O''Toole & Luke Whitelock. All rights reserved.'
30+
Copyright = '(c) 2021 Mikey O''Toole & Luke Whitelock. All rights reserved.'
3131

3232
# Description of the functionality provided by this module
33-
Description = 'This module provides an interface to the Halo API.'
33+
Description = 'This module provides an interface to the Halo API.'
3434

3535
# Minimum version of the PowerShell engine required by this module
3636
PowerShellVersion = '7.0'
@@ -227,8 +227,8 @@
227227
'Set-HaloWorkday',
228228
'New-HaloTab',
229229
'Get-HaloTabs',
230-
'Get-HaloOutcome',
231-
'New-HaloOutcome'
230+
'Get-HaloOutcome',
231+
'New-HaloOutcome'
232232
)
233233

234234

@@ -268,7 +268,7 @@
268268
IconUri = 'https://3c3br937rz386088k2z3qqdi-wpengine.netdna-ssl.com/wp-content/uploads/2020/04/HaloIcon-300x300.png'
269269

270270
# ReleaseNotes of this module
271-
ReleaseNotes = 'Overhaul retry handling. Add new endpoints - thanks to Mendy and Ceej for the help'
271+
ReleaseNotes = 'Refactor `Invoke-HaloRequest` to avoid reusing variable names and keep the scope clearer. Fixes breakage with PowerShell 7.4.0.'
272272

273273
# Prerelease string of this module
274274
# Prerelease = 'Beta1'
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using namespace System.Management.Automation
2-
3-
function Invoke-HaloPreFlightCheck {
4-
if ($null -eq $Script:HAPIConnectionInformation) {
5-
$NoConnectionInformationException = [System.Exception]::New("Missing Halo connection information, please run 'Connect-HaloAPI' first.")
6-
$ErrorRecord = [ErrorRecord]::New($NoConnectionInformationException, 'NoConnectionInformation', 'AuthenticationError', 'HaloPreFlightCheck')
7-
8-
$PSCmdlet.ThrowTerminatingError($ErrorRecord)
9-
}
10-
if (($null -eq $Script:HAPIAuthToken) -and ($null -eq $AllowAnonymous)) {
11-
$NoAuthTokenException = [System.Exception]::New("Missing Halo authentication token, please run 'Connect-HaloAPI' first.")
12-
$ErrorRecord = [ErrorRecord]::New($NoAuthTokenException, 'NoAuthToken', 'AuthenticationError', 'HaloPreFlightCheck')
13-
14-
$PSCmdlet.ThrowTerminatingError($ErrorRecord)
15-
}
1+
using namespace System.Management.Automation
2+
3+
function Invoke-HaloPreFlightCheck {
4+
if ($null -eq $Script:HAPIConnectionInformation) {
5+
$NoConnectionInformationException = [System.Exception]::New("Missing Halo connection information, please run 'Connect-HaloAPI' first.")
6+
$ErrorRecord = [ErrorRecord]::New($NoConnectionInformationException, 'NoConnectionInformation', 'AuthenticationError', 'HaloPreFlightCheck')
7+
8+
$PSCmdlet.ThrowTerminatingError($ErrorRecord)
9+
}
10+
if (($null -eq $Script:HAPIAuthToken) -and ($null -eq $AllowAnonymous)) {
11+
$NoAuthTokenException = [System.Exception]::New("Missing Halo authentication token, please run 'Connect-HaloAPI' first.")
12+
$ErrorRecord = [ErrorRecord]::New($NoAuthTokenException, 'NoAuthToken', 'AuthenticationError', 'HaloPreFlightCheck')
13+
14+
$PSCmdlet.ThrowTerminatingError($ErrorRecord)
15+
}
1616
}

Private/New-HaloGETRequest.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ function New-HaloGETRequest {
4242
} elseif ((-not $QSCollection.pageinate) -and ($QSCollection.page_size)) {
4343
$QSCollection.Remove('page_size')
4444
}
45+
if (-not $RawResult) {
46+
$RawResult = $False
47+
}
4548
if ($QSCollection) {
46-
Write-Debug "Query string in New-HaloGETRequest contains: $($QSCollection | Out-String)"
49+
Write-Debug "Query string collection in New-HaloGETRequest contains: $($QSCollection | Out-String)"
4750
$QueryStringCollection = [system.web.httputility]::ParseQueryString([string]::Empty)
4851
Write-Verbose 'Building [HttpQSCollection] for New-HaloGETRequest'
4952
foreach ($Key in $QSCollection.Keys) {

0 commit comments

Comments
 (0)