Skip to content

Commit

Permalink
[php] update php sample with guzzlehttp/guzzle ^7.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
oprudkyi committed May 11, 2022
1 parent d501626 commit f3eaf33
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/guzzle": "^6.2"
"guzzlehttp/guzzle": "^6.2|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ protected function testSpecialTagsRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -334,7 +334,7 @@ protected function testSpecialTagsRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'PATCH',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down
36 changes: 18 additions & 18 deletions samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ protected function fakeOuterBooleanSerializeRequest($body = null)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -324,7 +324,7 @@ protected function fakeOuterBooleanSerializeRequest($body = null)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -555,7 +555,7 @@ protected function fakeOuterCompositeSerializeRequest($body = null)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -571,7 +571,7 @@ protected function fakeOuterCompositeSerializeRequest($body = null)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -802,7 +802,7 @@ protected function fakeOuterNumberSerializeRequest($body = null)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -818,7 +818,7 @@ protected function fakeOuterNumberSerializeRequest($body = null)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1049,7 +1049,7 @@ protected function fakeOuterStringSerializeRequest($body = null)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1065,7 +1065,7 @@ protected function fakeOuterStringSerializeRequest($body = null)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1306,7 +1306,7 @@ protected function testClientModelRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1322,7 +1322,7 @@ protected function testClientModelRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'PATCH',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1526,7 +1526,7 @@ protected function testEndpointParametersRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1546,7 +1546,7 @@ protected function testEndpointParametersRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1792,7 +1792,7 @@ protected function testEnumParametersRequest($body = null, $enum_header_string_a

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1808,7 +1808,7 @@ protected function testEnumParametersRequest($body = null, $enum_header_string_a
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -2012,7 +2012,7 @@ protected function testInlineAdditionalPropertiesRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -2028,7 +2028,7 @@ protected function testInlineAdditionalPropertiesRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -2232,7 +2232,7 @@ protected function testJsonFormDataRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -2248,7 +2248,7 @@ protected function testJsonFormDataRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ protected function testClassnameRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -339,7 +339,7 @@ protected function testClassnameRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'PATCH',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down
32 changes: 16 additions & 16 deletions samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ protected function addPetRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -301,7 +301,7 @@ protected function addPetRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -519,7 +519,7 @@ protected function deletePetRequest($pet_id, $api_key = null)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -539,7 +539,7 @@ protected function deletePetRequest($pet_id, $api_key = null)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'DELETE',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -784,7 +784,7 @@ protected function findPetsByStatusRequest($status)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -804,7 +804,7 @@ protected function findPetsByStatusRequest($status)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1049,7 +1049,7 @@ protected function findPetsByTagsRequest($tags)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1069,7 +1069,7 @@ protected function findPetsByTagsRequest($tags)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1315,7 +1315,7 @@ protected function getPetByIdRequest($pet_id)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1336,7 +1336,7 @@ protected function getPetByIdRequest($pet_id)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1540,7 +1540,7 @@ protected function updatePetRequest($body)

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1560,7 +1560,7 @@ protected function updatePetRequest($body)
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'PUT',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -1787,7 +1787,7 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -1807,7 +1807,7 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down Expand Up @@ -2072,7 +2072,7 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}

Expand All @@ -2092,7 +2092,7 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
Expand Down
Loading

0 comments on commit f3eaf33

Please sign in to comment.