parameters:
  - name: Paths
    type: object
    default: []

steps:
  - task: PowerShell@2
    displayName: 'Restore Test Proxy Recordings'
    inputs:
      targetType: inline
      script: |
        $paths = '${{ convertToJson(parameters.Paths) }}'.Trim('"') | ConvertFrom-Json
        foreach($path in $paths) {
          Get-ChildItem -Recurse -Path $(Build.SourcesDirectory)$path -Filter assets.json | ForEach-Object { test-proxy restore -a $_.FullName }
        }
      pwsh: true
