Public/Vendors/Update-AspireVendors.ps1
|
<#
.SYNOPSIS Updates an existing vendor in the Aspire API. .DESCRIPTION Uses Invoke-AspireRequest to perform a PUT request to the /Vendors endpoint. .PARAMETER VendorName The name of the vendor (required). .PARAMETER VendorID The ID of the vendor to update (required). .PARAMETER BranchID The ID of the branch (optional). .PARAMETER AccountingVendorID The accounting vendor ID (optional). .PARAMETER BillingTerms The billing terms (optional). .PARAMETER Active Whether the vendor is active (optional). .OUTPUTS The response from the API containing the result. .EXAMPLE Update-AspireVendors -VendorName "Updated Vendor" -VendorID 1 -Active $true #> function Update-AspireVendors { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$VendorName, [Parameter(Mandatory = $true)] [int]$VendorID, [int]$BranchID = $null, [string]$AccountingVendorID = $null, [string]$BillingTerms = $null, [bool]$Active = $null ) $body = @{ VendorName = $VendorName VendorID = $VendorID } if ($BranchID -ne $null) { $body.BranchID = $BranchID } if ($AccountingVendorID) { $body.AccountingVendorID = $AccountingVendorID } if ($BillingTerms) { $body.BillingTerms = $BillingTerms } if ($Active -ne $null) { $body.Active = $Active } return Invoke-AspireRequest -Method PUT -Path "/Vendors" -Body $body } |