Skip to content

Commit 7a3fe47

Browse files
authored
Merge pull request #67 from brianmccarty/null
Null references and outputs updated
2 parents 6f6e7d6 + 0e3fcc3 commit 7a3fe47

25 files changed

+165
-165
lines changed

ITGlueAPI/Internal/APIKey.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ function Remove-ITGlueAPIKey {
2424
}
2525

2626
function Get-ITGlueAPIKey {
27-
if($ITGlue_API_Key -eq $null) {
27+
if($null -eq $ITGlue_API_Key) {
2828
Write-Error "No API key exists. Please run Add-ITGlueAPIKey to add one."
2929
}
3030
else {
3131
$ITGlue_API_Key
3232
}
3333
}
3434

35-
New-Alias -Name Set-ITGlueAPIKey -Value Add-ITGlueAPIKey
35+
New-Alias -Name Set-ITGlueAPIKey -Value Add-ITGlueAPIKey

ITGlueAPI/Resources/ConfigurationInterfaces.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ function New-ITGlueConfigurationInterfaces {
2525
} catch {
2626
Write-Error $_
2727
} finally {
28-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
28+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
2929
}
3030

3131
$data = @{}
32-
$data = $rest_output
32+
$data = $rest_output
3333
return $data
3434
}
3535

@@ -59,7 +59,7 @@ function Get-ITGlueConfigurationInterfaces {
5959
)
6060

6161
$resource_uri = ('/configurations/{0}/relationships/configuration_interfaces/{1}' -f $conf_id, $id)
62-
if (($PsCmdlet.ParameterSetName -eq 'show') -and ($conf_id -eq $null)) {
62+
if (($PsCmdlet.ParameterSetName -eq 'show') -and ($null -eq $conf_id)) {
6363
$resource_uri = ('/configuration_interfaces/{0}' -f $id)
6464
}
6565

@@ -87,11 +87,11 @@ function Get-ITGlueConfigurationInterfaces {
8787
} catch {
8888
Write-Error $_
8989
} finally {
90-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
90+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
9191
}
9292

9393
$data = @{}
94-
$data = $rest_output
94+
$data = $rest_output
9595
return $data
9696
}
9797

@@ -138,10 +138,10 @@ function Set-ITGlueConfigurationInterfaces {
138138
} catch {
139139
Write-Error $_
140140
} finally {
141-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
141+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
142142
}
143143

144144
$data = @{}
145145
$data = $rest_output
146146
return $data
147-
}
147+
}

ITGlueAPI/Resources/ConfigurationStatuses.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ function New-ITGlueConfigurationStatuses {
1515
$ITGlue_Headers.Add('x-api-key', (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password)
1616
$rest_output = Invoke-RestMethod -method 'POST' -uri ($ITGlue_Base_URI + $resource_uri) -headers $ITGlue_Headers `
1717
-body $body -ErrorAction Stop -ErrorVariable $web_error
18-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
18+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
1919

2020
$data = @{}
21-
$data = $rest_output
21+
$data = $rest_output
2222
return $data
2323
}
2424

@@ -53,7 +53,7 @@ function Get-ITGlueConfigurationStatuses {
5353
}
5454
if ($sort) {
5555
$body += @{'sort' = $sort}
56-
}
56+
}
5757
if ($page_number) {
5858
$body += @{'page[number]' = $page_number}
5959
}
@@ -65,10 +65,10 @@ function Get-ITGlueConfigurationStatuses {
6565
$ITGlue_Headers.Add('x-api-key', (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password)
6666
$rest_output = Invoke-RestMethod -method 'GET' -uri ($ITGlue_Base_URI + $resource_uri) -headers $ITGlue_Headers `
6767
-body $body -ErrorAction Stop -ErrorVariable $web_error
68-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
68+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
6969

7070
$data = @{}
71-
$data = $rest_output
71+
$data = $rest_output
7272
return $data
7373
}
7474

@@ -81,7 +81,7 @@ function Set-ITGlueConfigurationStatuses {
8181
$data
8282
)
8383

84-
$resource_uri = ('/configuration_statuses/{0}' -f $id)
84+
$resource_uri = ('/configuration_statuses/{0}' -f $id)
8585

8686
$body = @{}
8787

@@ -92,9 +92,9 @@ function Set-ITGlueConfigurationStatuses {
9292
$ITGlue_Headers.Add('x-api-key', (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password)
9393
$rest_output = Invoke-RestMethod -method 'PATCH' -uri ($ITGlue_Base_URI + $resource_uri) -headers $ITGlue_Headers `
9494
-body $body -ErrorAction Stop -ErrorVariable $web_error
95-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
95+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
9696

9797
$data = @{}
98-
$data = $rest_output
98+
$data = $rest_output
9999
return $data
100-
}
100+
}

ITGlueAPI/Resources/ConfigurationTypes.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ function New-ITGlueConfigurationTypes {
1919
} catch {
2020
Write-Error $_
2121
} finally {
22-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
22+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
2323
}
2424

2525
$data = @{}
26-
$data = $rest_output
26+
$data = $rest_output
2727
return $data
2828
}
2929

@@ -74,11 +74,11 @@ function Get-ITGlueConfigurationTypes {
7474
} catch {
7575
Write-Error $_
7676
} finally {
77-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
77+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
7878
}
7979

8080
$data = @{}
81-
$data = $rest_output
81+
$data = $rest_output
8282
return $data
8383
}
8484

@@ -91,7 +91,7 @@ function Set-ITGlueConfigurationTypes {
9191
$data
9292
)
9393

94-
$resource_uri = ('/configuration_types/{0}' -f $id)
94+
$resource_uri = ('/configuration_types/{0}' -f $id)
9595

9696
$body = @{}
9797

@@ -106,10 +106,10 @@ function Set-ITGlueConfigurationTypes {
106106
} catch {
107107
Write-Error $_
108108
} finally {
109-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
109+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
110110
}
111111

112112
$data = @{}
113-
$data = $rest_output
113+
$data = $rest_output
114114
return $data
115-
}
115+
}

ITGlueAPI/Resources/Configurations.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ function New-ITGlueConfigurations {
2525
} catch {
2626
Write-Error $_
2727
} finally {
28-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
28+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
2929
}
3030

3131
$data = @{}
32-
$data = $rest_output
32+
$data = $rest_output
3333
return $data
3434
}
3535

@@ -149,12 +149,12 @@ function Get-ITGlueConfigurations {
149149
} catch {
150150
Write-Error $_
151151
} finally {
152-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
152+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
153153
}
154154

155155

156156
$data = @{}
157-
$data = $rest_output
157+
$data = $rest_output
158158
return $data
159159
}
160160

@@ -253,11 +253,11 @@ function Set-ITGlueConfigurations {
253253
} catch {
254254
Write-Error $_
255255
} finally {
256-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
256+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
257257
}
258258

259259
$data = @{}
260-
$data = $rest_output
260+
$data = $rest_output
261261
return $data
262262
}
263263

@@ -345,10 +345,10 @@ function Remove-ITGlueConfigurations {
345345
} catch {
346346
Write-Error $_
347347
} finally {
348-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
348+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
349349
}
350350

351351
$data = @{}
352-
$data = $rest_output
352+
$data = $rest_output
353353
return $data
354354
}

ITGlueAPI/Resources/ContactTypes.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ function New-ITGlueContactTypes {
1919
} catch {
2020
Write-Error $_
2121
} finally {
22-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
22+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
2323
}
2424

2525
$data = @{}
26-
$data = $rest_output
26+
$data = $rest_output
2727
return $data
2828
}
2929

@@ -74,11 +74,11 @@ function Get-ITGlueContactTypes {
7474
} catch {
7575
Write-Error $_
7676
} finally {
77-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
77+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
7878
}
7979

8080
$data = @{}
81-
$data = $rest_output
81+
$data = $rest_output
8282
return $data
8383
}
8484

@@ -91,7 +91,7 @@ function Set-ITGlueContactTypes {
9191
$data
9292
)
9393

94-
$resource_uri = ('/contact_types/{0}' -f $id)
94+
$resource_uri = ('/contact_types/{0}' -f $id)
9595

9696
$body = @{}
9797

@@ -106,10 +106,10 @@ function Set-ITGlueContactTypes {
106106
} catch {
107107
Write-Error $_
108108
} finally {
109-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
109+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
110110
}
111111

112112
$data = @{}
113-
$data = $rest_output
113+
$data = $rest_output
114114
return $data
115-
}
115+
}

ITGlueAPI/Resources/Contacts.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ function New-ITGlueContacts {
2525
} catch {
2626
Write-Error $_
2727
} finally {
28-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
28+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
2929
}
3030

3131
$data = @{}
32-
$data = $rest_output
32+
$data = $rest_output
3333
return $data
3434
}
3535

@@ -134,11 +134,11 @@ function Get-ITGlueContacts {
134134
} catch {
135135
Write-Error $_
136136
} finally {
137-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
137+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
138138
}
139139

140140
$data = @{}
141-
$data = $rest_output
141+
$data = $rest_output
142142
return $data
143143
}
144144

@@ -225,11 +225,11 @@ function Set-ITGlueContacts {
225225
} catch {
226226
Write-Error $_
227227
} finally {
228-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
228+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
229229
}
230230

231231
$data = @{}
232-
$data = $rest_output
232+
$data = $rest_output
233233
return $data
234234
}
235235

@@ -244,10 +244,10 @@ function Remove-ITGlueContacts {
244244

245245
[Parameter(ParameterSetName = 'bulk_destroy')]
246246
[String]$filter_last_name = '',
247-
247+
248248
[Parameter(ParameterSetName = 'bulk_destroy')]
249249
[String]$filter_title = '',
250-
250+
251251
[Parameter(ParameterSetName = 'bulk_destroy')]
252252
[Nullable[Int64]]$filter_contact_type_id = $null,
253253

@@ -308,10 +308,10 @@ function Remove-ITGlueContacts {
308308
} catch {
309309
Write-Error $_
310310
} finally {
311-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
311+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
312312
}
313313

314314
$data = @{}
315-
$data = $rest_output
315+
$data = $rest_output
316316
return $data
317317
}

ITGlueAPI/Resources/Countries.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Get-ITGlueCountries {
2323
)
2424

2525
$resource_uri = ('/countries/{0}' -f $id)
26-
26+
2727
if ($PSCmdlet.ParameterSetName -eq "index") {
2828
if ($filter_name) {
2929
$body += @{'filter[name]' = $filter_name}
@@ -49,10 +49,10 @@ function Get-ITGlueCountries {
4949
} catch {
5050
Write-Error $_
5151
} finally {
52-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
52+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
5353
}
5454

5555
$data = @{}
56-
$data = $rest_output
56+
$data = $rest_output
5757
return $data
58-
}
58+
}

0 commit comments

Comments
 (0)