Model/PublicIdentitiesQuerySet.ps1

#
# SailPoint Identity Security API - Public Identities
# Use these APIs to interact with the SailPoint Identity Security platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

A set of COMPOSITE query entries combined with AND (matchAny false) or OR (matchAny true).

.PARAMETER MatchAny
When true, entries are OR'd; when false, entries are AND'd.
.PARAMETER Entries
One or more TEXT or nested COMPOSITE entries.
.OUTPUTS

PublicIdentitiesQuerySet<PSCustomObject>
#>


function Initialize-PublicIdentitiesQuerySet {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${MatchAny},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Entries}
    )

    Process {
        'Creating PSCustomObject: PSSailpoint.PublicIdentities => PublicIdentitiesQuerySet' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        if (!$MatchAny) {
            throw "invalid value for 'MatchAny', 'MatchAny' cannot be null."
        }

        if (!$Entries) {
            throw "invalid value for 'Entries', 'Entries' cannot be null."
        }

        if ($Entries.length -lt 1) {
            throw "invalid value for 'Entries', number of items must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "matchAny" = ${MatchAny}
            "entries" = ${Entries}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to PublicIdentitiesQuerySet<PSCustomObject>

.DESCRIPTION

Convert from JSON to PublicIdentitiesQuerySet<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PublicIdentitiesQuerySet<PSCustomObject>
#>

function ConvertFrom-JsonToPublicIdentitiesQuerySet {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: PSSailpoint.PublicIdentities => PublicIdentitiesQuerySet' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PublicIdentitiesQuerySet
        $AllProperties = ("matchAny", "entries")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'matchAny' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "matchAny"))) {
            throw "Error! JSON cannot be serialized due to the required property 'matchAny' missing."
        } else {
            $MatchAny = $JsonParameters.PSobject.Properties["matchAny"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "entries"))) {
            throw "Error! JSON cannot be serialized due to the required property 'entries' missing."
        } else {
            $Entries = $JsonParameters.PSobject.Properties["entries"].value
        }

        $PSO = [PSCustomObject]@{
            "matchAny" = ${MatchAny}
            "entries" = ${Entries}
        }

        return $PSO
    }

}