Public/Get-LaunchLibrarySchedule.ps1

function Get-LaunchLibraryLaunchList {
    <#
    .SYNOPSIS
    Gets launches from the base /launches/ endpoint.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$All,
        [switch]$Raw
    )

    Get-LaunchLibraryLaunch -Query $Query -All:$All -Raw:$Raw
}

function Get-LaunchLibraryUpcomingLaunch {
    <#
    .SYNOPSIS
    Gets upcoming launches.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$All,
        [switch]$Raw
    )

    Get-LaunchLibraryLaunch -Scope Upcoming -Query $Query -All:$All -Raw:$Raw
}

function Get-LaunchLibraryPreviousLaunch {
    <#
    .SYNOPSIS
    Gets previous launches.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$All,
        [switch]$Raw
    )

    Get-LaunchLibraryLaunch -Scope Previous -Query $Query -All:$All -Raw:$Raw
}

function Get-LaunchLibraryUpcomingEvent {
    <#
    .SYNOPSIS
    Gets upcoming spaceflight events.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$All,
        [switch]$Raw
    )

    Get-LaunchLibraryEvent -Scope Upcoming -Query $Query -All:$All -Raw:$Raw
}

function Get-LaunchLibraryPreviousEvent {
    <#
    .SYNOPSIS
    Gets previous spaceflight events.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$All,
        [switch]$Raw
    )

    Get-LaunchLibraryEvent -Scope Previous -Query $Query -All:$All -Raw:$Raw
}

function Get-LaunchLibraryNextLaunch {
    <#
    .SYNOPSIS
    Gets the next scheduled launch.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$Raw
    )

    $requestQuery = @{}
    if ($Query) {
        foreach ($key in $Query.Keys) {
            $requestQuery[$key] = $Query[$key]
        }
    }
    $requestQuery.limit = 1
    Get-LaunchLibraryUpcomingLaunch -Query $requestQuery -Raw:$Raw | Select-Object -First 1
}

function Get-LaunchLibraryNextEvent {
    <#
    .SYNOPSIS
    Gets the next scheduled spaceflight event.
    #>

    [CmdletBinding()]
    param(
        [hashtable]$Query,
        [switch]$Raw
    )

    $requestQuery = @{}
    if ($Query) {
        foreach ($key in $Query.Keys) {
            $requestQuery[$key] = $Query[$key]
        }
    }
    $requestQuery.limit = 1
    Get-LaunchLibraryUpcomingEvent -Query $requestQuery -Raw:$Raw | Select-Object -First 1
}