|
...
|
...
|
@@ -7,6 +7,8 @@ use Lackoxygen\TiktokOpen\Base\Event\Fail; |
|
|
|
use Lackoxygen\TiktokOpen\Base\Event\Request;
|
|
|
|
use Lackoxygen\TiktokOpen\Base\Event\Response;
|
|
|
|
use Lackoxygen\TiktokOpen\Base\ServiceManager;
|
|
|
|
use Lackoxygen\TiktokOpen\Base\Signer\NoneSigner;
|
|
|
|
use Lackoxygen\TiktokOpen\Base\Signer\SignerInterface;
|
|
|
|
use Lackoxygen\TiktokOpen\Base\Traits\BaseClient;
|
|
|
|
use Lackoxygen\TiktokOpen\Wap\Listener;
|
|
|
|
use GuzzleHttp\RequestOptions;
|
|
...
|
...
|
@@ -20,17 +22,21 @@ class Client extends ServiceManager |
|
|
|
|
|
|
|
private bool $withSession;
|
|
|
|
|
|
|
|
private SignerInterface $signer;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
Application $app, $requestOption = '', $withSession = false
|
|
|
|
)
|
|
|
|
{
|
|
|
|
parent::__construct($app);
|
|
|
|
|
|
|
|
$this->listen();
|
|
|
|
|
|
|
|
$this->requestOption = $requestOption;
|
|
|
|
|
|
|
|
$this->withSession = $withSession;
|
|
|
|
|
|
|
|
$this->signer = new NoneSigner();
|
|
|
|
|
|
|
|
$this->listen();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function listen()
|
|
...
|
...
|
@@ -68,6 +74,15 @@ class Client extends ServiceManager |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function asQuery(): Client
|
|
|
|
{
|
|
|
|
return new Client(
|
|
|
|
$this->app,
|
|
|
|
RequestOptions::QUERY,
|
|
|
|
$this->withSession
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function withSession(): Client
|
|
|
|
{
|
|
|
|
return new Client(
|
|
...
|
...
|
@@ -77,6 +92,13 @@ class Client extends ServiceManager |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function signVia(SignerInterface $signer): Client
|
|
|
|
{
|
|
|
|
$this->signer = $signer;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function refresh()
|
|
|
|
{
|
|
|
|
$this->requestOption = '';
|
...
|
...
|
|