Pax8API/Public/Partner/Update-Pax8CompanyById.ps1

<#
.SYNOPSIS
Update Company
.DESCRIPTION
Updates an existing Company. ATTENTION - at least one parameter has to be modified.
OpenAPI: PATCH /companies/{companyId}
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER CompanyId
path parameter 'companyId'.
.PARAMETER Name
The company name
.PARAMETER Address
body parameter 'address'.
.PARAMETER Phone
The primary phone number of the company
.PARAMETER Website
The full URL of the company website
.PARAMETER ExternalId
An external ID that can be assigned to the company for reference
.PARAMETER BillOnBehalfOfEnabled
Value is ```true``` if Pax8 handles billing transactions, value is ```false``` if partner handles billing transactions
.PARAMETER SelfServiceAllowed
Value is ```true``` if self-service privileges are available to the company, otherwise value is ```false```
.PARAMETER OrderApprovalRequired
Value is ```true``` if the company's self-service orders require approval, otherwise value is ```false```
.PARAMETER Body
Raw request body. This can be a hashtable, PSCustomObject, or pre-built JSON string.
.EXAMPLE
Update-Pax8CompanyById -CompanyId '00000000-0000-0000-0000-000000000000'
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

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

        [string]$Name,

        [object]$Address,

        [string]$Phone,

        [string]$Website,

        [string]$ExternalId,

        [bool]$BillOnBehalfOfEnabled,

        [bool]$SelfServiceAllowed,

        [bool]$OrderApprovalRequired,

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

Set-Alias -Name 'Set-Pax8Company' -Value 'Update-Pax8CompanyById'