-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPS_Mirth.psm1
54 lines (42 loc) · 2 KB
/
PS_Mirth.psm1
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
54
#Get public and private function definition files.
$Classes = @( Get-ChildItem -Path $PSScriptRoot\Classes\*.ps1 -Recurse -ErrorAction SilentlyContinue )
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -Recurse -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -Recurse -ErrorAction SilentlyContinue )
#Dot source the files
Foreach ($import in @($Classes + $Public + $Private)) {
Try {
. $import.fullname
}
Catch {
Write-Error -Message "Failed to import class/function $($import.fullname): $_"
}
}
# Here I might...
# Read in or create an initial config file and variable
# Export Public functions ($Public.BaseName) for WIP modules
# Set variables visible to the module and its functions only
#default function parameters
$PSDefaultParameterValues = @{
"Invoke-RestMethod:SkipCertificateCheck" = $true
}
#default API headers
$script:DEFAULT_HEADERS = @{
"X-Requested-With" = "PS_Mirth"
}
# Dynamically Scoped/Globals
# Set this to 'Continue' to display output from Write-Debug statements,
# or to 'SilentylyContinue' to suppress them.
#$DebugPreference = 'SilentlyContinue'
# This is where the -saveXML flag will cause files to be saved. It
# defaults to a subfolder in the current location.
[string]$script:DEFAULT_OUTPUT_FOLDER = Join-Path $pwd "PS_Mirth_Output"
[string]$script:SavePath = $DEFAULT_OUTPUT_FOLDER
[pscredential]$script:DEFAULT_CREDENTIAL = [pscredential]::new("admin", (ConvertTo-SecureString "admin" -AsPlainText -Force))
[MirthConnection]$script:currentConnection = $null
# functions which can auto-complete the ChannelId parameter
# FunctionName -> ParameterName
$script:AutocompleteFunctions = @{'Get-MirthChannelMessages' = 'channelId'; 'Get-MirthChannelMsgById' = 'channelId'; "Set-MirthTaggedChannels" = "channelIds" }
# aliases
Set-Alias cm Connect-Mirth
New-Alias -Name tmfrw -Value Test-MirthFileReadWrite
Export-ModuleMember -Function $Public.Basename