File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 22 [string ] $ModuleName ,
33 [string ] $ModuleRegex ,
44 [string ] $OpenApiDocOutput ,
5- [string ] $GraphVersion
5+ [string ] $GraphVersion ,
6+ [int ] $RequestCount
67)
78
8- if (-not (Test-Path $OpenApiDocOutput )) {
9+ if (-not (Test-Path $OpenApiDocOutput )) {
910 New-Item - Path $OpenApiDocOutput - Type Directory
1011}
11-
12+
1213$OpenApiBaseUrl = " https://graphexplorerapi.azurewebsites.net"
1314$OpenApiServiceUrl = (" $OpenApiBaseUrl /`$ openapi?tags={0}&title=$ModuleName &openapiversion=3&style=Powershell&graphVersion=$GraphVersion " -f $ModuleRegex )
15+ if ($RequestCount -eq 0 ) {
16+ $OpenApiServiceUrl = " $OpenApiServiceUrl &forceRefresh=true"
17+ }
1418
15- Write-Host - ForegroundColor Green " Downloading OpenAPI doc for '$ModuleName ' module: $OpenApiServiceUrl "
19+ Write-Host - ForegroundColor Green " [ $RequestCount ] Downloading OpenAPI doc for '$ModuleName ' module: $OpenApiServiceUrl "
1620Invoke-WebRequest $OpenApiServiceUrl - OutFile " $OpenApiDocOutput \$ModuleName .yml"
Original file line number Diff line number Diff line change @@ -29,16 +29,16 @@ if (-not (Test-Path $ModuleMappingConfigPath)) {
2929}
3030
3131[HashTable ] $ModuleMapping = Get-Content $ModuleMappingConfigPath | ConvertFrom-Json - AsHashTable
32- $ModuleMapping.Keys | ForEach-Object {
32+ $ModuleMapping.Keys | ForEach-Object - Begin { $RequestCount = 0 } - End { Write-Host - ForeGroundColor Green " Requests: $RequestCount " } - Process {
3333 $ModuleName = $_
34-
35- try {
36- # Download OpenAPI document for module.
37- & $DownloadOpenApiDocPS1 - ModuleName $ModuleName - ModuleRegex $ModuleMapping [ $ModuleName ] - OpenApiDocOutput $OpenApiDocOutput - GraphVersion $GraphVersion
38- }
39- catch {
40- Write-Error $_ .Exception
41- }
34+ try {
35+ # Download OpenAPI document for module.
36+ & $DownloadOpenApiDocPS1 - ModuleName $ModuleName - ModuleRegex $ModuleMapping [ $ModuleName ] - OpenApiDocOutput $OpenApiDocOutput - GraphVersion $GraphVersion - RequestCount $RequestCount
37+ }
38+ catch {
39+ Write-Error $_ .Exception
40+ }
41+ $RequestCount = $RequestCount + 1
4242}
4343
4444
You can’t perform that action at this time.
0 commit comments