diff --git a/Public/Remove/Remove-HaloAppointment.ps1 b/Public/Remove/Remove-HaloAppointment.ps1 new file mode 100644 index 0000000..7316ecd --- /dev/null +++ b/Public/Remove/Remove-HaloAppointment.ps1 @@ -0,0 +1,38 @@ +function Remove-HaloAppointment { + <# + .SYNOPSIS + Removes an Appointment from the Halo API. + .DESCRIPTION + Deletes a specific Appointment from Halo. + .OUTPUTS + A powershell object containing the response. + #> + [cmdletbinding( SupportsShouldProcess = $True, ConfirmImpact = 'High' )] + [OutputType([Object])] + Param( + # The Appointment ID + [Parameter( Mandatory, ParameterSetName = 'Single' )] + [int64]$AppointmentID, + # Object containing Appointment id and ticket id for batch processing. + [Parameter( Mandatory, ParameterSetName = 'Batch')] + [Object]$Appointment + ) + Invoke-HaloPreFlightCheck + try { + if ($Appointment) { + $AppointmentID = $Appointment.Id + } + $ObjectToDelete = Get-HaloAppointment -AppointmentID $AppointmentID + if ($ObjectToDelete) { + if ($PSCmdlet.ShouldProcess("Appointment '$($ObjectToDelete.id)' by '$($ObjectToDelete.who)'", 'Delete')) { + $Resource = "api/Appointment/$($AppointmentID)" + $AppointmentResults = New-HaloDELETERequest -Resource $Resource + Return $AppointmentResults + } + } else { + Throw 'Appointment was not found in Halo to delete.' + } + } catch { + New-HaloError -ErrorRecord $_ + } +} \ No newline at end of file diff --git a/Public/Remove/Remove-HaloAsset.ps1 b/Public/Remove/Remove-HaloAsset.ps1 new file mode 100644 index 0000000..315cf3e --- /dev/null +++ b/Public/Remove/Remove-HaloAsset.ps1 @@ -0,0 +1,38 @@ +function Remove-HaloAsset { + <# + .SYNOPSIS + Removes an Asset from the Halo API. + .DESCRIPTION + Deletes a specific Asset from Halo. + .OUTPUTS + A powershell object containing the response. + #> + [cmdletbinding( SupportsShouldProcess = $True, ConfirmImpact = 'High' )] + [OutputType([Object])] + Param( + # The Asset ID + [Parameter( Mandatory, ParameterSetName = 'Single' )] + [int64]$AssetID, + # Object containing Asset id and ticket id for batch processing. + [Parameter( Mandatory, ParameterSetName = 'Batch')] + [Object]$Asset + ) + Invoke-HaloPreFlightCheck + try { + if ($Asset) { + $AssetID = $Asset.Id + } + $ObjectToDelete = Get-HaloAsset -AssetID $AssetID + if ($ObjectToDelete) { + if ($PSCmdlet.ShouldProcess("Asset '$($ObjectToDelete.id)' by '$($ObjectToDelete.who)'", 'Delete')) { + $Resource = "api/Asset/$($AssetID)" + $AssetResults = New-HaloDELETERequest -Resource $Resource + Return $AssetResults + } + } else { + Throw 'Asset was not found in Halo to delete.' + } + } catch { + New-HaloError -ErrorRecord $_ + } +} \ No newline at end of file diff --git a/Public/Remove/Remove-HaloSupplier.ps1 b/Public/Remove/Remove-HaloSupplier.ps1 new file mode 100644 index 0000000..355d493 --- /dev/null +++ b/Public/Remove/Remove-HaloSupplier.ps1 @@ -0,0 +1,32 @@ +function Remove-HaloSupplier { + <# + .SYNOPSIS + Removes a supplier from the Halo API. + .DESCRIPTION + Deletes a specific supplier from Halo. + .OUTPUTS + A powershell object containing the response. + #> + [cmdletbinding( SupportsShouldProcess = $True, ConfirmImpact = 'High' )] + [OutputType([Object])] + Param( + # The Supplier ID + [Parameter( Mandatory, ParameterSetName = 'Single' )] + [int64]$SupplierID + ) + Invoke-HaloPreFlightCheck + try { + $ObjectToDelete = Get-HaloSupplier -SupplierID $SupplierID + if ($ObjectToDelete) { + if ($PSCmdlet.ShouldProcess("Action '$($ObjectToDelete.id)' by '$($ObjectToDelete.who)'", 'Delete')) { + $Resource = "api/supplier/$($SupplierID)" + $SupplierResults = New-HaloDELETERequest -Resource $Resource + Return $SupplierResults + } + } else { + Throw 'Supplier was not found in Halo to delete.' + } + } catch { + New-HaloError -ErrorRecord $_ + } +}