public/New-DuoBypassCode.ps1

function New-DuoBypassCode(){
    [CmdletBinding()]
    param
    (
        [parameter(Mandatory = $true)]
        [string]$user_id,
        [parameter(Mandatory = $true)]
        [byte]$count,
        [parameter(Mandatory = $true)]
        [byte]$reuse_count,
        [parameter(Mandatory = $true)]
        [int32]$valid_secs
    )
    [string]$method = "POST"
    [string]$path = "/admin/v1/users/$($user_id)/bypass_codes"
    $ApiParams = $MyInvocation.BoundParameters

    $DuoRequest = Convertto-DUORequest -DuoMethodPath $path -Method $method -ApiParams $ApiParams
    $Response = Invoke-RestMethod @DuoRequest -SkipHeaderValidation:$true
    If($Response.stat -ne 'OK'){
       Write-Warning 'DUO REST Call Failed'
       Write-Warning ($APiParams | Out-String)
       Write-Warning "Method:$method Path:$path"
    }
    $Output = $Response | Select-Object -ExpandProperty Response
    Write-Output $Output
}