Skip to content

Commit 0e3fcc3

Browse files
committed
faster processing and cleaner method for nulling the output
1 parent 767d2c2 commit 0e3fcc3

24 files changed

+149
-149
lines changed

ITGlueAPI/Resources/ConfigurationInterfaces.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ 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 = @{}
@@ -87,7 +87,7 @@ 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 = @{}
@@ -138,7 +138,7 @@ 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 = @{}

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

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

159159

160160
$data = @{}
161-
$data = $rest_output
161+
$data = $rest_output
162162
return $data
163163
}
164164

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

263263
$data = @{}
264-
$data = $rest_output
264+
$data = $rest_output
265265
return $data
266266
}
267267

@@ -353,10 +353,10 @@ function Remove-ITGlueConfigurations {
353353
} catch {
354354
Write-Error $_
355355
} finally {
356-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
356+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
357357
}
358358

359359
$data = @{}
360-
$data = $rest_output
360+
$data = $rest_output
361361
return $data
362362
}

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: 11 additions & 11 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
317-
}
317+
}

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+
}

ITGlueAPI/Resources/FlexibleAssetFields.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function New-ITGlueFlexibleAssetFields {
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 = @{}
@@ -92,7 +92,7 @@ function Get-ITGlueFlexibleAssetFields {
9292
} catch {
9393
Write-Error $_
9494
} finally {
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

9898
$data = @{}
@@ -143,7 +143,7 @@ function Set-ITGlueFlexibleAssetFields {
143143
} catch {
144144
Write-Error $_
145145
} finally {
146-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
146+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
147147
}
148148

149149
$data = @{}
@@ -175,7 +175,7 @@ function Remove-ITGlueFlexibleAssetFields {
175175
} catch {
176176
Write-Error $_
177177
} finally {
178-
$ITGlue_Headers.Remove('x-api-key') >$null # Quietly clean up scope so the API key doesn't persist
178+
[void] ($ITGlue_Headers.Remove('x-api-key')) # Quietly clean up scope so the API key doesn't persist
179179
}
180180

181181
$data = @{}

0 commit comments

Comments
 (0)