Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
!Deploy!
Browse files Browse the repository at this point in the history
  • Loading branch information
DamagedDingo committed Aug 18, 2021
1 parent fda3b56 commit 505706b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Format as below (Requires the '### Added' as a header or task fails)
...- Update ReadMe.MD

## [Unreleased]
### Added
- Get-InsightObject updated error message to use $_.ErrorDetails.Message which should be more useful.

## [1.24] - 2021-08-16
### Added
Expand Down
50 changes: 25 additions & 25 deletions JSM.Insight/Public/Get-InsightObject.ps1
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# https://developer.atlassian.com/cloud/insight/rest/api-group-object/#api-object-id-get
function Get-InsightObject {
[CmdletBinding()]
param (
[string]$ID,
[String]$Version = "1",
[string]$InsightCreds = $InsightCreds,
[string]$InsightWorkspaceID = $InsightWorkspaceID
)
[CmdletBinding()]
param (
[string]$ID,
[String]$Version = '1',
[string]$InsightCreds = $InsightCreds,
[string]$InsightWorkspaceID = $InsightWorkspaceID
)

begin {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
$Headers = New-InsightHeaders
}
begin {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
$Headers = New-InsightHeaders
}

process {
$Request = [System.UriBuilder]"https://api.atlassian.com/jsm/insight/workspace/$InsightWorkspaceID/v$Version/object/$id"
}
process {
$Request = [System.UriBuilder]"https://api.atlassian.com/jsm/insight/workspace/$InsightWorkspaceID/v$Version/object/$id"
}

end {
try {
$response = Invoke-RestMethod -Uri $Request.Uri -Headers $headers -Method GET
}
catch {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Failed"
Write-Error -Message "$($_.Exception.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation
}
end {
try {
$response = Invoke-RestMethod -Uri $Request.Uri -Headers $headers -Method GET
}
catch {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Failed"
Write-Error -Message "$($_.ErrorDetails.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation
}

$response
$response

Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete"
}
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete"
}
}

0 comments on commit 505706b

Please sign in to comment.