Skip to content

Commit

Permalink
Merged PR 46: 1.14.0
Browse files Browse the repository at this point in the history
Related work items: #25
  • Loading branch information
homotechsual committed Mar 10, 2023
2 parents ba7f1ea + 7484f07 commit be772db
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .vscode/ltex.dictionary.en-GB.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmdlets
HaloAPI
1 change: 1 addition & 0 deletions .vscode/ltex.dictionary.en-US.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Changelog
1 change: 1 addition & 0 deletions .vscode/ltex.hiddenFalsePositives.en-GB.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rule":"EN_A_VS_AN","sentence":"^\\QSwitch from using \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q to \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q to fix the actual issue in GitHub #1\nAdd an \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q parameter to \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q for non-standard authentication routes.\\E$"}
11 changes: 6 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"PWSH",
"Testand"
]
{
"cSpell.words": [
"authinfo",
"PWSH",
"Testand"
]
}
107 changes: 74 additions & 33 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,107 @@
# Changelog

* 2022-02-06
## 2023-03-10 - Version 1.14.0

Version 1.7.0 - Refactored error handling.
* Add Custom Table endpoints `Get-HaloCustomTable`, `New-HaloCustomTable`, `Remove-HaloCustomTable`.

* 2022-02-03
## 2023-01-01 - Version 1.13.2

* Fix incorrect pluralization of `Get-HaloCustomField`.
* Changes to pipeline and release process.

## 2023-01-01 - Version 1.13.1

* Added `IncludeTenants` Switch to `Get-HaloAzureADConnection` to fix Contact sync script.

Version 1.7.0-beta1 - Fixed authentication bug - Fixed token expiry calculation.
## 2022-11-18 - Version 1.13.0

* 2022-01-04
* Adds `Recover-HaloTicket` and `-Deleted` parameter for `Get-HaloTicket`.
* Fix `429` (API rate limiting) response handling.
* Refactor of 429 error handling.
* Increase batch wait to 30 seconds.
* Adds `Remove-HaloItem`.

Version 1.5.0 - New Feature: Added Workday functions
## 2022-09-16 - Version 1.11.1

* 2021-11-11
* Fix for `PostedOnly` and `NonPostedOnly` parameters on `Get-HaloInvoice`.

Version 1.4.0 - Fixed: Bug in Get-HaloAsset where some parameters were in the incorrect set. - Fixed: Bug in the token expiry calculation causing too many reconnects. - Fixed: Bug in authentication to trial instances. - Fixed: Bug in billing templates. - New Feature: Added Recurring invoice functions.
## 2022-07-02 - Version 1.10.1

* 2021-09-03
* Fix incorrect bug fix reversion affecting batch cmdlets.

Version 1.3.0-Beta5 - Fixes the authentication flow for trial instances. Starts adding pipeline support (Tickets/Actions currently).
## 2022-07-01 - Version 1.10.0

* 2021-08-25
* Internal contract change, `Invoke-HaloBatchProcessor` now uses `BatchInput` instead of `Input`. Bugfixes for batch processing.

Version 1.3.0-Beta4 - Uses the `api/authinfo` endpoint to dynamically populate the Authentication URL for all requests now.
## 2022-06-21 - Version 1.9.1

* 2021-08-25
* Add `-FullObject` parameter for Sites, batch processing for Actions, Workflows, Custom Fields and expose `Invoke-HaloRequest` for ad hoc requests.

Version 1.3.0-Beta3 - Handle `-AuthURL` with or without a path.
## 2022-03-23 - Version 1.9.0

* 2021-08-25
* Adds Software Licences, Asset Types and new automated tests.

Version 1.3.0-Beta2 - Switch from using `-AuthPath` to `-AuthURL` to fix the actual issue in GitHub #1
## 2022-03-15 - Version 1.8.0

* 2021-08-25
* Handle arrays of objects for many New/Set commands.

Version 1.3.0-Beta1 - Add an `-AuthPath` parameter to Connect-HaloAPI for non-standard authentication routes.
## 2022-02-06 - Version 1.7.0

* 2021-08-24
* Refactored error handling.

Version 1.2.3 - Fix misnamed function invocation in `Get-HaloClient`.
## 2022-01-04 - Version 1.5.0

* 2021-08-24
* New Feature: Added Workday functions

Version 1.2.2 - Remove the attempt to load the `HaloLookup` class in HaloAPI.psm1 as it's not used.
## 2021-11-11 - Version 1.4.0

* 2021-08-23
* Fixed: Bug in `Get-HaloAsset` where some parameters were in the incorrect set.
* Fixed: Bug in the token expiry calculation causing too many reconnects.
* Fixed: Bug in authentication to trial instances.
* Fixed: Bug in billing templates.
* New Feature: Added Recurring invoice functions.

Version 1.2.1 - Adds missing classes which were erroneously excluded from the build script.
## 2021-10-01 - Version 1.3.2

* 2021-08-22
* Fixed: Token expiry calculation is now correct.

Version 1.2.0 - Changes to error handling for more descriptive and reliable error messages. - Adds validation and dynamic completion classes for Lookups, Custom Button types and Scopes. - Add Custom Buttons endpoint.
## 2021-10-01 - Version 1.3.1

* 2021-08-12
* Fixes the authentication flow for trial instances. Starts adding pipeline support (Tickets/Actions currently).
* Uses the `api/authinfo` endpoint to dynamically populate the Authentication URL for all requests now.
* Handle `-AuthURL` with or without a path.
* Switch from using `-AuthPath` to `-AuthURL` to fix the actual issue in GitHub #1
* Add an `-AuthPath` parameter to `Connect-HaloAPI` for non-standard authentication routes.

Version 1.1.0 - Change to output formats - now outputs the objects/results directly. No more `(Get-HaloAction).actions`. - Add the first two `Remove-` commands. - Leaner more efficient core.
## 2021-08-24 - Version 1.2.3

* 2021-08-11
* Fix misnamed function invocation in `Get-HaloClient`.

Version 1.0.2 - Fix a bug with `Get-HaloAsset` when supplying the `AssetID` parameter.
## 2021-08-24 - Version 1.2.2

* 2021-08-08

Version 1.0.1 - Initial release of the HaloAPI PowerShell module.
* Remove the attempt to load the `HaloLookup` class in `HaloAPI.psm1` as it's not used.

## 2021-08-23 - Version 1.2.1

* Adds missing classes which were erroneously excluded from the build script.

## 2021-08-22 - Version 1.2.0

* Changes to error handling for more descriptive and reliable error messages.
* Adds validation and dynamic completion classes for Lookups, Custom Button types and Scopes.
* Add Custom Buttons endpoint.

## 2021-08-12 - Version 1.1.0

* Change to output formats - now outputs the objects/results directly. No more `(Get-HaloAction).actions`.
* Add the first two `Remove-` commands.
* Leaner more efficient core.

## 2021-08-11 - Version 1.0.2

* Fix a bug with `Get-HaloAsset` when supplying the `AssetID` parameter.

## 2021-08-08 - Version 1.0.1

* Initial release of the HaloAPI PowerShell module.

14 changes: 9 additions & 5 deletions HaloAPI.build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#
.SYNOPSIS
Build script for HaloAPI module - uses 'Invoke-Build' https://github.com/nightroman/Invoke-Build
Homotechsual portable module build script.
#>
Param (
[String]$Configuration = 'Development',
Expand Down Expand Up @@ -32,8 +32,12 @@ if ($CopyModuleFiles) {
if (-not (Test-Path "$($PSScriptRoot)\Output\$ModuleName")) {
New-Item -Path "$($PSScriptRoot)\Output\$ModuleName" -ItemType Directory | Out-Null
}
Copy-Item -Path "$($PSScriptRoot)\Classes\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force
Copy-Item -Path "$($PSScriptRoot)\Data\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force
if (Test-Path -Path "$($PSScriptRoot)\Classes\") {
Copy-Item -Path "$($PSScriptRoot)\Classes\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force
}
if (Test-Path -Path "$($PSScriptRoot)\Data\") {
Copy-Item -Path "$($PSScriptRoot)\Data\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force
}
Copy-Item -Path "$($PSScriptRoot)\Private\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force
Copy-Item -Path "$($PSScriptRoot)\Public\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force

Expand All @@ -42,8 +46,8 @@ if ($CopyModuleFiles) {
"$($PSScriptRoot)\LICENSE.md"
"$($PSScriptRoot)\CHANGELOG.md"
"$($PSScriptRoot)\README.md"
"$($PSScriptRoot)\HaloAPI.psd1"
"$($PSScriptRoot)\HaloAPI.psm1"
"$($PSScriptRoot)\$ModuleName.psd1"
"$($PSScriptRoot)\$ModuleName.psm1"
) -Destination "$($PSScriptRoot)\Output\$ModuleName" -Force
}

Expand Down
9 changes: 6 additions & 3 deletions HaloAPI.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = '.\HaloAPI.psm1'

# Version number of this module.
ModuleVersion = '1.13.2'
ModuleVersion = '1.14.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -86,6 +86,7 @@
'Get-HaloCRMNote',
'Get-HaloCustomButton',
'Get-HaloCustomField',
'Get-HaloCustomTable',
'Get-HaloFAQList',
'Get-HaloField',
'Get-HaloInvoice',
Expand Down Expand Up @@ -136,6 +137,7 @@
'New-HaloCRMNote',
'New-HaloCustomButton',
'New-HaloCustomField',
'New-HaloCustomTable',
'New-HaloCustomFieldBatch',
'New-HaloFAQList',
'New-HaloInvoice',
Expand Down Expand Up @@ -185,6 +187,7 @@
'Remove-HaloContract',
'Remove-HaloCRMNote',
'Remove-HaloItem',
'Remove-HaloKBArticle',
'Remove-HaloTicket',
'Remove-HaloTicketBatch',
'Remove-HaloTicketRules',
Expand Down Expand Up @@ -231,7 +234,7 @@
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'
VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = 'Get-HaloArticle', 'New-HaloArticle', 'Set-HaloArticle', 'New-HaloArticleBatch', 'Get-HaloCustomFields', 'Get-HaloWorkflows', 'Get-HaloTabs'
Expand Down Expand Up @@ -263,7 +266,7 @@
IconUri = 'https://3c3br937rz386088k2z3qqdi-wpengine.netdna-ssl.com/wp-content/uploads/2020/04/HaloIcon-300x300.png'

# ReleaseNotes of this module
ReleaseNotes = 'Bugfixes and improvements.'
ReleaseNotes = 'Add Custom Table endpoints.'

# Prerelease string of this module
# Prerelease = 'Beta5'
Expand Down
47 changes: 47 additions & 0 deletions Public/Get/Get-HaloCustomTable.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#Requires -Version 7
function Get-HaloCustomTable {
<#
.SYNOPSIS
Gets custom tables from the Halo API.
.DESCRIPTION
Retrieves custom tables from the Halo API - supports a variety of filtering parameters.
.OUTPUTS
A powershell object containing the response.
#>
[CmdletBinding( DefaultParameterSetName = 'Multi' )]
[OutputType([Object])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'Uses dynamic parameter parsing.')]
Param(
# Custom Table ID.
[Parameter( ParameterSetName = 'Single', Mandatory = $True )]
[int64]$CustomTableId
)
Invoke-HaloPreFlightCheck
$CommandName = $MyInvocation.MyCommand.Name
$Parameters = (Get-Command -Name $CommandName).Parameters
# Workaround to prevent the query string processor from adding an 'customtableid=' parameter by removing it from the set parameters.
if ($CustomTableId) {
$Parameters.Remove('CustomTableId') | Out-Null
}
$QSCollection = New-HaloQuery -CommandName $CommandName -Parameters $Parameters
try {
if ($AgentID) {
Write-Verbose "Running in single-custom table mode because '-CustomTableId' was provided."
$Resource = "api/customtable/$($CustomTableId)"
} else {
Write-Verbose 'Running in multi-custom button mode.'
$Resource = 'api/customtable'
}
$RequestParams = @{
Method = 'GET'
Resource = $Resource
AutoPaginateOff = $True
QSCollection = $QSCollection
ResourceType = 'customtables'
}
$CustomTableResults = New-HaloGETRequest @RequestParams
Return $CustomTableResults
} catch {
New-HaloError -ErrorRecord $_
}
}
25 changes: 25 additions & 0 deletions Public/New/New-HaloCustomTable.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Function New-HaloCustomTable {
<#
.SYNOPSIS
Creates a custom table via the Halo API.
.DESCRIPTION
Function to send a custom table creation request to the Halo API
.OUTPUTS
Outputs an object containing the response from the web request.
#>
[CmdletBinding( SupportsShouldProcess = $True )]
[OutputType([Object])]
Param (
# Object containing properties and values used to create a new custom table.
[Parameter( Mandatory = $True )]
[Object]$CustomTable
)
Invoke-HaloPreFlightCheck
try {
if ($PSCmdlet.ShouldProcess("Custom Table '$($CustomTable.ctname)'", 'Create')) {
New-HaloPOSTRequest -Object $CustomTable -Endpoint 'customtable'
}
} catch {
New-HaloError -ErrorRecord $_
}
}
33 changes: 33 additions & 0 deletions Public/Remove/Remove-HaloKBArticle.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function Remove-HaloKBArticle {
<#
.SYNOPSIS
Removes a knowledgebase articles from the Halo API.
.DESCRIPTION
Deletes a specific knowledgebase articles from Halo.
.OUTPUTS
A powershell object containing the response.
#>
[cmdletbinding( SupportsShouldProcess = $True, ConfirmImpact = 'High' )]
[OutputType([Object])]
Param(
# The KBArticle ID
[Parameter( Mandatory = $True )]
[Alias('KBArticle')]
[int64]$KBArticleID
)
Invoke-HaloPreFlightCheck
try {
$ObjectToDelete = Get-HaloKBArticle -KBArticleID $KBArticleID
if ($ObjectToDelete) {
if ($PSCmdlet.ShouldProcess("KBArticleID '$($ObjectToDelete.name)')'", 'Delete')) {
$Resource = "api/KBArticle/$($KBArticleID)"
$ClientResults = New-HaloDELETERequest -Resource $Resource
Return $ClientResults
}
} else {
Throw 'Knowledgebase article was not found in Halo to delete.'
}
} catch {
New-HaloError -ErrorRecord $_
}
}

0 comments on commit be772db

Please sign in to comment.