Pax8API/Public/Partner/New-Pax8Contact.ps1

<#
.SYNOPSIS
Create Contact
.DESCRIPTION
Creates a new Contact
OpenAPI: POST /companies/{companyId}/contacts
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER CompanyId
path parameter 'companyId'.
.PARAMETER FirstName
The first name
.PARAMETER LastName
The last name
.PARAMETER Email
The email
.PARAMETER Phone
The phone number
.PARAMETER Types
body parameter 'types'.
.PARAMETER Body
Raw request body. This can be a hashtable, PSCustomObject, or pre-built JSON string.
.EXAMPLE
New-Pax8Contact -CompanyId '00000000-0000-0000-0000-000000000000'
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

function New-Pax8Contact {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [guid]$CompanyId,

        [Parameter(Mandatory = $true)]
        [string]$FirstName,

        [Parameter(Mandatory = $true)]
        [string]$LastName,

        [Parameter(Mandatory = $true)]
        [string]$Email,

        [Parameter(Mandatory = $true)]
        [string]$Phone,

        [object[]]$Types,

        [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
    }
}