@@ -94,20 +94,20 @@ function Get-Files {
94
94
$Uripaths = Find-MgGraphCommand - Command $Command
95
95
$UriPath = $null
96
96
if (-not ([string ]::IsNullOrEmpty($Uripaths ))) {
97
- if ($Uripaths.APIVersion.Contains ($ProfileGraph )) {
98
- if ($Uripaths.Length -gt 1 ) {
99
- $UriPath = $UriPaths.URI [0 ].ToString()
97
+ if ($Uripaths.APIVersion.Contains ($ProfileGraph )) {
98
+ if ($Uripaths.Length -gt 1 ) {
99
+ $UriPath = $UriPaths.URI [0 ].ToString()
100
+ }
101
+ else {
102
+ $UriPath = $UriPaths.URI.ToString ()
103
+ }
104
+ }
105
+ if ($UriPath ) {
106
+ $Method = $UriPaths.Method
107
+ Get-ExternalDocs - Url - GraphProfile $GraphProfile - Url - UriPath $UriPath - Command $Command - OpenApiContent $OpenApiContent - File $File - Method $Method
100
108
}
101
- else {
102
- $UriPath = $UriPaths.URI.ToString ()
103
- }
104
- }
105
- if ($UriPath ) {
106
- $Method = $UriPaths.Method
107
- Get-ExternalDocs - Url - GraphProfile $GraphProfile - Url - UriPath $UriPath - Command $Command - OpenApiContent $OpenApiContent - File $File - Method $Method
108
109
}
109
110
}
110
- }
111
111
# Start-Sleep -Seconds 10
112
112
}
113
113
}
@@ -141,35 +141,36 @@ function Get-ExternalDocs-Url {
141
141
$MethodName = $Method | Out-String
142
142
$ExternalDocUrl = $Path [$UriPath ].values.externalDocs.url
143
143
144
- if ([string ]::IsNullOrEmpty($ExternalDocUrl )) {
144
+ if ([string ]::IsNullOrEmpty($ExternalDocUrl )) {
145
145
$PathSplit = $UriPath.Split (" /" )
146
146
$PathToAppend = $PathSplit [$PathSplit.Count - 1 ]
147
- if ($PathToAppend.StartsWith (" {" ) -or $PathToAppend.StartsWith (" $" )){
148
- # skip
149
- }else {
150
- $PathRebuild = " /" + $PathSplit [0 ]
151
- for ($i = 1 ; $i -lt $PathSplit.Count - 1 ; $i ++ ){
152
- $PathRebuild += $PathSplit [$i ]+ " /"
147
+ if ($PathToAppend.StartsWith (" {" ) -or $PathToAppend.StartsWith (" $" )) {
148
+ # skip
153
149
}
154
- $RebuiltPath = $PathRebuild + " microsoft.graph." + $PathToAppend
155
- $ExternalDocUrl = $path [$RebuiltPath ].get.externalDocs.url
156
- }
157
- }
158
- if ($MethodName -eq " POST" ) {
159
- $ExternalDocUrl = $path [$UriPath ].post.externalDocs.url
160
- }
150
+ else {
151
+ $PathRebuild = " /" + $PathSplit [0 ]
152
+ for ($i = 1 ; $i -lt $PathSplit.Count - 1 ; $i ++ ) {
153
+ $PathRebuild += $PathSplit [$i ] + " /"
154
+ }
155
+ $RebuiltPath = $PathRebuild + " microsoft.graph." + $PathToAppend
156
+ $ExternalDocUrl = $path [$RebuiltPath ].get.externalDocs.url
157
+ }
158
+ }
159
+ if ($MethodName -eq " POST" ) {
160
+ $ExternalDocUrl = $path [$UriPath ].post.externalDocs.url
161
+ }
161
162
162
- if ($MethodName -eq " PATCH" ) {
163
- $ExternalDocUrl = $path [$UriPath ].patch.externalDocs.url
164
- }
163
+ if ($MethodName -eq " PATCH" ) {
164
+ $ExternalDocUrl = $path [$UriPath ].patch.externalDocs.url
165
+ }
165
166
166
- if ($MethodName -eq " DELETE" ) {
167
- $ExternalDocUrl = $path [$UriPath ].delete.externalDocs.url
168
- }
167
+ if ($MethodName -eq " DELETE" ) {
168
+ $ExternalDocUrl = $path [$UriPath ].delete.externalDocs.url
169
+ }
169
170
170
- if ($MethodName -eq " PUT" ) {
171
- $ExternalDocUrl = $path [$UriPath ].put.externalDocs.url
172
- }
171
+ if ($MethodName -eq " PUT" ) {
172
+ $ExternalDocUrl = $path [$UriPath ].put.externalDocs.url
173
+ }
173
174
174
175
if (-not ([string ]::IsNullOrEmpty($ExternalDocUrl ))) {
175
176
# $Url = $ExternalDocUrl.split(" ")
@@ -225,22 +226,23 @@ function WebScrapping {
225
226
}
226
227
}
227
228
# Remove single and double qoutes from ms prod
228
- $MsprodContent = $MsprodContent.Replace (" `" " , " " )
229
- $MsprodContent = $MsprodContent.Replace (" '" , " " )
229
+ $MsprodContent = $MsprodContent.Replace (" `" " , " " )
230
+ $MsprodContent = $MsprodContent.Replace (" '" , " " )
230
231
$MetaDataText = " schema: 2.0.0`r`n $MsprodContent "
231
232
(Get-Content $File ) |
232
233
Foreach-Object { $_ -replace ' schema: 2.0.0' , $MetaDataText } |
233
234
Out-File $File
234
235
}
235
236
Set-Location microsoftgraph- docs- powershell
236
237
$date = Get-Date - Format " dd-MM-yyyy"
237
- $proposedBranch = " weekly_update_help_files_" + $date
238
+ $proposedBranch = " weekly_update_help_files_" + $date
238
239
$exists = git branch - l $proposedBranch
239
240
if ([string ]::IsNullOrEmpty($exists )) {
240
241
git checkout - b $proposedBranch
241
- }else {
242
- Write-Host " Branch already exists"
243
- git checkout $proposedBranch
242
+ }
243
+ else {
244
+ Write-Host " Branch already exists"
245
+ git checkout $proposedBranch
244
246
}
245
247
if (! (Get-Module " powershell-yaml" - ListAvailable - ErrorAction SilentlyContinue)) {
246
248
Install-Module " powershell-yaml" - AcceptLicense - Scope CurrentUser - Force
0 commit comments