Skip to content

Commit

Permalink
PowerShell 7.4.0 compatibility. Version 1.16.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
homotechsual committed Nov 17, 2023
1 parent 1361dc9 commit b709978
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 279 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2023-11-17 - Version 1.16.0

* Refactor variables in `Invoke-HaloRequest` to avoid scope confusion.
* Now compatible with PowerShell 7.4.0.

## 2023-10-23 - Version 1.15.0

* Overhaul retry handling to increase delay between subsequent retries.
Expand Down
20 changes: 10 additions & 10 deletions HaloAPI.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@
@{

# Script module or binary module file associated with this manifest.
RootModule = '.\HaloAPI.psm1'
RootModule = '.\HaloAPI.psm1'

# Version number of this module.
ModuleVersion = '1.15.0'
ModuleVersion = '1.16.0'

# Supported PSEditions
# CompatiblePSEditions = @()

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

# Author of this module
Author = 'Mikey O''Toole / Luke Whitelock'
Author = 'Mikey O''Toole / Luke Whitelock'

# Company or vendor of this module
CompanyName = 'Unknown'
CompanyName = 'Unknown'

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

# Description of the functionality provided by this module
Description = 'This module provides an interface to the Halo API.'
Description = 'This module provides an interface to the Halo API.'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '7.0'
Expand Down Expand Up @@ -227,8 +227,8 @@
'Set-HaloWorkday',
'New-HaloTab',
'Get-HaloTabs',
'Get-HaloOutcome',
'New-HaloOutcome'
'Get-HaloOutcome',
'New-HaloOutcome'
)


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

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

# Prerelease string of this module
# Prerelease = 'Beta1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using namespace System.Management.Automation

function Invoke-HaloPreFlightCheck {
if ($null -eq $Script:HAPIConnectionInformation) {
$NoConnectionInformationException = [System.Exception]::New("Missing Halo connection information, please run 'Connect-HaloAPI' first.")
$ErrorRecord = [ErrorRecord]::New($NoConnectionInformationException, 'NoConnectionInformation', 'AuthenticationError', 'HaloPreFlightCheck')

$PSCmdlet.ThrowTerminatingError($ErrorRecord)
}
if (($null -eq $Script:HAPIAuthToken) -and ($null -eq $AllowAnonymous)) {
$NoAuthTokenException = [System.Exception]::New("Missing Halo authentication token, please run 'Connect-HaloAPI' first.")
$ErrorRecord = [ErrorRecord]::New($NoAuthTokenException, 'NoAuthToken', 'AuthenticationError', 'HaloPreFlightCheck')

$PSCmdlet.ThrowTerminatingError($ErrorRecord)
}
using namespace System.Management.Automation

function Invoke-HaloPreFlightCheck {
if ($null -eq $Script:HAPIConnectionInformation) {
$NoConnectionInformationException = [System.Exception]::New("Missing Halo connection information, please run 'Connect-HaloAPI' first.")
$ErrorRecord = [ErrorRecord]::New($NoConnectionInformationException, 'NoConnectionInformation', 'AuthenticationError', 'HaloPreFlightCheck')

$PSCmdlet.ThrowTerminatingError($ErrorRecord)
}
if (($null -eq $Script:HAPIAuthToken) -and ($null -eq $AllowAnonymous)) {
$NoAuthTokenException = [System.Exception]::New("Missing Halo authentication token, please run 'Connect-HaloAPI' first.")
$ErrorRecord = [ErrorRecord]::New($NoAuthTokenException, 'NoAuthToken', 'AuthenticationError', 'HaloPreFlightCheck')

$PSCmdlet.ThrowTerminatingError($ErrorRecord)
}
}
5 changes: 4 additions & 1 deletion Private/New-HaloGETRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ function New-HaloGETRequest {
} elseif ((-not $QSCollection.pageinate) -and ($QSCollection.page_size)) {
$QSCollection.Remove('page_size')
}
if (-not $RawResult) {
$RawResult = $False
}
if ($QSCollection) {
Write-Debug "Query string in New-HaloGETRequest contains: $($QSCollection | Out-String)"
Write-Debug "Query string collection in New-HaloGETRequest contains: $($QSCollection | Out-String)"
$QueryStringCollection = [system.web.httputility]::ParseQueryString([string]::Empty)
Write-Verbose 'Building [HttpQSCollection] for New-HaloGETRequest'
foreach ($Key in $QSCollection.Keys) {
Expand Down
Loading

0 comments on commit b709978

Please sign in to comment.