v3/src/PSSailpoint/Model/Query.ps1

#
# IdentityNow V3 API
# Use these APIs to interact with the IdentityNow 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: 3.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Query parameters used to construct an Elasticsearch query object.

.PARAMETER Query
The query using the Elasticsearch [Query String Query](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-query-string-query.html#query-string) syntax from the Query DSL extended by SailPoint to support Nested queries.
.PARAMETER Fields
The fields to which the specified query will be applied. The available fields are dependent on the indice(s) being searched on. Please refer to the response schema of this API for a list of available fields.
.PARAMETER TimeZone
The time zone to be applied to any range query related to dates.
.PARAMETER InnerHit
No description available.
.OUTPUTS

Query<PSCustomObject>
#>


function Initialize-Query {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Query},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${Fields},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TimeZone},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${InnerHit}
    )

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


        $PSO = [PSCustomObject]@{
            "query" = ${Query}
            "fields" = ${Fields}
            "timeZone" = ${TimeZone}
            "innerHit" = ${InnerHit}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Query<PSCustomObject>

.DESCRIPTION

Convert from JSON to Query<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Query<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "query" = ${Query}
            "fields" = ${Fields}
            "timeZone" = ${TimeZone}
            "innerHit" = ${InnerHit}
        }

        return $PSO
    }

}