Public/New-SnipeItCompany.ps1
<# .SYNOPSIS Creates a new Company .DESCRIPTION Creates new company on Snipe-It system .PARAMETER name Comapany name .PARAMETER url URL of Snipeit system, can be set using Set-SnipeItInfo command .PARAMETER apiKey User's API Key for Snipeit, can be set using Set-SnipeItInfo command .EXAMPLE New-SnipeItCompany -name "Acme Company" #> function New-SnipeItCompany() { [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] Param( [parameter(mandatory = $true)] [string]$name, [parameter(mandatory = $true)] [string]$url, [parameter(mandatory = $true)] [string]$apiKey ) Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $Body = $Values | ConvertTo-Json; $Parameters = @{ Uri = "$url/api/v1/companies" Method = 'POST' Body = $Body Token = $apiKey } If ($PSCmdlet.ShouldProcess("ShouldProcess?")) { $result = Invoke-SnipeitMethod @Parameters } $result } |