Skip to content

Commit f50a702

Browse files
committed
Refactor CmdletsToExport to an empty array and add new Get and Delete methods to FolioClient class
1 parent 846ea0b commit f50a702

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/FolioClient/FolioClient.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ PowerShellVersion = '5.1'
7272
FunctionsToExport = @("Get-FolioClient", "Get-FolioRecordsByQuery", "Get-FolioRecordIdsByQuery", "Get-FolioRecordIdsToCsvByQuery", "Invoke-FolioGetAll")
7373

7474
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75-
CmdletsToExport = @("Get-FolioClient", "Get-FolioRecordsByQuery", "Get-FolioRecordIdsByQuery", "Get-FolioRecordIdsToCsvByQuery", "Invoke-FolioGetAll")
75+
CmdletsToExport = @()
7676

7777
# Variables to export from this module
7878
VariablesToExport = '*'

src/FolioClient/FolioClient.psm1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,23 @@ class FolioClient {
238238
}
239239
}
240240

241+
[PSCustomObject] Get([string]$endpoint, [string]$query, [hashtable]$queryParams = @{}) {
242+
if (-not $queryParams) {
243+
$queryParams = @{}
244+
}
245+
246+
if ($null -ne $query -and $query -ne "") {
247+
$queryParams["query"] = $query
248+
}
249+
250+
return $this.InvokeRestMethodWithAuth($endpoint, "GET", @{}, $null, $queryParams)
251+
}
252+
253+
[PSCustomObject] Delete([string]$endpoint, [string]$query, [hashtable]$queryParams) {
254+
$fullEndpoint = if ([string]::IsNullOrEmpty($query)) { $endpoint } else { "$endpoint`?$query" }
255+
return $this.Delete($fullEndpoint, $queryParams)
256+
}
257+
241258
[PSCustomObject] Get([string]$endpoint, [hashtable]$queryParams = @{}) {
242259
return $this.InvokeRestMethodWithAuth($endpoint, "GET", @{}, $null, $queryParams)
243260
}

0 commit comments

Comments
 (0)