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

No description available.

.PARAMETER Key
The template key
.PARAMETER Text
The main text content of the Slack message
.PARAMETER Blocks
JSON string of Slack Block Kit blocks for rich formatting
.PARAMETER Attachments
JSON string of Slack attachments
.PARAMETER NotificationType
The type of notification
.PARAMETER ApprovalId
The approval request ID
.PARAMETER RequestId
The request ID
.PARAMETER RequestedById
The ID of the user who made the request
.PARAMETER IsSubscription
Whether this is a subscription notification
.PARAMETER AutoApprovalData
No description available.
.PARAMETER CustomFields
No description available.
.OUTPUTS

TemplatedtoSlackTemplate<PSCustomObject>
#>


function Initialize-TemplatedtoSlackTemplate {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Key},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Text},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Blocks},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Attachments},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NotificationType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ApprovalId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RequestId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RequestedById},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsSubscription} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AutoApprovalData},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CustomFields}
    )

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


        $PSO = [PSCustomObject]@{
            "key" = ${Key}
            "text" = ${Text}
            "blocks" = ${Blocks}
            "attachments" = ${Attachments}
            "notificationType" = ${NotificationType}
            "approvalId" = ${ApprovalId}
            "requestId" = ${RequestId}
            "requestedById" = ${RequestedById}
            "isSubscription" = ${IsSubscription}
            "autoApprovalData" = ${AutoApprovalData}
            "customFields" = ${CustomFields}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to TemplatedtoSlackTemplate<PSCustomObject>

.DESCRIPTION

Convert from JSON to TemplatedtoSlackTemplate<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

TemplatedtoSlackTemplate<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in TemplatedtoSlackTemplate
        $AllProperties = ("key", "text", "blocks", "attachments", "notificationType", "approvalId", "requestId", "requestedById", "isSubscription", "autoApprovalData", "customFields")
        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 "text"))) { #optional property not found
            $Text = $null
        } else {
            $Text = $JsonParameters.PSobject.Properties["text"].value
        }

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "key" = ${Key}
            "text" = ${Text}
            "blocks" = ${Blocks}
            "attachments" = ${Attachments}
            "notificationType" = ${NotificationType}
            "approvalId" = ${ApprovalId}
            "requestId" = ${RequestId}
            "requestedById" = ${RequestedById}
            "isSubscription" = ${IsSubscription}
            "autoApprovalData" = ${AutoApprovalData}
            "customFields" = ${CustomFields}
        }

        return $PSO
    }

}