Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -786,34 +786,39 @@ use {{invokerPackage}}\ObjectSerializer;

{{#authMethods}}
{{#isApiKey}}
{{^isKeyInCookie}}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}');
if ($apiKey !== null) {
{{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
}

{{/isKeyInCookie}}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}
// this endpoint requires HTTP basic authentication
if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
$headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
}

{{/isBasicBasic}}
{{#isBasicBearer}}
// this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token)
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}

{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}
// this endpoint requires OAuth (access token)
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}

{{/isOAuth}}
{{/authMethods}}

$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
2 changes: 2 additions & 0 deletions modules/openapi-generator/src/main/resources/php/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,13 @@ use {{invokerPackage}}\ObjectSerializer;

{{#authMethods}}
{{#isApiKey}}
{{^isKeyInCookie}}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}');
if ($apiKey !== null) {
{{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
}
{{/isKeyInCookie}}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}
Expand Down
10 changes: 0 additions & 10 deletions samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ public function testBinaryGifRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -659,7 +658,6 @@ public function testBodyApplicationOctetstreamBinaryRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -940,7 +938,6 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1215,7 +1212,6 @@ public function testBodyMultipartFormdataSingleBinaryRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1488,7 +1484,6 @@ public function testEchoBodyAllOfPetRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1761,7 +1756,6 @@ public function testEchoBodyFreeFormObjectResponseStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2034,7 +2028,6 @@ public function testEchoBodyPetRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2307,7 +2300,6 @@ public function testEchoBodyPetResponseStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2580,7 +2572,6 @@ public function testEchoBodyStringEnumRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2853,7 +2844,6 @@ public function testEchoBodyTagResponseStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ public function testFormIntegerBooleanStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -690,7 +689,6 @@ public function testFormObjectMultipartRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1025,7 +1023,6 @@ public function testFormOneofRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ public function testHeaderIntegerBooleanStringEnumsRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
11 changes: 0 additions & 11 deletions samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ public function testEnumRefStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -744,7 +743,6 @@ public function testQueryDatetimeDateStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1059,7 +1057,6 @@ public function testQueryIntegerBooleanStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1334,7 +1331,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1609,7 +1605,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1884,7 +1879,6 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2159,7 +2153,6 @@ public function testQueryStyleFormExplodeFalseArrayStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2434,7 +2427,6 @@ public function testQueryStyleFormExplodeTrueArrayStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2709,7 +2701,6 @@ public function testQueryStyleFormExplodeTrueObjectRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2984,7 +2975,6 @@ public function testQueryStyleFormExplodeTrueObjectAllOfRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -3279,7 +3269,6 @@ public function testQueryStyleJsonSerializationObjectRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
10 changes: 0 additions & 10 deletions samples/client/echo_api/php-nextgen/src/Api/BodyApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ public function testBinaryGifRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -659,7 +658,6 @@ public function testBodyApplicationOctetstreamBinaryRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -940,7 +938,6 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1215,7 +1212,6 @@ public function testBodyMultipartFormdataSingleBinaryRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1488,7 +1484,6 @@ public function testEchoBodyAllOfPetRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1761,7 +1756,6 @@ public function testEchoBodyFreeFormObjectResponseStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2034,7 +2028,6 @@ public function testEchoBodyPetRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2307,7 +2300,6 @@ public function testEchoBodyPetResponseStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2580,7 +2572,6 @@ public function testEchoBodyStringEnumRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -2853,7 +2844,6 @@ public function testEchoBodyTagResponseStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
3 changes: 0 additions & 3 deletions samples/client/echo_api/php-nextgen/src/Api/FormApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ public function testFormIntegerBooleanStringRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -690,7 +689,6 @@ public function testFormObjectMultipartRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down Expand Up @@ -1025,7 +1023,6 @@ public function testFormOneofRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
1 change: 0 additions & 1 deletion samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ public function testHeaderIntegerBooleanStringEnumsRequest(
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
1 change: 0 additions & 1 deletion samples/client/echo_api/php-nextgen/src/Api/PathApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
}
}


$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
Expand Down
Loading
Loading