Model/TimeAggregationMethod.ps1

#
# Torizon OTA
# This API is rate limited and will return the following headers for each API call. - X-RateLimit-Limit - The total number of requests allowed within a time period - X-RateLimit-Remaining - The total number of requests still allowed until the end of the rate limiting period - X-RateLimit-Reset - The number of seconds until the limit is fully reset In addition, if an API client is rate limited, it will receive a HTTP 420 response with the following header: - Retry-After - The number of seconds to wait until this request is allowed
# Version: 2.0-Beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Json

JSON object

.OUTPUTS

TimeAggregationMethod<PSCustomObject>
#>

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

    Process {
        $match = 0
        $matchType = $null
        $matchInstance = $null

        # try to match SystemCollectionsHashtable defined in the oneOf schemas
        try {
            $matchInstance = ConvertFrom-TorizonPlatformAPIJsonToSystemCollectionsHashtable $Json

            foreach($property in $matchInstance.PsObject.Properties) {
                if ($null -ne $property.Value) {
                    $matchType = "SystemCollectionsHashtable"
                    $match++
                    break
                }
            }
        } catch {
            # fail to match the schema defined in oneOf, proceed to the next one
            Write-Debug "Failed to match 'SystemCollectionsHashtable' defined in oneOf (TorizonPlatformAPITimeAggregationMethod). Proceeding to the next one if any."
        }

        if ($match -gt 1) {
            throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([SystemCollectionsHashtable]). JSON Payload: $($Json)"
        } elseif ($match -eq 1) {
            return [PSCustomObject]@{
                "ActualType" = ${matchType}
                "ActualInstance" = ${matchInstance}
                "OneOfSchemas" = @("SystemCollectionsHashtable")
            }
        } else {
            throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([SystemCollectionsHashtable]). JSON Payload: $($Json)"
        }
    }
}