Public/Connect-LaunchLibrary.ps1
|
function Connect-LaunchLibrary { <# .SYNOPSIS Configures the module to call the Launch Library API. .DESCRIPTION Stores an optional API key only in the current PowerShell session. Anonymous requests are limited by the Launch Library service; use -UseDevelopment for the non-production development endpoint. #> [CmdletBinding()] param( [string]$ApiKey, [switch]$UseDevelopment ) $script:LaunchLibraryConnection.BaseUri = if ($UseDevelopment) { 'https://lldev.thespacedevs.com' } else { 'https://ll.thespacedevs.com' } $script:LaunchLibraryConnection.ApiKey = $ApiKey $script:LaunchLibraryConnection.UseDevelopment = [bool]$UseDevelopment Get-LaunchLibraryConnection } function Disconnect-LaunchLibrary { [CmdletBinding()] param() $script:LaunchLibraryConnection.ApiKey = $null } function Get-LaunchLibraryConnection { [CmdletBinding()] param() [pscustomobject]@{ BaseUri = $script:LaunchLibraryConnection.BaseUri UseDevelopment = $script:LaunchLibraryConnection.UseDevelopment Authenticated = -not [string]::IsNullOrWhiteSpace($script:LaunchLibraryConnection.ApiKey) } } |