Model/Templatevariable.ps1

#
# Identity Security Cloud API - Notifications
# 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

A variable available for use in a notification template. Variables can be template-specific (from domain events) or global (available to all templates like __recipient, __global, __util). Template variables provide self-documenting metadata about what variables are available when customizing notification templates.

.PARAMETER Key
The variable name as used when rendering context in templates.
.PARAMETER Type
The data type for this variable. Use JSON Schema-like names for values (string, boolean, number, object, array) or ""function"" for template utility/helper functions (e.g. __dateTool.format(), __esc.html()).
.PARAMETER Description
Human-readable description explaining what this variable represents.
.PARAMETER Example
Example value demonstrating the format and usage. For type ""function"", often a Velocity-style call (e.g. $__esc.html($value)). Can be a string, number, boolean, object, array, or null when no example is defined.
.OUTPUTS

Templatevariable<PSCustomObject>
#>


function Initialize-Templatevariable {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Key},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("string", "boolean", "number", "object", "array", "function")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Example}
    )

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


        $PSO = [PSCustomObject]@{
            "key" = ${Key}
            "type" = ${Type}
            "description" = ${Description}
            "example" = ${Example}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Templatevariable<PSCustomObject>

.DESCRIPTION

Convert from JSON to Templatevariable<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Templatevariable<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Templatevariable
        $AllProperties = ("key", "type", "description", "example")
        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 "key"))) { #optional property not found
            $Key = $null
        } else {
            $Key = $JsonParameters.PSobject.Properties["key"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "key" = ${Key}
            "type" = ${Type}
            "description" = ${Description}
            "example" = ${Example}
        }

        return $PSO
    }

}