Private/Invoke-AirTableApi.ps1

function Invoke-AirTableApi
{
    param
    (
        [Parameter(Mandatory)]
        [string]$ApiKey,

        [Parameter(Mandatory)]
        [string]$BaseName,

        [Parameter(Mandatory)]
        [string]$TableName,

        [Parameter(Mandatory)]
        [ValidateSet('Get', 'Post', 'Patch', 'Delete')]
        [string]$Method,

        [Parameter()]
        [string]$Path,

        [Parameter()]
        [string]$QueryString,

        [Parameter()]
        [string]$PayLoad
    )

    $Uri = ((("https://api.airtable.com/v0/$BaseName/$TableName", $Path) -join '/'), $QueryString) -join '?'

    Write-Verbose "Uri: $Uri"
    Write-Verbose "Method: $Method"
    Write-Verbose "Payload: $Payload"

    Invoke-RestMethod `
        -Uri $Uri `
        -Method $Method `
        -ContentType 'application/json' `
        -Headers @{'Authorization' = "Bearer $($ApiKey)" } `
        -Body $Payload
}