Model/PublicIdentitiesSearchRequest.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

COMPOSITE search request for public identities. Root querySet must use matchAny false (AND). The first entries item must be the ACTIVE identityState TEXT gate; identityState may not appear elsewhere in the query tree.

.PARAMETER QueryType
Search query type. Must be COMPOSITE.
.PARAMETER Indices
Search indices. Must be exactly [""identities""].
.PARAMETER IncludeNested
Must be false for public identities search.
.PARAMETER Sort
Optional attribute keys to sort by. Base keys must match those returned by GET /public-identities/v2/visible-attributes (defaultAttributes + configuredAttributes). Optional ""attributes."" prefix and/or "".exact"" suffix.
.PARAMETER QuerySet
No description available.
.OUTPUTS

PublicIdentitiesSearchRequest<PSCustomObject>
#>


function Initialize-PublicIdentitiesSearchRequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("COMPOSITE")]
        [String]
        ${QueryType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("identities")]
        [String[]]
        ${Indices},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${IncludeNested},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${Sort},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${QuerySet}
    )

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

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

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "queryType" = ${QueryType}
            "indices" = ${Indices}
            "includeNested" = ${IncludeNested}
            "sort" = ${Sort}
            "querySet" = ${QuerySet}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to PublicIdentitiesSearchRequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to PublicIdentitiesSearchRequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PublicIdentitiesSearchRequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PublicIdentitiesSearchRequest
        $AllProperties = ("queryType", "indices", "includeNested", "sort", "querySet")
        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 'queryType' missing."
        }

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "sort"))) { #optional property not found
            $Sort = $null
        } else {
            $Sort = $JsonParameters.PSobject.Properties["sort"].value
        }

        $PSO = [PSCustomObject]@{
            "queryType" = ${QueryType}
            "indices" = ${Indices}
            "includeNested" = ${IncludeNested}
            "sort" = ${Sort}
            "querySet" = ${QuerySet}
        }

        return $PSO
    }

}