diff --git a/SnipeitPS/Public/New-SnipeitSupplier.ps1 b/SnipeitPS/Public/New-SnipeitSupplier.ps1 new file mode 100644 index 0000000..3bd64bf --- /dev/null +++ b/SnipeitPS/Public/New-SnipeitSupplier.ps1 @@ -0,0 +1,117 @@ +<# + .SYNOPSIS + Creates a supplier + + .DESCRIPTION + Creates a new supplier on Snipe-It system + + .PARAMETER name + Department Name + + .PARAMETER address + Address line 1 of supplier + + .PARAMETER address2 + Address line 1 of supplier + + .PARAMETER city + City + + .PARAMETER state + State + + .PARAMETER country + Country + + .PARAMETER zip + Zip code + + .PARAMETER phone + Phone number + + .PARAMETER fax + Fax number + + .PARAMETER email + Email address + + .PARAMETER contact + Contact person + + .PARAMETER notes + Email address + + .PARAMETER image + Image file name and path for item + + .PARAMETER url + URL of Snipeit system, can be set using Set-SnipeitInfo command + + .PARAMETER apiKey + Users API Key for Snipeit, can be set using Set-SnipeitInfo command + + .EXAMPLE + New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3 + +#> + +function New-SnipeitSupplier() { + [CmdletBinding( + SupportsShouldProcess = $true, + ConfirmImpact = "Low" + )] + + Param( + [parameter(mandatory = $true)] + [string]$name, + + [string]$address, + + [string]$address2, + + [string]$city, + + [string]$state, + + [string]$country, + + [string]$zip, + + [string]$phone, + + [string]$fax, + + [string]$email, + + [string]$contact, + + [string]$notes, + + [ValidateScript({Test-Path $_})] + [string]$image, + + [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 + + $Parameters = @{ + Uri = "$url/api/v1/suppilers" + Method = 'POST' + Body = $Values + Token = $apiKey + } + + If ($PSCmdlet.ShouldProcess("ShouldProcess?")) { + $result = Invoke-SnipeitMethod @Parameters + } + + $result +} + diff --git a/SnipeitPS/Public/Remove-SnipeitSupplier.ps1 b/SnipeitPS/Public/Remove-SnipeitSupplier.ps1 new file mode 100644 index 0000000..196df14 --- /dev/null +++ b/SnipeitPS/Public/Remove-SnipeitSupplier.ps1 @@ -0,0 +1,54 @@ +<# + .SYNOPSIS + Removes supplier from Snipe-it asset system + .DESCRIPTION + Removes supplier or multiple manufacturers from Snipe-it asset system + .PARAMETER ID + Unique ID For supplier to be removed + .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 + Remove-SnipeitSupplier -ID 44 + + .EXAMPLE + Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier +#> + +function Remove-SnipeitSupplier () +{ + [CmdletBinding( + SupportsShouldProcess = $true, + ConfirmImpact = "Low" + )] + + Param( + [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] + [int[]]$id, + [parameter(mandatory = $true)] + [string]$URL, + [parameter(mandatory = $true)] + [string]$APIKey + + ) + begin { + } + process { + foreach($suppliers_id in $id){ + $Parameters = @{ + Uri = "$url/api/v1/suppliers/$supplier_id" + Method = 'Delete' + Token = $apiKey + } + + If ($PSCmdlet.ShouldProcess("ShouldProcess?")) + { + $result = Invoke-SnipeitMethod @Parameters + } + $result + } + } +} diff --git a/SnipeitPS/Public/Set-SnipeitSupplier.ps1 b/SnipeitPS/Public/Set-SnipeitSupplier.ps1 new file mode 100644 index 0000000..7180c5a --- /dev/null +++ b/SnipeitPS/Public/Set-SnipeitSupplier.ps1 @@ -0,0 +1,134 @@ +<# + .SYNOPSIS + Modify the supplier + + .DESCRIPTION + Modifieds the supplier on Snipe-It system + + .PARAMETER name + Suppiers Name + + .PARAMETER address + Address line 1 of supplier + + .PARAMETER address2 + Address line 1 of supplier + + .PARAMETER city + City + + .PARAMETER state + State + + .PARAMETER country + Country + + .PARAMETER zip + Zip code + + .PARAMETER phone + Phone number + + .PARAMETER fax + Fax number + + .PARAMETER email + Email address + + .PARAMETER contact + Contact person + + .PARAMETER notes + Email address + + .PARAMETER image + Image file name and path for item + + .PARAMETER image_delete + Remove current image + + .PARAMETER RequestType + Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed. + + .PARAMETER url + URL of Snipeit system, can be set using Set-SnipeitInfo command + + .PARAMETER apiKey + Users API Key for Snipeit, can be set using Set-SnipeitInfo command + + .EXAMPLE + New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3 + +#> + +function Set-SnipeitSupplier() { + [CmdletBinding( + SupportsShouldProcess = $true, + ConfirmImpact = "Low" + )] + + Param( + [parameter(mandatory = $true)] + [string]$name, + + [string]$address, + + [string]$address2, + + [string]$city, + + [string]$state, + + [string]$country, + + [string]$zip, + + [string]$phone, + + [string]$fax, + + [string]$email, + + [string]$contact, + + [string]$notes, + + [ValidateScript({Test-Path $_})] + [string]$image, + + [switch]$image_delete, + + [ValidateSet("Put","Patch")] + [string]$RequestType = "Patch", + + [parameter(mandatory = $true)] + [string]$url, + + [parameter(mandatory = $true)] + [string]$apiKey + ) + + begin { + Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name + + $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters + + } + process { + foreach ($supplier_id in $id) { + $Parameters = @{ + Uri = "$url/api/v1/suppliers/$supplier_id" + Method = $RequestType + Body = $Values + Token = $apiKey + } + + If ($PSCmdlet.ShouldProcess("ShouldProcess?")) { + $result = Invoke-SnipeitMethod @Parameters + } + + $result + } + } +} + diff --git a/SnipeitPS/SnipeitPS.psd1 b/SnipeitPS/SnipeitPS.psd1 index fb5fd68..3402561 100644 --- a/SnipeitPS/SnipeitPS.psd1 +++ b/SnipeitPS/SnipeitPS.psd1 @@ -104,6 +104,7 @@ FunctionsToExport = @( 'New-SnipeitLocation', 'New-SnipeitManufacturer', 'New-SnipeitModel', + 'New-SnipeitSupplier', 'New-SnipeitUser', 'Remove-SnipeitAccessory', 'Remove-SnipeitAsset', @@ -118,6 +119,7 @@ FunctionsToExport = @( 'Remove-SnipeitLocation', 'Remove-SnipeitManufacturer', 'Remove-SnipeitModel', + 'Remove-SnipeitSupplier', 'Remove-SnipeitUser', 'Reset-SnipeitAccessoryOwner', 'Reset-SnipeitAssetOwner', @@ -138,6 +140,7 @@ FunctionsToExport = @( 'Set-SnipeitManufacturer', 'Set-SnipeitModel', 'Set-SnipeitStatus', + 'Set-SnipeitSupplier', 'Set-SnipeitUser', 'Update-SnipeitAlias' ) diff --git a/docs/New-SnipeitSupplier.md b/docs/New-SnipeitSupplier.md new file mode 100644 index 0000000..670dfe5 --- /dev/null +++ b/docs/New-SnipeitSupplier.md @@ -0,0 +1,299 @@ +--- +external help file: SnipeitPS-help.xml +Module Name: SnipeitPS +online version: +schema: 2.0.0 +--- + +# New-SnipeitSupplier + +## SYNOPSIS +Creates a supplier + +## SYNTAX + +``` +New-SnipeitSupplier [-name] [[-address] ] [[-address2] ] [[-city] ] + [[-state] ] [[-country] ] [[-zip] ] [[-phone] ] [[-fax] ] + [[-email] ] [[-contact] ] [[-notes] ] [[-image] ] [-url] + [-apiKey] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Creates a new supplier on Snipe-It system + +## EXAMPLES + +### EXAMPLE 1 +``` +New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3 +``` + +## PARAMETERS + +### -address +Address line 1 of supplier + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -address2 +Address line 1 of supplier + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -apiKey +Users API Key for Snipeit, can be set using Set-SnipeitInfo command + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 15 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -city +City + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -contact +Contact person + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 11 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -country +Country + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -email +Email address + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 10 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -fax +Fax number + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 9 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -image +Image file name and path for item + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 13 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -name +Department Name + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -notes +Email address + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 12 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -phone +Phone number + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 8 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -state +State + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -url +URL of Snipeit system, can be set using Set-SnipeitInfo command + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 14 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zip +Zip code + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 7 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Remove-SnipeitSupplier.md b/docs/Remove-SnipeitSupplier.md new file mode 100644 index 0000000..031b2e8 --- /dev/null +++ b/docs/Remove-SnipeitSupplier.md @@ -0,0 +1,122 @@ +--- +external help file: SnipeitPS-help.xml +Module Name: SnipeitPS +online version: +schema: 2.0.0 +--- + +# Remove-SnipeitSupplier + +## SYNOPSIS +Removes supplier from Snipe-it asset system + +## SYNTAX + +``` +Remove-SnipeitSupplier [-id] [-URL] [-APIKey] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Removes supplier or multiple manufacturers from Snipe-it asset system + +## EXAMPLES + +### EXAMPLE 1 +``` +Remove-SnipeitSupplier -ID 44 +``` + +### EXAMPLE 2 +``` +Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier +``` + +## PARAMETERS + +### -APIKey +User's API Key for Snipeit, can be set using Set-SnipeitInfo command + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -id +Unique ID For supplier to be removed + +```yaml +Type: Int32[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -URL +URL of Snipeit system, can be set using Set-SnipeitInfo command + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Set-SnipeitSupplier.md b/docs/Set-SnipeitSupplier.md new file mode 100644 index 0000000..4cd4945 --- /dev/null +++ b/docs/Set-SnipeitSupplier.md @@ -0,0 +1,330 @@ +--- +external help file: SnipeitPS-help.xml +Module Name: SnipeitPS +online version: +schema: 2.0.0 +--- + +# Set-SnipeitSupplier + +## SYNOPSIS +Modify the supplier + +## SYNTAX + +``` +Set-SnipeitSupplier [-name] [[-address] ] [[-address2] ] [[-city] ] + [[-state] ] [[-country] ] [[-zip] ] [[-phone] ] [[-fax] ] + [[-email] ] [[-contact] ] [[-notes] ] [[-image] ] [-image_delete] + [[-RequestType] ] [-url] [-apiKey] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Modifieds the supplier on Snipe-It system + +## EXAMPLES + +### EXAMPLE 1 +``` +New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3 +``` + +## PARAMETERS + +### -address +Address line 1 of supplier + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -address2 +Address line 1 of supplier + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -apiKey +Users API Key for Snipeit, can be set using Set-SnipeitInfo command + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 16 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -city +City + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -contact +Contact person + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 11 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -country +Country + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -email +Email address + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 10 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -fax +Fax number + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 9 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -image +Image file name and path for item + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 13 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -image_delete +Remove current image + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -name +Suppiers Name + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -notes +Email address + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 12 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -phone +Phone number + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 8 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RequestType +Http request type to send Snipe IT system. +Defaults to Patch you could use Put if needed. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 14 +Default value: Patch +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -state +State + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -url +URL of Snipeit system, can be set using Set-SnipeitInfo command + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 15 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zip +Zip code + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 7 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS