-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RPC queries being doubly wrapped (#987)
In some cases RPC queries that are wrapped with RpcDestFlags, RpcDestActor, or RpcDestActorFlags are wrapped one more time with RpcDestActorFlags. This PR fixes this behaviour.
- Loading branch information
Showing
14 changed files
with
974 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
tests/python/tests/rpc/php/VK/TL/_common/Functions/rpcDestActor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
/** | ||
* AUTOGENERATED, DO NOT EDIT! If you want to modify it, check tl schema. | ||
* | ||
* This autogenerated code represents tl class for typed RPC API. | ||
*/ | ||
|
||
namespace VK\TL\_common\Functions; | ||
|
||
use VK\TL; | ||
|
||
/** | ||
* @kphp-tl-class | ||
*/ | ||
class rpcDestActor implements TL\RpcFunction { | ||
|
||
/** @var int */ | ||
public $actor_id = 0; | ||
|
||
/** @var TL\RpcFunction */ | ||
public $query = null; | ||
|
||
/** Allows kphp implicitly load function result class */ | ||
private const RESULT = TL\_common\Functions\rpcDestActor_result::class; | ||
|
||
/** | ||
* @param int $actor_id | ||
* @param TL\RpcFunction $query | ||
*/ | ||
public function __construct($actor_id = 0, $query = null) { | ||
$this->actor_id = $actor_id; | ||
$this->query = $query; | ||
} | ||
|
||
/** | ||
* @param TL\RpcFunctionReturnResult $function_return_result | ||
* @return TL\RpcFunctionReturnResult | ||
*/ | ||
public static function functionReturnValue($function_return_result) { | ||
if ($function_return_result instanceof rpcDestActor_result) { | ||
return $function_return_result->value; | ||
} | ||
warning('Unexpected result type in functionReturnValue: ' . ($function_return_result ? get_class($function_return_result) : 'null')); | ||
return (new rpcDestActor_result())->value; | ||
} | ||
|
||
/** | ||
* @kphp-inline | ||
* | ||
* @param TL\RpcResponse $response | ||
* @return TL\RpcFunctionReturnResult | ||
*/ | ||
public static function result(TL\RpcResponse $response) { | ||
return self::functionReturnValue($response->getResult()); | ||
} | ||
|
||
/** | ||
* @kphp-inline | ||
* | ||
* @return string | ||
*/ | ||
public function getTLFunctionName() { | ||
return 'rpcDestActor'; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @kphp-tl-class | ||
*/ | ||
class rpcDestActor_result implements TL\RpcFunctionReturnResult { | ||
|
||
/** @var TL\RpcFunctionReturnResult */ | ||
public $value = null; | ||
|
||
} |
87 changes: 87 additions & 0 deletions
87
tests/python/tests/rpc/php/VK/TL/_common/Functions/rpcDestActorFlags.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
/** | ||
* AUTOGENERATED, DO NOT EDIT! If you want to modify it, check tl schema. | ||
* | ||
* This autogenerated code represents tl class for typed RPC API. | ||
*/ | ||
|
||
namespace VK\TL\_common\Functions; | ||
|
||
use VK\TL; | ||
|
||
/** | ||
* @kphp-tl-class | ||
*/ | ||
class rpcDestActorFlags implements TL\RpcFunction { | ||
|
||
/** @var int */ | ||
public $actor_id = 0; | ||
|
||
/** @var int */ | ||
public $flags = 0; | ||
|
||
/** @var TL\_common\Types\rpcInvokeReqExtra */ | ||
public $extra = null; | ||
|
||
/** @var TL\RpcFunction */ | ||
public $query = null; | ||
|
||
/** Allows kphp implicitly load function result class */ | ||
private const RESULT = TL\_common\Functions\rpcDestActorFlags_result::class; | ||
|
||
/** | ||
* @param int $actor_id | ||
* @param int $flags | ||
* @param TL\_common\Types\rpcInvokeReqExtra $extra | ||
* @param TL\RpcFunction $query | ||
*/ | ||
public function __construct($actor_id = 0, $flags = 0, $extra = null, $query = null) { | ||
$this->actor_id = $actor_id; | ||
$this->flags = $flags; | ||
$this->extra = $extra; | ||
$this->query = $query; | ||
} | ||
|
||
/** | ||
* @param TL\RpcFunctionReturnResult $function_return_result | ||
* @return TL\RpcFunctionReturnResult | ||
*/ | ||
public static function functionReturnValue($function_return_result) { | ||
if ($function_return_result instanceof rpcDestActorFlags_result) { | ||
return $function_return_result->value; | ||
} | ||
warning('Unexpected result type in functionReturnValue: ' . ($function_return_result ? get_class($function_return_result) : 'null')); | ||
return (new rpcDestActorFlags_result())->value; | ||
} | ||
|
||
/** | ||
* @kphp-inline | ||
* | ||
* @param TL\RpcResponse $response | ||
* @return TL\RpcFunctionReturnResult | ||
*/ | ||
public static function result(TL\RpcResponse $response) { | ||
return self::functionReturnValue($response->getResult()); | ||
} | ||
|
||
/** | ||
* @kphp-inline | ||
* | ||
* @return string | ||
*/ | ||
public function getTLFunctionName() { | ||
return 'rpcDestActorFlags'; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @kphp-tl-class | ||
*/ | ||
class rpcDestActorFlags_result implements TL\RpcFunctionReturnResult { | ||
|
||
/** @var TL\RpcFunctionReturnResult */ | ||
public $value = null; | ||
|
||
} |
Oops, something went wrong.