forked from loanDepot/JiraPS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoriginalPSM1Content.ps1
54 lines (47 loc) · 1.91 KB
/
originalPSM1Content.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# AS A GENERAL RULE THIS SHOULD ALWAYS CONTAIN JUST THE CONTENTS OF THE ORIGINAL JIRA PSM1 FROM THE ATLASSIAN REPO.
# HOWEVER, REMOVE THE LOADFUNCTIONS REGION AND KEEP IT IN THE OVERWRITTEN PSM1
#region Dependencies
# Load the ConfluencePS namespace from C#
# if (!("" -as [Type])) {
# Add-Type -Path (Join-Path $PSScriptRoot JiraPS.Types.cs) -ReferencedAssemblies Microsoft.CSharp, Microsoft.PowerShell.Commands.Utility, System.Management.Automation
# }
# if ($PSVersionTable.PSVersion.Major -lt 5) {
# Add-Type -Path (Join-Path $PSScriptRoot JiraPS.Attributes.cs) -ReferencedAssemblies Microsoft.CSharp, Microsoft.PowerShell.Commands.Utility, System.Management.Automation
# }
# Load Web assembly when needed
# PowerShell Core has the assembly preloaded
if (!("System.Web.HttpUtility" -as [Type])) {
Add-Type -AssemblyName "System.Web"
}
# Load System.Net.Http when needed
# PowerShell Core has the assembly preloaded
if (!("System.Net.Http.HttpRequestException" -as [Type])) {
Add-Type -AssemblyName "System.Net.Http"
}
if (!("System.Net.Http" -as [Type])) {
Add-Type -Assembly System.Net.Http
}
#endregion Dependencies
#region Configuration
$script:serverConfig = ("{0}/AtlassianPS/JiraPS/server_config" -f [Environment]::GetFolderPath('ApplicationData'))
if (-not (Test-Path $script:serverConfig)) {
$null = New-Item -Path $script:serverConfig -ItemType File -Force
}
$script:JiraServerUrl = [Uri](Get-Content $script:serverConfig)
$script:DefaultContentType = "application/json; charset=utf-8"
$script:DefaultPageSize = 25
$script:DefaultHeaders = @{ "Accept-Charset" = "utf-8" }
# Bug in PSv3's .Net API
if ($PSVersionTable.PSVersion.Major -gt 3) {
$script:DefaultHeaders["Accept"] = "application/json"
}
$script:PagingContainers = @(
"comments"
"dashboards"
"groups"
"issues"
"values"
"worklogs"
)
$script:SessionTransformationMethod = "ConvertTo-JiraSession"
#endregion Configuration