Private/Update-StoreCache.ps1
function Update-StoreCache { param ( ) if (-not $script:CachedStore) { try { Write-Progress -Activity 'Updating store cache' -CurrentOperation 'Downloading' $script:CachedStore = Invoke-WebRequest -Uri https://www.ah.nl/service/obtainment/rest/stores?storeType=SHOP } catch { throw 'Could not update cached store information. Make sure http://ah.nl is reachable.' } Write-Progress -Activity 'Updating service cache' -CurrentOperation 'Parsing' $script:CachedStore = $script:CachedStore | ConvertFrom-Json } } |