Model/Promptinsightsmetrics.ps1

#
# Identity Security Cloud API - Prompt Insights
# Use these APIs to interact with the Identity Security Cloud 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

Aggregate prompt insights metrics for the requested time window.

.PARAMETER PromptsScanned
Count of prompts scanned in the interval.
.PARAMETER PromptsRedacted
Count of prompts redacted in the interval.
.OUTPUTS

Promptinsightsmetrics<PSCustomObject>
#>


function Initialize-Promptinsightsmetrics {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${PromptsScanned},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${PromptsRedacted}
    )

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

        if ($PromptsScanned -and $PromptsScanned -lt 0) {
          throw "invalid value for 'PromptsScanned', must be greater than or equal to 0."
        }

        if ($PromptsRedacted -and $PromptsRedacted -lt 0) {
          throw "invalid value for 'PromptsRedacted', must be greater than or equal to 0."
        }


        $PSO = [PSCustomObject]@{
            "promptsScanned" = ${PromptsScanned}
            "promptsRedacted" = ${PromptsRedacted}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Promptinsightsmetrics<PSCustomObject>

.DESCRIPTION

Convert from JSON to Promptinsightsmetrics<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Promptinsightsmetrics<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Promptinsightsmetrics
        $AllProperties = ("promptsScanned", "promptsRedacted")
        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 "promptsScanned"))) { #optional property not found
            $PromptsScanned = $null
        } else {
            $PromptsScanned = $JsonParameters.PSobject.Properties["promptsScanned"].value
        }

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

        $PSO = [PSCustomObject]@{
            "promptsScanned" = ${PromptsScanned}
            "promptsRedacted" = ${PromptsRedacted}
        }

        return $PSO
    }

}