Model/GenerateProjectErrorReportSettingsModel.ps1

#
# Fly SDK API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 1.0
# Contact: support@avepoint.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
 
No summary available.
 
.DESCRIPTION
 
Generate error report job configuration information.
 
.PARAMETER TimeZone
Specify the UTC time offset of current browser. This value will be used to adjust time values when generating the report file.
.PARAMETER ReportFileType
Specify the format of the generated report file.
.PARAMETER ProjectIds
Specify a list of project GUID to generate their error report.
.OUTPUTS
 
GenerateProjectErrorReportSettingsModel<PSCustomObject>
#>


function Initialize-FlyGenerateProjectErrorReportSettingsModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${TimeZone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ReportFileType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${ProjectIds}
    )

    Process {
        'Creating PSCustomObject: Fly.Client => FlyGenerateProjectErrorReportSettingsModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

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


        $PSO = [PSCustomObject]@{
            "timeZone" = ${TimeZone}
            "reportFileType" = ${ReportFileType}
            "projectIds" = ${ProjectIds}
        }

        return $PSO
    }
}

<#
.SYNOPSIS
 
Convert from JSON to GenerateProjectErrorReportSettingsModel<PSCustomObject>
 
.DESCRIPTION
 
Convert from JSON to GenerateProjectErrorReportSettingsModel<PSCustomObject>
 
.PARAMETER Json
 
Json object
 
.OUTPUTS
 
GenerateProjectErrorReportSettingsModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyGenerateProjectErrorReportSettingsModel
        $AllProperties = ("timeZone", "reportFileType", "projectIds")
        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 'projectIds' missing."
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "timeZone" = ${TimeZone}
            "reportFileType" = ${ReportFileType}
            "projectIds" = ${ProjectIds}
        }

        return $PSO
    }

}