Model/ClientDevice.ps1
# # Torizon OTA # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # Version: 2.0-Beta # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION No description available. .PARAMETER Namespace No description available. .PARAMETER Uuid No description available. .PARAMETER DeviceName No description available. .PARAMETER DeviceId No description available. .PARAMETER DeviceType No description available. .PARAMETER LastSeen No description available. .PARAMETER CreatedAt No description available. .PARAMETER ActivatedAt No description available. .PARAMETER DeviceStatus No description available. .PARAMETER Notes No description available. .OUTPUTS ClientDevice<PSCustomObject> #> function Initialize-TorizonPlatformAPIClientDevice { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${Namespace}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${Uuid}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${DeviceName}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${DeviceId}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [String] ${DeviceType}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [System.Nullable[System.DateTime]] ${LastSeen}, [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] [System.DateTime] ${CreatedAt}, [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] [System.Nullable[System.DateTime]] ${ActivatedAt}, [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] [String] ${DeviceStatus}, [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] [String] ${Notes} ) Process { 'Creating PSCustomObject: TorizonPlatformAPI => TorizonPlatformAPIClientDevice' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug if ($null -eq $Namespace) { throw "invalid value for 'Namespace', 'Namespace' cannot be null." } if ($null -eq $Uuid) { throw "invalid value for 'Uuid', 'Uuid' cannot be null." } if ($null -eq $DeviceName) { throw "invalid value for 'DeviceName', 'DeviceName' cannot be null." } if ($null -eq $DeviceId) { throw "invalid value for 'DeviceId', 'DeviceId' cannot be null." } if ($null -eq $DeviceType) { throw "invalid value for 'DeviceType', 'DeviceType' cannot be null." } if ($null -eq $CreatedAt) { throw "invalid value for 'CreatedAt', 'CreatedAt' cannot be null." } if ($null -eq $DeviceStatus) { throw "invalid value for 'DeviceStatus', 'DeviceStatus' cannot be null." } $PSO = [PSCustomObject]@{ "namespace" = ${Namespace} "uuid" = ${Uuid} "deviceName" = ${DeviceName} "deviceId" = ${DeviceId} "deviceType" = ${DeviceType} "lastSeen" = ${LastSeen} "createdAt" = ${CreatedAt} "activatedAt" = ${ActivatedAt} "deviceStatus" = ${DeviceStatus} "notes" = ${Notes} } return $PSO } } <# .SYNOPSIS Convert from JSON to ClientDevice<PSCustomObject> .DESCRIPTION Convert from JSON to ClientDevice<PSCustomObject> .PARAMETER Json Json object .OUTPUTS ClientDevice<PSCustomObject> #> function ConvertFrom-TorizonPlatformAPIJsonToClientDevice { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: TorizonPlatformAPI => TorizonPlatformAPIClientDevice' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in TorizonPlatformAPIClientDevice $AllProperties = ("namespace", "uuid", "deviceName", "deviceId", "deviceType", "lastSeen", "createdAt", "activatedAt", "deviceStatus", "notes") 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 'namespace' missing." } if (!([bool]($JsonParameters.PSobject.Properties.name -match "namespace"))) { throw "Error! JSON cannot be serialized due to the required property 'namespace' missing." } else { $Namespace = $JsonParameters.PSobject.Properties["namespace"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "uuid"))) { throw "Error! JSON cannot be serialized due to the required property 'uuid' missing." } else { $Uuid = $JsonParameters.PSobject.Properties["uuid"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "deviceName"))) { throw "Error! JSON cannot be serialized due to the required property 'deviceName' missing." } else { $DeviceName = $JsonParameters.PSobject.Properties["deviceName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "deviceId"))) { throw "Error! JSON cannot be serialized due to the required property 'deviceId' missing." } else { $DeviceId = $JsonParameters.PSobject.Properties["deviceId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "deviceType"))) { throw "Error! JSON cannot be serialized due to the required property 'deviceType' missing." } else { $DeviceType = $JsonParameters.PSobject.Properties["deviceType"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "createdAt"))) { throw "Error! JSON cannot be serialized due to the required property 'createdAt' missing." } else { $CreatedAt = $JsonParameters.PSobject.Properties["createdAt"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "deviceStatus"))) { throw "Error! JSON cannot be serialized due to the required property 'deviceStatus' missing." } else { $DeviceStatus = $JsonParameters.PSobject.Properties["deviceStatus"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "lastSeen"))) { #optional property not found $LastSeen = $null } else { $LastSeen = $JsonParameters.PSobject.Properties["lastSeen"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "activatedAt"))) { #optional property not found $ActivatedAt = $null } else { $ActivatedAt = $JsonParameters.PSobject.Properties["activatedAt"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "notes"))) { #optional property not found $Notes = $null } else { $Notes = $JsonParameters.PSobject.Properties["notes"].value } $PSO = [PSCustomObject]@{ "namespace" = ${Namespace} "uuid" = ${Uuid} "deviceName" = ${DeviceName} "deviceId" = ${DeviceId} "deviceType" = ${DeviceType} "lastSeen" = ${LastSeen} "createdAt" = ${CreatedAt} "activatedAt" = ${ActivatedAt} "deviceStatus" = ${DeviceStatus} "notes" = ${Notes} } return $PSO } } |