Functions/Public/Get-BricksetSet.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
function Get-BricksetSet {
<#
    .SYNOPSIS
    Get Brickset Sets
    
    .DESCRIPTION
    Get Brickset Sets

    .PARAMETER Theme
    Brickset Theme

    .PARAMETER Subtheme
    Brickset Subtheme

    .PARAMETER Year
    Year

    .PARAMETER SetNumber
    Lego Set Number in the format {number}-{variant}, e.g. 6905-1

    .PARAMETER OrderBy
    Specify Sort Order

    .PARAMETER PageSize
    Specify how many records to return

    .INPUTS
    System.String.
    System.Int

    .OUTPUTS
    Brickset.sets

    .EXAMPLE
    Get-BricksetSet -Theme 'Indiana Jones' -Subtheme 'Temple of Doom'

    .EXAMPLE
    Get-BricksetSet -Theme 'Indiana Jones' -Year 2009

    .EXAMPLE
    Get-BricksetSet -SetNumber '7199-1'

    .EXAMPLE
    Get-BricksetSet -Theme 'Indiana Jones' -OrderBy Pieces
#>

[CmdletBinding()][OutputType('Brickset.sets')]

    Param
    (

    [parameter(Mandatory=$false)]
    [ValidateNotNullOrEmpty()]
    [String]$Theme,

    [parameter(Mandatory=$false)]
    [ValidateNotNullOrEmpty()]
    [String]$Subtheme,

    [parameter(Mandatory=$false)]
    [ValidateNotNullOrEmpty()]
    $Year,

    [parameter(Mandatory=$false)]
    [ValidateNotNullOrEmpty()]
    [String]$SetNumber,

    [parameter(Mandatory=$false)]
    [ValidateSet('Number','YearFrom','Pieces','Minifigs','Rating','UKRetailPrice','USRetailPrice','CARetailPrice','EURetailPrice','Theme','Subtheme','Name','Random')]
    [String]$OrderBy,

    [parameter(Mandatory=$false)]
    [ValidateNotNullOrEmpty()]
    [Int]$PageSize = 1000
    )
    
    try {

        # --- Check for the presence of $Global:BricksetConnection
        xCheckGlobalBricksetConnection

        # --- Make the Webservice Call
        $BricksetConnection.WebService.getSets($BricksetConnection.APIKey,$null,$null,$Theme,$Subtheme,$SetNumber,$Year,$null,$null,$OrderBy,$PageSize,$null,$null)
    }
    catch [Exception]{
            
        throw
    }
}