Skip to content

Commit

Permalink
Merge pull request #66 from MohammadWaleed/develop
Browse files Browse the repository at this point in the history
Prepare for 0.26.0
  • Loading branch information
MohammadWaleed authored Oct 5, 2021
2 parents b4e2a26 + 6786a13 commit 329b435
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
36 changes: 28 additions & 8 deletions src/Admin/Classes/FullBodyLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

namespace Keycloak\Admin\Classes;

use \GuzzleHttp\Command\CommandInterface;
use \GuzzleHttp\Command\Guzzle\Operation;
use \GuzzleHttp\Command\Guzzle\Parameter;
use \GuzzleHttp\Psr7;
use \Psr\Http\Message\MessageInterface;
use \Psr\Http\Message\RequestInterface;
use \GuzzleHttp\Command\Guzzle\RequestLocation\JsonLocation;
use GuzzleHttp\Command\CommandInterface;
use GuzzleHttp\Command\Guzzle\Operation;
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;
use GuzzleHttp\Command\Guzzle\RequestLocation\JsonLocation;

use Psr\Http\Message\StreamInterface;

use function GuzzleHttp\Psr7\stream_for;

/**
* Creates a JSON document
Expand Down Expand Up @@ -53,11 +58,26 @@ public function visit(
$request = $request->withHeader('Content-Type', $this->jsonContentType);
}

return $request->withBody(Psr7\stream_for(\GuzzleHttp\json_encode($this->jsonData)));
return $request->withBody($this->getStream(\GuzzleHttp\json_encode($this->jsonData)));
}

public function after(CommandInterface $command, RequestInterface $request, Operation $operation)
{
return $request;
}

/**
* Create stream from given data
*
* @param string $data
* @return StreamInterface
*/
final protected function getStream($data)
{
if (class_exists(Utils::class)) {
return Utils::streamFor($data); // guzzlehttp/psr7 >= 2.0
}

return stream_for($data); // guzzlehttp/psr7 < 2.0
}
}
2 changes: 1 addition & 1 deletion src/Admin/Resources/keycloak-1_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -3693,7 +3693,7 @@
),

'partialImportRealm' => array(
'uri' => 'auth/admin/realms/{realm}/partial-export',
'uri' => 'auth/admin/realms/{realm}/partialImport',
'description' => 'Partial import from a JSON file to an existing realm.',
'httpMethod' => 'POST',
'parameters' => array(
Expand Down

0 comments on commit 329b435

Please sign in to comment.