Skip to content

Commit

Permalink
Merge pull request #144 from snazy2000/develop
Browse files Browse the repository at this point in the history
Casesensitivity for file and function names
  • Loading branch information
PetriAsi authored Jun 8, 2021
2 parents f8f5224 + 8c41f41 commit 2309dd6
Show file tree
Hide file tree
Showing 108 changed files with 884 additions and 879 deletions.
34 changes: 17 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### New features
Most of "Set" command accepts piped input. Piped objects "id" attribute
is used to select asset set values. Like
Get-SnipeItAsset -model_id 213 | Set-SnipeItAsset -notes 'This is nice!'
Get-SnipeitAsset -model_id 213 | Set-SnipeitAsset -notes 'This is nice!'

Set command accept id parameter as array, so its easier to set multiple items
in one run.
Expand All @@ -29,7 +29,7 @@ needed
## More Activity

### New features
SnipeIt activity history is now searchable. So finding out checked out the
Snipeit activity history is now searchable. So finding out checked out the
assest its easy. Api support many different target or item types that can
be uses as filter. Searchable types are 'Accessory','Asset','AssetMaintenance'
,'AssetModel','Category','Company','Component','Consumable','CustomField',
Expand All @@ -38,51 +38,51 @@ be uses as filter. Searchable types are 'Accessory','Asset','AssetMaintenance'


### New Functions
- Get-SnipeItActivity Get and search Snipe-It change history.
- Get-SnipeitActivity Get and search Snipe-It change history.


# [v1.3.x] - 2021-05-27

## Checking out accessories

### New features
You can specify Put or Patch for Set-SnipeItAsset when updating assets.
Set-SnipeItLocation new -city parameter
You can specify Put or Patch for Set-SnipeitAsset when updating assets.
Set-SnipeitLocation new -city parameter

### New Functions
- Set-SnipeItAccessoryOwner checkout accessory
- Get-SnipeItAccessoryOwner list checkedout accessories
- Reset-SnipeItAccessoryOwner checkin accessory
- Set-SnipeitAccessoryOwner checkout accessory
- Get-SnipeitAccessoryOwner list checkedout accessories
- Reset-SnipeitAccessoryOwner checkin accessory

### Fixes
- Set-SnipeItAsset fixed datetime and name inputs #126,128
- Set-SnipeitAsset fixed datetime and name inputs #126,128
-

# [v1.2.x] - 2021-05-24

## Prefixing SnipeItPS
## Prefixing SnipeitPS

### New Features
All commands are now prefixed like Set-Info -> Set-SnipeItInfo.
All commands are now prefixed like Set-Info -> Set-SnipeitInfo.
To keep compatibility all old commands are available as aliases.
To update existing scripts theres Update-SnipeItAlias command.
To update existing scripts theres Update-SnipeitAlias command.

### New fuctions
- Update-SnipeitAlias Tool to update existing scripts
- Get-SnipeItLicenceSeat lists license seats
- Set-SnipeItLicenseSeat Set and checkouts/in license seats
- Get-SnipeitLicenceSeat lists license seats
- Set-SnipeitLicenseSeat Set and checkouts/in license seats
Licenseseat api is supported from Snipe-It release => v5.1.5

### New fixes
Added -id parameter support to support Get-SnipeItCustomField and
Get-SnipeItFieldSet commands
Added -id parameter support to support Get-SnipeitCustomField and
Get-SnipeitFieldSet commands

# [v1.1.x] - 2021-05-18

## Pull request rollup release. Lots of new features including:

### New features
- Powershell 7 compatibility. So you can use SnipeItPS on macos or linux .
- Powershell 7 compatibility. So you can use SnipeitPS on macos or linux .
- Get every asset, model, licence with snipeit id by using -id parameter
- Get assets also by -asset_tag -or serialnumber
- Get functions also return all results from snipe when using -all parameter (by @PetriAsi)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Update-Module SnipeitPS
# To use each session:
Import-Module SnipeitPS
Set-SnipeItInfo -URL 'https://asset.example.com' -apiKey 'tokenKey'
Set-SnipeitInfo -URL 'https://asset.example.com' -apiKey 'tokenKey'
```

### Usage

```powershell
# Review the help at any time!
Get-Command -Module SnipeitPS
Get-Help Get-SnipeItAsset -Full # or any other command
Get-Help Get-SnipeitAsset -Full # or any other command
```
### Reporting bugs and issues
Please use -Verbose switch with command you have problem with.
Expand Down
File renamed without changes.
38 changes: 0 additions & 38 deletions SnipeitPS/Private/Get-SnipeItAlias.ps1

This file was deleted.

38 changes: 38 additions & 0 deletions SnipeitPS/Private/Get-SnipeitAlias.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Function Get-SnipeitAlias(){
@{'Get-Asset' = 'Get-SnipeitAsset';
'Get-AssetMaintenance' = 'Get-SnipeitAssetMaintenance';
'Get-Category' = 'Get-SnipeitCategory';
'Get-Company' = 'Get-SnipeitCompany';
'Get-Component' = 'Get-SnipeitCompany';
'Get-CustomField' = 'Get-SnipeitCustomField';
'Get-Department' = 'Get-SnipeitDepartment';
'Get-Fieldset' = 'Get-SnipeitFieldset';
'Get-Manufacturer' = 'Get-SnipeitManufacturer';
'Get-Model' = 'Get-SnipeitModel';
'Get-Status' = 'Get-SnipeitStatus';
'Get-Supplier' = 'Get-SnipeitSupplier';
'Get-User' = 'Get-SnipeitUser';
'New-Asset' = 'New-SnipeitAsset';
'New-AssetMaintenance' = 'New-SnipeitAssetMaintenance';
'New-Category' = 'New-SnipeitCategory';
'New-Component' = 'New-SnipeitComponent';
'New-CustomField' = 'New-SnipeitCustomField';
'New-Department' = 'New-SnipeitDepartment';
'New-License' = 'New-SnipeitLicense';
'Set-License' = 'Set-SnipeitLicense';
'New-Location' = 'New-SnipeitLocation';
'New-Manufacturer' = 'New-SnipeitManufacturer';
'New-Model' = 'New-SnipeitModel';
'New-User' = 'New-SnipeitUser';
'Set-Asset' = 'Set-SnipeitAsset';
'Set-AssetOwner' = 'Set-SnipeitAssetOwner';
'Set-Component' = 'Set-SnipeitComponent';
'Set-Model' = 'Set-SnipeitModel';
'Set-Info' = 'Set-SnipeitInfo';
'Set-User' = 'Set-SnipeitUser';
'New-Accessory' = 'New-SnipeitAccessory';
'Set-Accessory' = 'Set-SnipeitAccessory';
'Get-Accessory' = 'Get-SnipeitAccessory';
'Remove-Asset' = 'Remove-SnipeitAsset';
'Remove-User' = 'Remove-SnipeitUser';}
}
18 changes: 0 additions & 18 deletions SnipeitPS/Private/Set-SnipeItAlias.ps1

This file was deleted.

18 changes: 18 additions & 0 deletions SnipeitPS/Private/Set-SnipeitAlias.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function Set-SnipeitAlias()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
)]
param()
Write-Verbose "Setting compatibility aliases.. "
Write-Verbose "All aliases are deprediated."
$SnipeitAliases = get-SnipeitAlias
ForEach ($key in $SnipeitAliases.Keys ) {
New-Alias -Name $key -Value $($SnipeitAliases[$key]) -Scope 1
Write-Verbose ("{0,5} -> {1}" -f $key,$($SnipeitAliases[$key]))
}
Write-Verbose "Please start using native 'Snipeit' prfixed functions instead."
Get-Command -Module SnipeitPS -CommandType Alias | Select-Object -Property DisplayName,ResolvedCommand

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Test-SnipeItAlias()
function Test-SnipeitAlias()
{
[CmdletBinding()]
param(
Expand All @@ -9,7 +9,7 @@ function Test-SnipeItAlias()
)
if($invocationName -ne $commandName) {
Write-Warning "$invocationName is still working, but it has been superceded by $commandName, please use it instead."
Write-Warning 'To update your scripts you can use Update-SnipeItAlias helper function: '
Write-Warning '"Get-Content [your-script.ps1] | Update-SnipeItAlias | Out-File [new-script-name.ps1]"'
Write-Warning 'To update your scripts you can use Update-SnipeitAlias helper function: '
Write-Warning '"Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1]"'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ Result offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
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
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
.EXAMPLE
Get-SnipeItAccessory -search Keyboard
Get-SnipeitAccessory -search Keyboard
.EXAMPLE
Get-SnipeItAccessory -id 1
Get-SnipeitAccessory -id 1
#>

function Get-SnipeItAccessory() {
function Get-SnipeitAccessory() {
Param(
[parameter(ParameterSetName='Search')]
[string]$search,
Expand Down Expand Up @@ -76,7 +76,7 @@ function Get-SnipeItAccessory() {
[parameter(mandatory = $true)]
[string]$apiKey
)
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name

if ($id -and $search){
throw "Please specify only one of -id or -search parameter"
Expand All @@ -103,7 +103,7 @@ function Get-SnipeItAccessory() {
while ($true) {
$callargs['offset'] = $offstart
$callargs['limit'] = $limit
$res=Get-SnipeItAccessory @callargs
$res=Get-SnipeitAccessory @callargs
$res
if ($res.count -lt $limit) {
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
Unique ID For accessory to list
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
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
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
.EXAMPLE
Get-SnipeItAccessoryOwner -id 1
Get-SnipeitAccessoryOwner -id 1
#>
function Get-SnipeItAccessoryOwner()
function Get-SnipeitAccessoryOwner()
{
[CmdletBinding(
SupportsShouldProcess = $true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ Result offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
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
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
.EXAMPLE
Get-SnipeItAccessory -search Keyboard
Get-SnipeitAccessory -search Keyboard
.EXAMPLE
Get-SnipeItAccessory -id 1
Get-SnipeitAccessory -id 1
#>

function Get-SnipeItActivity() {
function Get-SnipeitActivity() {
Param(

[string]$search,
Expand Down Expand Up @@ -106,7 +106,7 @@ function Get-SnipeItActivity() {
while ($true) {
$callargs['offset'] = $offstart
$callargs['limit'] = $limit
$res=Get-SnipeItActivity @callargs
$res=Get-SnipeitActivity @callargs
$res
if ($res.count -lt $limit) {
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
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
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
.EXAMPLE
Get-SnipeItAsset -url "https://assets.example.com"-token "token..."
Get-SnipeitAsset -url "https://assets.example.com"-token "token..."
.EXAMPLE
Get-SnipeItAsset -search "myMachine"-url "https://assets.example.com"-token "token..."
Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..."
.EXAMPLE
Get-SnipeItAsset -search "myMachine"-url "https://assets.example.com"-token "token..."
Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..."
.EXAMPLE
Get-SnipeItAsset -asset_tag "myAssetTag"-url "https://assets.example.com"-token "token..."
Get-SnipeitAsset -asset_tag "myAssetTag"-url "https://assets.example.com"-token "token..."
#>

function Get-SnipeItAsset() {
function Get-SnipeitAsset() {
Param(
[parameter(ParameterSetName='Search')]
[string]$search,
Expand Down Expand Up @@ -138,7 +138,7 @@ function Get-SnipeItAsset() {
[parameter(mandatory = $true)]
[string]$apiKey
)
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name

$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters

Expand Down Expand Up @@ -185,7 +185,7 @@ function Get-SnipeItAsset() {
while ($true) {
$callargs['offset'] = $offstart
$callargs['limit'] = $limit
$res=Get-SnipeItAsset @callargs
$res=Get-SnipeitAsset @callargs
$res
if ( $res.count -lt $limit) {
break
Expand Down
Loading

0 comments on commit 2309dd6

Please sign in to comment.