PSUKG.psm1
|
#Requires -Version 5.1 <# .SYNOPSIS PSUKG - PowerShell module for UKG HR Service Delivery REST API v2 .DESCRIPTION This module provides cmdlets for interacting with the UKG HR Service Delivery API, including management of employees, users, organizations, roles, documents, and more. .NOTES Compatible with PowerShell 5.1 and PowerShell 7+ #> # Module-scoped variables $Script:UKGSession = $null $Script:PSVersionMajor = $PSVersionTable.PSVersion.Major # Base URLs for different regions and environments $Script:UKGBaseUrls = @{ 'EU_Production' = 'https://apis.eu.people-doc.com/api/v2' 'EU_Staging' = 'https://apis.staging.eu.people-doc.com/api/v2' 'US_Production' = 'https://apis.us.people-doc.com/api/v2' 'US_Staging' = 'https://apis.staging.us.people-doc.com/api/v2' 'UKG_ATL_Production' = 'https://apis.hrsd.ultipro.com/api/v2' 'UKG_TOR_Production' = 'https://apis.hrsd.ultipro.ca/api/v2' } # Token endpoint URLs $Script:UKGTokenUrls = @{ 'EU_Production' = 'https://apis.eu.people-doc.com/oauth/token' 'EU_Staging' = 'https://apis.staging.eu.people-doc.com/oauth/token' 'US_Production' = 'https://apis.us.people-doc.com/oauth/token' 'US_Staging' = 'https://apis.staging.us.people-doc.com/oauth/token' 'UKG_ATL_Production' = 'https://apis.hrsd.ultipro.com/oauth/token' 'UKG_TOR_Production' = 'https://apis.hrsd.ultipro.ca/oauth/token' } # Get the module root path $ModuleRoot = $PSScriptRoot # Import private functions $PrivateFunctions = Get-ChildItem -Path "$ModuleRoot\Private\*.ps1" -ErrorAction SilentlyContinue foreach ($Function in $PrivateFunctions) { try { . $Function.FullName Write-Verbose "Imported private function: $($Function.BaseName)" } catch { Write-Error "Failed to import private function $($Function.FullName): $_" } } # Import public functions from all subdirectories $PublicFolders = Get-ChildItem -Path "$ModuleRoot\Public" -Directory -ErrorAction SilentlyContinue foreach ($Folder in $PublicFolders) { $PublicFunctions = Get-ChildItem -Path "$($Folder.FullName)\*.ps1" -ErrorAction SilentlyContinue foreach ($Function in $PublicFunctions) { try { . $Function.FullName Write-Verbose "Imported public function: $($Function.BaseName)" } catch { Write-Error "Failed to import public function $($Function.FullName): $_" } } } # Also check for .ps1 files directly in Public folder $DirectPublicFunctions = Get-ChildItem -Path "$ModuleRoot\Public\*.ps1" -ErrorAction SilentlyContinue foreach ($Function in $DirectPublicFunctions) { try { . $Function.FullName Write-Verbose "Imported public function: $($Function.BaseName)" } catch { Write-Error "Failed to import public function $($Function.FullName): $_" } } # Export module member (all public functions are exported via manifest) |