Functions/Private/xCheckGlobalBricksetConnection.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
function Global:xCheckGlobalBricksetConnection {
<#
    .SYNOPSIS
    Checks for the presence of $Global:BricksetConnection

    .DESCRIPTION
    Checks for the presence of $Global:BricksetConnection

    .INPUTS
    None

    .OUTPUTS
    None

    .EXAMPLE
    xCheckGlobalBricksetConnection
#>


[CmdletBinding()]

    Param (

    )
    # --- Test for Brickset Connection
    if (-not $Global:BricksetConnection){

        throw "Brickset Connection variable does not exist. Please run Connect-Brickset first to create it"
    }

    elseif (-not $Global:BricksetConnection.WebService) {

        throw "Brickset Connection variable not populated with a WebService. Please run Connect-Brickset first to populate it"
    }
}