added support for consumables

This commit is contained in:
Petri Asikainen 2021-06-14 10:00:06 +03:00
parent 6b4bad903b
commit 28023285a0
11 changed files with 1646 additions and 0 deletions

View file

@ -0,0 +1,156 @@
<#
.SYNOPSIS
Gets a list of Snipe-it consumables
.PARAMETER search
A text string to search the consumables
.PARAMETER id
A id of specific consumable
.PARAMETER company_id
Id number of company
.PARAMETER category_id
Id number of category
.PARAMETER manufacturer_id
Id number of manufacturer
.PARAMETER sort
Sort results by column
.PARAMETER order
Specify the order (asc or desc) you wish to order by on your sort column
.PARAMETER expand
Whether to include detailed information on categories, etc (true) or just the text name (false)
.PARAMETER limit
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
.PARAMETER offset
Offset to use
.PARAMETER all
A return all results
.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
Get-SnipeitConsumable -all
Returns all consumables
.EXAMPLE
Get-SnipeitConsumable -search paper
Returns search results containeing string display
.EXAMPLE
Get-Snipeitconsumable -id
Returns specific consumable
#>
function Get-SnipeitConsumable() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
[string]$search,
[parameter(ParameterSetName='Get with ID')]
[int[]]$id,
[parameter(ParameterSetName='Search')]
[int]$category_id,
[parameter(ParameterSetName='Search')]
[int]$company_id,
[parameter(ParameterSetName='Search')]
[int]$manufacturer_id,
[parameter(ParameterSetName='Search')]
[int]$location_id,
[parameter(ParameterSetName='Search')]
[ValidateSet("asc", "desc")]
[string]$order = "desc",
[parameter(ParameterSetName='Search')]
[ValidateSet('id', 'name', 'min_amt', 'order_number', 'serial', 'purchase_date', 'purchase_cost', 'company', 'category', 'qty', 'location', 'image', 'created_at')]
[string]$sort = "created_at",
[Parameter(ParameterSetName='Search')]
[switch]$expand,
[parameter(ParameterSetName='Search')]
[int]$limit = 50,
[parameter(ParameterSetName='Search')]
[int]$offset,
[parameter(ParameterSetName='Search')]
[switch]$all = $false,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
begin {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
}
process {
switch ($PSCmdlet.ParameterSetName) {
'Search' {
$Parameters = @{
Uri = "$url/api/v1/consumables"
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($all) {
$offstart = $(if($offset){$offset} Else {0})
$callargs = $SearchParameter
$callargs.Remove('all')
while ($true) {
$callargs['offset'] = $offstart
$callargs['limit'] = $limit
$res=Get-Snipeitconsumable @callargs
$res
if ($res.count -ne $limit) {
break
}
$offstart = $offstart + $limit
}
} else {
$result = Invoke-SnipeitMethod @Parameters
$result
}
}
'Get with ID' {
foreach($consumable_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
$result = Invoke-SnipeitMethod @Parameters
$result
}
}
}
}
}

View file

@ -0,0 +1,139 @@
<#
.SYNOPSIS
Add a new Consumable to Snipe-it asset system
.DESCRIPTION
Long description
.PARAMETER name
Required Name of the Consumable
.PARAMETER qty
Required Quantity of comsumable
.PARAMETER category_id
Required Category ID of the Consumable, this can be got using Get-SnipeitCategory
.PARAMETER min_amt
Optional minimum quantity of comsumable
.PARAMETER company_id
Optional Company id
.PARAMETER order_number
Optional Order number
.PARAMETER manufacturer_id
Manufaturer id number of the consumable
.PARAMETER location_id
Location id number of the consumable
.PARAMETER requestable
Is consumable requestable?
.PARAMETER purchase_date
Optional Purchase cost of the consumable
.PARAMETER purchase_cost
Optional Purchase cost of the consumable
.PARAMETER model_number
Model number of the consumable in months
.PARAMETER item_no
Item number for the consumable
.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-Snipeitconsumable -name "Ink pack" -qty 20 -category_id 3 -min_amt 5
Create consumable with stock count 20 , alert when stock is 5 or lower
#>
function New-SnipeitConsumable()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
)]
Param(
[parameter(mandatory = $true)]
[string]$name,
[parameter(mandatory = $true)]
[int]$qty,
[parameter(mandatory = $true)]
[int]$category_id,
[parameter(mandatory = $false)]
[int]$min_amt,
[parameter(mandatory = $false)]
[int]$company_id,
[parameter(mandatory = $false)]
[string]$order_number,
[parameter(mandatory = $false)]
[int]$manufacturer_id,
[parameter(mandatory = $false)]
[int]$location_id,
[parameter(mandatory = $false)]
[bool]$requestable,
[parameter(mandatory = $false)]
[datetime]$purchase_date,
[parameter(mandatory = $false)]
[string]$purchase_cost,
[parameter(mandatory = $false)]
[string]$model_number,
[parameter(mandatory = $false)]
[string]$item_no,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
begin {
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) {
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
}
$Body = $Values | ConvertTo-Json;
}
process {
$Parameters = @{
Uri = "$url/api/v1/consumables"
Method = 'Post'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -0,0 +1,56 @@
<#
.SYNOPSIS
Removes consumable from Snipe-it asset system
.DESCRIPTION
Removes consumable or multiple consumables from Snipe-it asset system
.PARAMETER ID
Unique ID For consumable 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-SnipeitConsumable -ID 44 -Verbose
.EXAMPLE
Get-SnipeitConsumable -search "paper" | Remove-Snipeitconsumable
#>
function Remove-SnipeitConsumable ()
{
[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($consumable_id in $id){
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Method = 'Delete'
Body = '{}'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}
}

View file

@ -0,0 +1,147 @@
<#
.SYNOPSIS
Add a new Consumable to Snipe-it asset system
.DESCRIPTION
Long description
.PARAMETER id
Optional id number of the Consumable
.PARAMETER name
Optional Name of the Consumable
.PARAMETER qty
Optional Quantity of comsumable
.PARAMETER category_id
Required Category ID of the Consumable, this can be got using Get-SnipeitCategory
.PARAMETER min_amt
Optional minimum quantity of comsumable
.PARAMETER company_id
Optional Company id
.PARAMETER order_number
Optional Order number
.PARAMETER manufacturer_id
Manufaturer id number of the consumable
.PARAMETER location_id
Location id number of the consumable
.PARAMETER requestable
Is consumable requestable?
.PARAMETER purchase_date
Optional Purchase cost of the consumable
.PARAMETER purchase_cost
Optional Purchase cost of the consumable
.PARAMETER model_number
Model number of the consumable in months
.PARAMETER item_no
Item number for the consumable
.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-Snipeitconsumable -name "Ink pack" -qty 20 -category_id 3 -min_amt 5
Create consumable with stock count 20 , alert when stock is 5 or lower
#>
function Set-SnipeitConsumable()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
)]
Param(
[parameter(mandatory = $true)]
[int[]]$id,
[parameter(mandatory = $false)]
[string]$name,
[parameter(mandatory = $false)]
[int]$qty,
[parameter(mandatory = $false)]
[int]$category_id,
[parameter(mandatory = $false)]
[int]$min_amt,
[parameter(mandatory = $false)]
[int]$company_id,
[parameter(mandatory = $false)]
[string]$order_number,
[parameter(mandatory = $false)]
[int]$manufacturer_id,
[parameter(mandatory = $false)]
[int]$location_id,
[parameter(mandatory = $false)]
[bool]$requestable,
[parameter(mandatory = $false)]
[datetime]$purchase_date,
[parameter(mandatory = $false)]
[string]$purchase_cost,
[parameter(mandatory = $false)]
[string]$model_number,
[parameter(mandatory = $false)]
[string]$item_no,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
begin {
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($Values['purchase_date']) {
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
}
$Body = $Values | ConvertTo-Json;
}
process {
foreach($consumable_id in $id ){
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Method = 'Put'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}
}

View file

@ -78,6 +78,7 @@ FunctionsToExport = @(
'Get-SnipeitCategory',
'Get-SnipeitCompany',
'Get-SnipeitComponent',
'Get-SnipeitConsumable',
'Get-SnipeitCustomField',
'Get-SnipeitDepartment',
'Get-SnipeitFieldset',
@ -96,6 +97,7 @@ FunctionsToExport = @(
'New-SnipeitCategory',
'New-SnipeitCompany',
'New-SnipeitComponent',
'New-SnipeitConsumable',
'New-SnipeitCustomField',
'New-SnipeitDepartment',
'New-SnipeitLicense',
@ -109,6 +111,7 @@ FunctionsToExport = @(
'Remove-SnipeitCategory',
'Remove-SnipeitCompany',
'Remove-SnipeitComponent',
'Remove-SnipeitConsumable',
'Remove-SnipeitCustomField',
'Remove-SnipeitDepartment',
'Remove-SnipeitLicense',
@ -125,6 +128,7 @@ FunctionsToExport = @(
'Set-SnipeitCategory'
'Set-SnipeitCompany'
'Set-SnipeitComponent',
'Set-SnipeitConsumable',
'Set-SnipeitCustomField',
'Set-SnipeitDepartment',
'Set-SnipeitInfo',

View file

@ -0,0 +1,273 @@
---
external help file: SnipeitPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# Get-SnipeitConsumable
## SYNOPSIS
Gets a list of Snipe-it consumables
## SYNTAX
### Search (Default)
```
Get-SnipeitConsumable [-search <String>] [-category_id <Int32>] [-company_id <Int32>]
[-manufacturer_id <Int32>] [-location_id <Int32>] [-order <String>] [-sort <String>] [-expand]
[-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
```
### Get with ID
```
Get-SnipeitConsumable [-id <Int32[]>] -url <String> -apiKey <String> [<CommonParameters>]
```
## DESCRIPTION
{{ Fill in the Description }}
## EXAMPLES
### EXAMPLE 1
```
Get-SnipeitConsumable -all
Returns all consumables
```
### EXAMPLE 2
```
Get-SnipeitConsumable -search paper
Returns search results containeing string display
```
### EXAMPLE 3
```
Get-Snipeitconsumable -id
Returns specific consumable
```
## PARAMETERS
### -all
A return all results
```yaml
Type: SwitchParameter
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: False
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: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -category_id
Id number of category
```yaml
Type: Int32
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -company_id
Id number of company
```yaml
Type: Int32
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -expand
Whether to include detailed information on categories, etc (true) or just the text name (false)
```yaml
Type: SwitchParameter
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -id
A id of specific consumable
```yaml
Type: Int32[]
Parameter Sets: Get with ID
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -limit
Specify the number of results you wish to return.
Defaults to 50.
Defines batch size for -all
```yaml
Type: Int32
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: 50
Accept pipeline input: False
Accept wildcard characters: False
```
### -location_id
{{ Fill location_id Description }}
```yaml
Type: Int32
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -manufacturer_id
Id number of manufacturer
```yaml
Type: Int32
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -offset
Offset to use
```yaml
Type: Int32
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -order
Specify the order (asc or desc) you wish to order by on your sort column
```yaml
Type: String
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: Desc
Accept pipeline input: False
Accept wildcard characters: False
```
### -search
A text string to search the consumables
```yaml
Type: String
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -sort
Sort results by column
```yaml
Type: String
Parameter Sets: Search
Aliases:
Required: False
Position: Named
Default value: Created_at
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: 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

117
docs/New-SnipeitCompany.md Normal file
View file

@ -0,0 +1,117 @@
---
external help file: SnipeitPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# New-SnipeitCompany
## SYNOPSIS
Creates a new Company
## SYNTAX
```
New-SnipeitCompany [-name] <String> [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
Creates new company on Snipe-It system
## EXAMPLES
### EXAMPLE 1
```
New-SnipeitCompany -name "Acme Company"
```
## 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
```
### -name
Comapany name
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 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

View file

@ -0,0 +1,301 @@
---
external help file: SnipeitPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# New-SnipeitConsumable
## SYNOPSIS
Add a new Consumable to Snipe-it asset system
## SYNTAX
```
New-SnipeitConsumable [-name] <String> [-qty] <Int32> [-category_id] <Int32> [[-min_amt] <Int32>]
[[-company_id] <Int32>] [[-order_number] <String>] [[-manufacturer_id] <Int32>] [[-location_id] <Int32>]
[[-requestable] <Boolean>] [[-purchase_date] <DateTime>] [[-purchase_cost] <String>]
[[-model_number] <String>] [[-item_no] <String>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
Long description
## EXAMPLES
### EXAMPLE 1
```
New-Snipeitconsumable -name "Ink pack" -qty 20 -category_id 3 -min_amt 5
Create consumable with stock count 20 , alert when stock is 5 or lower
```
## PARAMETERS
### -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
```
### -category_id
Required Category ID of the Consumable, this can be got using Get-SnipeitCategory
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -company_id
Optional Company id
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -item_no
Item number for the consumable
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -location_id
Location id number of the consumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -manufacturer_id
Manufaturer id number of the consumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -min_amt
Optional minimum quantity of comsumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -model_number
Model number of the consumable in months
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -name
Required Name of the Consumable
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -order_number
Optional Order number
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -purchase_cost
Optional Purchase cost of the consumable
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -purchase_date
Optional Purchase cost of the consumable
```yaml
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -qty
Required Quantity of comsumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -requestable
Is consumable requestable?
```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: False
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
```
### -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

View file

@ -0,0 +1,122 @@
---
external help file: SnipeitPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# Remove-SnipeitConsumable
## SYNOPSIS
Removes consumable from Snipe-it asset system
## SYNTAX
```
Remove-SnipeitConsumable [-id] <Int32[]> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
Removes consumable or multiple consumables from Snipe-it asset system
## EXAMPLES
### EXAMPLE 1
```
Remove-SnipeitConsumable -ID 44 -Verbose
```
### EXAMPLE 2
```
Get-SnipeitConsumable -search "paper" | Remove-Snipeitconsumable
```
## 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 consumable 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

View file

@ -0,0 +1,316 @@
---
external help file: SnipeitPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# Set-SnipeitConsumable
## SYNOPSIS
Add a new Consumable to Snipe-it asset system
## SYNTAX
```
Set-SnipeitConsumable [-id] <Int32[]> [[-name] <String>] [[-qty] <Int32>] [[-category_id] <Int32>]
[[-min_amt] <Int32>] [[-company_id] <Int32>] [[-order_number] <String>] [[-manufacturer_id] <Int32>]
[[-location_id] <Int32>] [[-requestable] <Boolean>] [[-purchase_date] <DateTime>] [[-purchase_cost] <String>]
[[-model_number] <String>] [[-item_no] <String>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
Long description
## EXAMPLES
### EXAMPLE 1
```
New-Snipeitconsumable -name "Ink pack" -qty 20 -category_id 3 -min_amt 5
Create consumable with stock count 20 , alert when stock is 5 or lower
```
## PARAMETERS
### -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
```
### -category_id
Required Category ID of the Consumable, this can be got using Get-SnipeitCategory
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -company_id
Optional Company id
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -id
Optional id number of the Consumable
```yaml
Type: Int32[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -item_no
Item number for the consumable
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 14
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -location_id
Location id number of the consumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -manufacturer_id
Manufaturer id number of the consumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -min_amt
Optional minimum quantity of comsumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -model_number
Model number of the consumable in months
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -name
Optional Name of the Consumable
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -order_number
Optional Order number
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -purchase_cost
Optional Purchase cost of the consumable
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -purchase_date
Optional Purchase cost of the consumable
```yaml
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -qty
Optional Quantity of comsumable
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -requestable
Is consumable requestable?
```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: False
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
```
### -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

View file

@ -35,6 +35,9 @@ Gets a list of Snipe-it Companies
### [Get-SnipeitComponent](Get-SnipeitComponent.md)
Gets a list of Snipe-it Components
### [Get-SnipeitConsumable](Get-SnipeitConsumable.md)
Gets a list of Snipe-it consumables
### [Get-SnipeitCustomField](Get-SnipeitCustomField.md)
Returns specific Snipe-IT custom field or a list of all custom field
@ -74,9 +77,15 @@ Add a new Audit to Snipe-it asset system
### [New-SnipeitCategory](New-SnipeitCategory.md)
Create a new Snipe-IT Category
### [New-SnipeitCompany](New-SnipeitCompany.md)
Creates a new Company
### [New-SnipeitComponent](New-SnipeitComponent.md)
Create a new component
### [New-SnipeitConsumable](New-SnipeitConsumable.md)
Add a new Consumable to Snipe-it asset system
### [New-SnipeitCustomField](New-SnipeitCustomField.md)
Add a new Custom Field to Snipe-it asset system
@ -116,6 +125,9 @@ Removes Company from Snipe-it asset system
### [Remove-SnipeitComponent](Remove-SnipeitComponent.md)
Removes component from Snipe-it asset system
### [Remove-SnipeitConsumable](Remove-SnipeitConsumable.md)
Removes consumable from Snipe-it asset system
### [Remove-SnipeitCustomField](Remove-SnipeitCustomField.md)
Removes custom field from Snipe-it asset system
@ -164,6 +176,9 @@ Updates company name
### [Set-SnipeitComponent](Set-SnipeitComponent.md)
Updates component
### [Set-SnipeitConsumable](Set-SnipeitConsumable.md)
Add a new Consumable to Snipe-it asset system
### [Set-SnipeitCustomField](Set-SnipeitCustomField.md)
Add a new Custom Field to Snipe-it asset system