Skip to content

Commit

Permalink
[PS][Experimental] add withHttpInfo support, fix "null" return (OpenA…
Browse files Browse the repository at this point in the history
…PITools#5811)

* add with http support

* use full name in tests

* using full name in test

* skip type check
  • Loading branch information
wing328 authored and michaelpro1 committed May 7, 2020
1 parent c21fe3c commit 0c5ae07
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}}

{{/allParams}}
.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}None{{/returnType}}
Expand All @@ -26,9 +30,11 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
[Parameter(Position = {{vendorExtensions.x-index}}{{#-first}}, ValueFromPipeline = $true{{/-first}}, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[{{{vendorExtensions.x-powershell-data-type}}}]
{{=<% %>=}}
${<%paramName%>}<%^-last%>,<%/-last%>
${<%paramName%>},
<%={{ }}=%>
{{/allParams}}
[Switch]
$WithHttpInfo
)

Process {
Expand All @@ -42,7 +48,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter
$LocalVarBodyParameter = $null

$Configuration = Get-{{{apiNamePrefix}}}Configuration
{{#hasProduces}}
Expand Down Expand Up @@ -194,7 +200,11 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
-CookieParameters $LocalVarCookieParameters `
-ReturnType "{{#returnType}}{{{.}}}{{/returnType}}"

return $LocalVarResult["Response"]
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
return @{
Response = DeserializeResponse -Response $Response -ReturnType $ReturnType
StatusCode = $Response.StatusCode
Headers = $Response.ResponseHeaders
Headers = $Response.Headers
}
}

Expand Down
Loading

0 comments on commit 0c5ae07

Please sign in to comment.