Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions openapi3/codegen-templates/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ function {{{vendorExtensions.x-powershell-method-name}}} {


if ($IncludeNullValues.IsPresent) {
$LocalVarBodyParameter = ${{{paramName}}} | ConvertTo-Json -Depth 100
$LocalVarBodyParameter = ${{{paramName}}} | ConvertTo-Json -Depth 100 -Compress
}
else{
$LocalVarBodyParameter = Remove-NullProperties -InputObject ${{{paramName}}} | ConvertTo-Json -Depth 100
$LocalVarBodyParameter = Remove-NullProperties -InputObject ${{{paramName}}} | ConvertTo-Json -Depth 100 -Compress
}

{{/bodyParam}}
Expand Down Expand Up @@ -259,12 +259,12 @@ function {{{vendorExtensions.x-powershell-method-name}}} {

{{#vendorExtensions.x-ps-return-type-one-of}}
# process oneOf response
$LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"] -Depth 100)
$LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"] -Depth 100 -Compress)

{{/vendorExtensions.x-ps-return-type-one-of}}
{{#vendorExtensions.x-ps-return-type-any-of}}
# process anyOf response
$LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"] -Depth 100)
$LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"] -Depth 100 -Compress)

{{/vendorExtensions.x-ps-return-type-any-of}}
if ($WithHttpInfo.IsPresent) {
Expand Down
18 changes: 9 additions & 9 deletions openapi3/codegen-templates/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
# construct URL query string
$HttpValues = [System.Web.HttpUtility]::ParseQueryString([String]::Empty)
foreach ($Parameter in $QueryParameters.GetEnumerator()) {
if ($Parameter.Value.Count -gt 1) { // array
if ($Parameter.Value.Count -gt 1) { # array
foreach ($Value in $Parameter.Value) {
$HttpValues.Add($Parameter.Key + '[]', $Value)
}
Expand All @@ -91,23 +91,23 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
if ($FormParameters -and $FormParameters.Count -gt 0) {
if (![string]::IsNullOrEmpty($MultiPartBoundary)) {
$RequestBody = ""
$LF = "`r`n"
$CRLF = "`r`n"
$FormParameters.Keys | ForEach-Object {
$value = $FormParameters[$_]
$isFile = $value.GetType().FullName -eq "System.IO.FileInfo"

$RequestBody += "--$MultiPartBoundary$LF"
$RequestBody += "--$MultiPartBoundary$CRLF"
$RequestBody += "Content-Disposition: form-data; name=`"$_`""
if ($isFile) {
$fileName = $value.Name
$RequestBody += "; filename=`"$fileName`"$LF"
$RequestBody += "Content-Type: application/octet-stream$LF$LF"
$RequestBody += "; filename=`"$fileName`"$CRLF"
$RequestBody += "Content-Type: application/octet-stream$CRLF$CRLF"
$RequestBody += Get-Content -Path $value.FullName
} else {
$RequestBody += "$LF$LF"
$RequestBody += "$CRLF$CRLF"
$RequestBody += ([string]$value)
}
$RequestBody += "$LF--$MultiPartBoundary"
$RequestBody += "$CRLF--$MultiPartBoundary"
}
$RequestBody += "--"
} else {
Expand Down Expand Up @@ -202,7 +202,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {

$Response = $null

if ($RawResponse.StatusCode -ne '204') {
if ($RawResponse.StatusCode -ne 204) {
$Response = DeserializeResponse -Response $RawResponse.Content -ReturnType $ReturnType -ContentTypes $RawResponse.Headers["Content-Type"]
}

Expand All @@ -227,7 +227,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
$RetryFlag = $false
}
}
} while($RetryFlag)
} while ($RetryFlag)

return @{
Response = $Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ function Invoke-OktaEstablishAccessToken {
$DeviceUrl = $LocalVarResult.Response.verification_uri_complete
$DeviceCode = $LocalVarResult.Response.device_code

Write-Host "Open your browser and navigate to the following URL to begin the Okta device authorization for the Powershell CLI: " $DeviceUrl
Write-Host "Open your browser and navigate to the following URL to begin the Okta device authorization for the PowerShell CLI:"
Write-Host $DeviceUrl

$keepPolling = $true
$CountPolling = 1
Expand Down