-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnifiAPI.psm1
40 lines (34 loc) · 898 Bytes
/
UnifiAPI.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
#region Variables
New-Variable -Scope Script -Visibility Private -Force -Name 'UnifiAPI_Key' -Value $null
New-Variable -Scope Script -Visibility Private -Force -Name 'UnifiAPI_URL' -Value 'https://api.ui.com'
New-Variable -Scope Script -Visibility Private -Force -Name 'UnifiAPI_Config_Path' -Value $null
#endregion
#region Load function files
Foreach ($Folder in @('Private', 'Public'))
{
$FolderPath = Join-Path -Path $PSScriptRoot -ChildPath $Folder
If (Test-Path -Path $FolderPath)
{
$Functions = Get-ChildItem -Path $FolderPath -Filter *.ps1 -Recurse
Foreach ($Function in $Functions)
{
. $Function.FullName
If ($Folder -notin @('Interal', 'Private'))
{
Export-ModuleMember -Function $Function.BaseName
}
}
}
}
#endregion
#region Init default config
Assert-UIConfig
Try
{
Select-UIConfig
}
Catch
{
Write-Verbose $_
}
#endregion