Private/ConvertFrom-AirTableRecord.ps1
function ConvertFrom-AirTableRecord { param ( [Parameter(Mandatory)] [string]$TableName, [Parameter(Mandatory, ValueFromPipeline)] [PSCustomObject[]]$InputObject ) process { foreach ($Item in $InputObject) { $Properties = [Ordered]@{ } $Item.Fields.PSObject.Properties.ForEach{ $Properties.Add($_.Name, $_.Value) } $Properties.AirTableRecordID = $Item.ID $Properties.AirTableCreatedTime = $Item.CreatedTime $Properties.PSTypeName = "AirTable.Record.$TableName" } [PSCustomObject]$Properties } } |