Pax8API/Public/Partner/New-Pax8Order.ps1

<#
.SYNOPSIS
Create Order
.DESCRIPTION
Create a new order. Currently NOT supported for scheduled orders(orders with a future date).
OpenAPI: POST /orders
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER IsMock
Perform validations only. Skip any interactions with the database.
.PARAMETER CompanyId
unique id of the purchasing company ie. end-user
.PARAMETER OrderedBy
the type of user who created the order Suggested values: Pax8 Partner, Customer, Pax8.
.PARAMETER OrderedByUserEmail
the email address of the user who created this order
.PARAMETER LineItems
body parameter 'lineItems'.
.PARAMETER Body
Raw request body. This can be a hashtable, PSCustomObject, or pre-built JSON string.
.EXAMPLE
New-Pax8Order
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

function New-Pax8Order {
    [CmdletBinding()]
    param (
        [bool]$IsMock,

        [Parameter(Mandatory = $true)]
        [guid]$CompanyId,

        [ValidateSet('Pax8 Partner', 'Customer', 'Pax8')]
        [string]$OrderedBy,

        [string]$OrderedByUserEmail,

        [Parameter(Mandatory = $true)]
        [object[]]$LineItems,

        [Parameter(ValueFromPipeline = $true)]
        [object]$Body,

        [switch]$Raw
    )

    process {
        $boundParameters = @{}
        foreach ($entry in $PSBoundParameters.GetEnumerator()) {
            $boundParameters[$entry.Key] = $entry.Value
        }

        Invoke-Pax8ApiOperation -CommandName $MyInvocation.MyCommand.Name -Parameters $boundParameters
    }
}