Model/AccessRequestSubmittedResponse.ps1

#
# Identity Security Cloud API - Triggers
# 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 Approved
Approval or denial of the request by the subscribing service.
.PARAMETER Comment
Comment from the subscribing service approving or denying the request.
.PARAMETER Approver
Name of the subscribing service approving the request. This doesn't normally have to be the name of an existing identity in ISC, but it does if you have an active subscription to the [Access Request Decision trigger](https://developer.sailpoint.com/docs/extensibility/event-triggers/triggers/access-request-decision). If you don't provide the `username` of an existing identity in your tenant, your Access Request Decision subscriptions will never trigger.
.OUTPUTS

AccessRequestSubmittedResponse<PSCustomObject>
#>


function Initialize-AccessRequestSubmittedResponse {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${Approved},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Comment},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Approver}
    )

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

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

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

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


        $PSO = [PSCustomObject]@{
            "approved" = ${Approved}
            "comment" = ${Comment}
            "approver" = ${Approver}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AccessRequestSubmittedResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to AccessRequestSubmittedResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AccessRequestSubmittedResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in AccessRequestSubmittedResponse
        $AllProperties = ("approved", "comment", "approver")
        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 'approved' missing."
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "approved" = ${Approved}
            "comment" = ${Comment}
            "approver" = ${Approver}
        }

        return $PSO
    }

}