Model/RequestList.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
RequestList<PSCustomObject>
#>


function New-RequestList {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ServiceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ServiceName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ServiceType} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ServiceTypeDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Category},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CategoryName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ApprovalStageName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Participants},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ParticipantDisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectID},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HasSubRequest} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ModifiedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ModifiedByDisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${ModifiedDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${TicketNumber} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Summary},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Status} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ProcessStatus} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${StatusDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${SubmitStatus} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Assigned},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AssignedLoginName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ServiceAdmin},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnabledCopy} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Metadata},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${QuestionnaireId}
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => RequestList' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "ServiceId" = ${ServiceId}
            "ServiceName" = ${ServiceName}
            "ServiceType" = ${ServiceType}
            "ServiceTypeDescription" = ${ServiceTypeDescription}
            "Category" = ${Category}
            "CategoryName" = ${CategoryName}
            "ApprovalStageName" = ${ApprovalStageName}
            "Participants" = ${Participants}
            "ParticipantDisplayName" = ${ParticipantDisplayName}
            "ObjectUrl" = ${ObjectUrl}
            "ObjectID" = ${ObjectID}
            "HasSubRequest" = ${HasSubRequest}
            "ModifiedBy" = ${ModifiedBy}
            "ModifiedByDisplayName" = ${ModifiedByDisplayName}
            "ModifiedDate" = ${ModifiedDate}
            "TicketNumber" = ${TicketNumber}
            "Summary" = ${Summary}
            "Status" = ${Status}
            "ProcessStatus" = ${ProcessStatus}
            "StatusDescription" = ${StatusDescription}
            "Modified" = ${Modified}
            "SubmitStatus" = ${SubmitStatus}
            "Assigned" = ${Assigned}
            "AssignedLoginName" = ${AssignedLoginName}
            "ServiceAdmin" = ${ServiceAdmin}
            "EnabledCopy" = ${EnabledCopy}
            "Metadata" = ${Metadata}
            "QuestionnaireId" = ${QuestionnaireId}
        }

        return $PSO
    }
}

<#
RequestList<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Cloud.Governance.Client => RequestList' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in RequestList
        $AllProperties = $("Id", "ServiceId", "ServiceName", "ServiceType", "ServiceTypeDescription", "Category", "CategoryName", "ApprovalStageName", "Participants", "ParticipantDisplayName", "ObjectUrl", "ObjectID", "HasSubRequest", "ModifiedBy", "ModifiedByDisplayName", "ModifiedDate", "TicketNumber", "Summary", "Status", "ProcessStatus", "StatusDescription", "Modified", "SubmitStatus", "Assigned", "AssignedLoginName", "ServiceAdmin", "EnabledCopy", "Metadata", "QuestionnaireId")
        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 "Id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["Id"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "ServiceId" = ${ServiceId}
            "ServiceName" = ${ServiceName}
            "ServiceType" = ${ServiceType}
            "ServiceTypeDescription" = ${ServiceTypeDescription}
            "Category" = ${Category}
            "CategoryName" = ${CategoryName}
            "ApprovalStageName" = ${ApprovalStageName}
            "Participants" = ${Participants}
            "ParticipantDisplayName" = ${ParticipantDisplayName}
            "ObjectUrl" = ${ObjectUrl}
            "ObjectID" = ${ObjectID}
            "HasSubRequest" = ${HasSubRequest}
            "ModifiedBy" = ${ModifiedBy}
            "ModifiedByDisplayName" = ${ModifiedByDisplayName}
            "ModifiedDate" = ${ModifiedDate}
            "TicketNumber" = ${TicketNumber}
            "Summary" = ${Summary}
            "Status" = ${Status}
            "ProcessStatus" = ${ProcessStatus}
            "StatusDescription" = ${StatusDescription}
            "Modified" = ${Modified}
            "SubmitStatus" = ${SubmitStatus}
            "Assigned" = ${Assigned}
            "AssignedLoginName" = ${AssignedLoginName}
            "ServiceAdmin" = ${ServiceAdmin}
            "EnabledCopy" = ${EnabledCopy}
            "Metadata" = ${Metadata}
            "QuestionnaireId" = ${QuestionnaireId}
        }

        return $PSO
    }

}