Skip to content

Commit

Permalink
Get-Staff by StaffId and pipeline fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mabster committed Dec 1, 2021
1 parent 8452bba commit 1bc29f0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Timetabler/Timetabler.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Timetabler.psm1'

# Version number of this module.
ModuleVersion = '0.3'
ModuleVersion = '0.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
2 changes: 1 addition & 1 deletion Timetabler/public/Get-CTRoom.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function Get-CTRoom {
[CmdletBinding(DefaultParameterSetName='notid')]
param (
[Parameter(Mandatory, Position=0, ParameterSetName='id')]
[Parameter(Mandatory, Position=0, ParameterSetName='id', ValueFromPipelineByPropertyName)]
[Alias('id')]
[string] $Roomid,

Expand Down
5 changes: 4 additions & 1 deletion Timetabler/public/Get-CTRoomAssignment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ function Get-CTRoomAssignment {
$uri = [uri]::new($url, $path)

try {
(Invoke-RestMethod -Uri $uri -Headers $headers)
$response = (Invoke-RestMethod -Uri $uri -Headers $headers)
if ($response) {
return $response
}
}
catch {
if ($_.Exception.Response.StatusCode -ne 404) {
Expand Down
5 changes: 5 additions & 0 deletions Timetabler/public/Get-CTStaff.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
function Get-CTStaff {
[CmdletBinding(DefaultParameterSetName='notid')]
param (
[Parameter(Mandatory, Position=0, ParameterSetName='id', ValueFromPipelineByPropertyName)]
[Alias('id')]
[int] $StaffId,

[Parameter(ParameterSetName='notid')]
[int] $Page,

Expand Down Expand Up @@ -108,6 +112,7 @@ function Get-CTStaff {
(Invoke-RestMethod -Uri $uri -Headers $headers) | Add-Member -MemberType AliasProperty -Name StaffId -Value Id -PassThru
}
catch {
write-host 'yo!'
if ($_.Exception.Response.StatusCode -ne 404) {
throw
}
Expand Down
5 changes: 4 additions & 1 deletion Timetabler/public/Get-CTStaffAssignment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ function Get-CTStaffAssignment {
$uri = [uri]::new($url, $path)

try {
(Invoke-RestMethod -Uri $uri -Headers $headers)
$response = (Invoke-RestMethod -Uri $uri -Headers $headers)
if ($response) {
return $response
}
}
catch {
if ($_.Exception.Response.StatusCode -ne 404) {
Expand Down

0 comments on commit 1bc29f0

Please sign in to comment.