Skip to content

Commit 365e323

Browse files
author
Jakub Kulhan
committed
autoupdated protocol.json & generated files
1 parent 4b65218 commit 365e323

File tree

9 files changed

+381
-1
lines changed

9 files changed

+381
-1
lines changed

gen-src/ChromeDevtoolsProtocol/DevtoolsClientInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use ChromeDevtoolsProtocol\Domain\PageDomainInterface;
3838
use ChromeDevtoolsProtocol\Domain\PerformanceDomainInterface;
3939
use ChromeDevtoolsProtocol\Domain\PerformanceTimelineDomainInterface;
40+
use ChromeDevtoolsProtocol\Domain\PreloadDomainInterface;
4041
use ChromeDevtoolsProtocol\Domain\ProfilerDomainInterface;
4142
use ChromeDevtoolsProtocol\Domain\RuntimeDomainInterface;
4243
use ChromeDevtoolsProtocol\Domain\SchemaDomainInterface;
@@ -313,6 +314,14 @@ public function performance(): PerformanceDomainInterface;
313314
public function performanceTimeline(): PerformanceTimelineDomainInterface;
314315

315316

317+
/**
318+
* Preload domain.
319+
*
320+
* @experimental
321+
*/
322+
public function preload(): PreloadDomainInterface;
323+
324+
316325
/**
317326
* Profiler domain.
318327
*/

gen-src/ChromeDevtoolsProtocol/DevtoolsClientTrait.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
use ChromeDevtoolsProtocol\Domain\PerformanceDomainInterface;
7373
use ChromeDevtoolsProtocol\Domain\PerformanceTimelineDomain;
7474
use ChromeDevtoolsProtocol\Domain\PerformanceTimelineDomainInterface;
75+
use ChromeDevtoolsProtocol\Domain\PreloadDomain;
76+
use ChromeDevtoolsProtocol\Domain\PreloadDomainInterface;
7577
use ChromeDevtoolsProtocol\Domain\ProfilerDomain;
7678
use ChromeDevtoolsProtocol\Domain\ProfilerDomainInterface;
7779
use ChromeDevtoolsProtocol\Domain\RuntimeDomain;
@@ -523,6 +525,18 @@ public function performanceTimeline(): PerformanceTimelineDomainInterface
523525
}
524526

525527

528+
public function preload(): PreloadDomainInterface
529+
{
530+
if (!isset($this->domains['Preload'])) {
531+
/** @var InternalClientInterface $this */
532+
$this->domains['Preload'] = new PreloadDomain($this);
533+
}
534+
/** @var PreloadDomainInterface $domain */
535+
$domain = $this->domains['Preload'];
536+
return $domain;
537+
}
538+
539+
526540
public function profiler(): ProfilerDomainInterface
527541
{
528542
if (!isset($this->domains['Profiler'])) {
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
namespace ChromeDevtoolsProtocol\Domain;
4+
5+
use ChromeDevtoolsProtocol\ContextInterface;
6+
use ChromeDevtoolsProtocol\InternalClientInterface;
7+
use ChromeDevtoolsProtocol\Model\Preload\RuleSetRemovedEvent;
8+
use ChromeDevtoolsProtocol\Model\Preload\RuleSetUpdatedEvent;
9+
use ChromeDevtoolsProtocol\SubscriptionInterface;
10+
11+
class PreloadDomain implements PreloadDomainInterface
12+
{
13+
/** @var InternalClientInterface */
14+
public $internalClient;
15+
16+
17+
public function __construct(InternalClientInterface $internalClient)
18+
{
19+
$this->internalClient = $internalClient;
20+
}
21+
22+
23+
public function disable(ContextInterface $ctx): void
24+
{
25+
$request = new \stdClass();
26+
$this->internalClient->executeCommand($ctx, 'Preload.disable', $request);
27+
}
28+
29+
30+
public function enable(ContextInterface $ctx): void
31+
{
32+
$request = new \stdClass();
33+
$this->internalClient->executeCommand($ctx, 'Preload.enable', $request);
34+
}
35+
36+
37+
public function addRuleSetRemovedListener(callable $listener): SubscriptionInterface
38+
{
39+
return $this->internalClient->addListener('Preload.ruleSetRemoved', function ($event) use ($listener) {
40+
return $listener(RuleSetRemovedEvent::fromJson($event));
41+
});
42+
}
43+
44+
45+
public function awaitRuleSetRemoved(ContextInterface $ctx): RuleSetRemovedEvent
46+
{
47+
return RuleSetRemovedEvent::fromJson($this->internalClient->awaitEvent($ctx, 'Preload.ruleSetRemoved'));
48+
}
49+
50+
51+
public function addRuleSetUpdatedListener(callable $listener): SubscriptionInterface
52+
{
53+
return $this->internalClient->addListener('Preload.ruleSetUpdated', function ($event) use ($listener) {
54+
return $listener(RuleSetUpdatedEvent::fromJson($event));
55+
});
56+
}
57+
58+
59+
public function awaitRuleSetUpdated(ContextInterface $ctx): RuleSetUpdatedEvent
60+
{
61+
return RuleSetUpdatedEvent::fromJson($this->internalClient->awaitEvent($ctx, 'Preload.ruleSetUpdated'));
62+
}
63+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
namespace ChromeDevtoolsProtocol\Domain;
4+
5+
use ChromeDevtoolsProtocol\ContextInterface;
6+
use ChromeDevtoolsProtocol\Model\Preload\RuleSetRemovedEvent;
7+
use ChromeDevtoolsProtocol\Model\Preload\RuleSetUpdatedEvent;
8+
use ChromeDevtoolsProtocol\SubscriptionInterface;
9+
10+
/**
11+
* Preload domain.
12+
*
13+
* @experimental
14+
*
15+
* @generated This file has been auto-generated, do not edit.
16+
*
17+
* @author Jakub Kulhan <[email protected]>
18+
*/
19+
interface PreloadDomainInterface
20+
{
21+
/**
22+
* Call Preload.disable command.
23+
*
24+
* @param ContextInterface $ctx
25+
*
26+
* @return void
27+
*/
28+
public function disable(ContextInterface $ctx): void;
29+
30+
31+
/**
32+
* Call Preload.enable command.
33+
*
34+
* @param ContextInterface $ctx
35+
*
36+
* @return void
37+
*/
38+
public function enable(ContextInterface $ctx): void;
39+
40+
41+
/**
42+
* Subscribe to Preload.ruleSetRemoved event.
43+
*
44+
* Listener will be called whenever event Preload.ruleSetRemoved is fired.
45+
*
46+
* @param callable $listener
47+
*
48+
* @return SubscriptionInterface
49+
*/
50+
public function addRuleSetRemovedListener(callable $listener): SubscriptionInterface;
51+
52+
53+
/**
54+
* Wait for Preload.ruleSetRemoved event.
55+
*
56+
* Method will block until first Preload.ruleSetRemoved event is fired.
57+
*
58+
* @param ContextInterface $ctx
59+
*
60+
* @return RuleSetRemovedEvent
61+
*/
62+
public function awaitRuleSetRemoved(ContextInterface $ctx): RuleSetRemovedEvent;
63+
64+
65+
/**
66+
* Upsert. Currently, it is only emitted when a rule set added.
67+
*
68+
* Listener will be called whenever event Preload.ruleSetUpdated is fired.
69+
*
70+
* @param callable $listener
71+
*
72+
* @return SubscriptionInterface
73+
*/
74+
public function addRuleSetUpdatedListener(callable $listener): SubscriptionInterface;
75+
76+
77+
/**
78+
* Upsert. Currently, it is only emitted when a rule set added.
79+
*
80+
* Method will block until first Preload.ruleSetUpdated event is fired.
81+
*
82+
* @param ContextInterface $ctx
83+
*
84+
* @return RuleSetUpdatedEvent
85+
*/
86+
public function awaitRuleSetUpdated(ContextInterface $ctx): RuleSetUpdatedEvent;
87+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
namespace ChromeDevtoolsProtocol\Model\Preload;
4+
5+
/**
6+
* Corresponds to SpeculationRuleSet
7+
*
8+
* @generated This file has been auto-generated, do not edit.
9+
*
10+
* @author Jakub Kulhan <[email protected]>
11+
*/
12+
final class RuleSet implements \JsonSerializable
13+
{
14+
/** @var string */
15+
public $id;
16+
17+
/**
18+
* Identifies a document which the rule set is associated with.
19+
*
20+
* @var string
21+
*/
22+
public $loaderId;
23+
24+
/**
25+
* Source text of JSON representing the rule set. If it comes from <script> tag, it is the textContent of the node. Note that it is a JSON for valid case. See also: - https://wicg.github.io/nav-speculation/speculation-rules.html - https://github.com/WICG/nav-speculation/blob/main/triggers.md
26+
*
27+
* @var string
28+
*/
29+
public $sourceText;
30+
31+
32+
/**
33+
* @param object $data
34+
* @return static
35+
*/
36+
public static function fromJson($data)
37+
{
38+
$instance = new static();
39+
if (isset($data->id)) {
40+
$instance->id = (string)$data->id;
41+
}
42+
if (isset($data->loaderId)) {
43+
$instance->loaderId = (string)$data->loaderId;
44+
}
45+
if (isset($data->sourceText)) {
46+
$instance->sourceText = (string)$data->sourceText;
47+
}
48+
return $instance;
49+
}
50+
51+
52+
public function jsonSerialize()
53+
{
54+
$data = new \stdClass();
55+
if ($this->id !== null) {
56+
$data->id = $this->id;
57+
}
58+
if ($this->loaderId !== null) {
59+
$data->loaderId = $this->loaderId;
60+
}
61+
if ($this->sourceText !== null) {
62+
$data->sourceText = $this->sourceText;
63+
}
64+
return $data;
65+
}
66+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace ChromeDevtoolsProtocol\Model\Preload;
4+
5+
/**
6+
* Named type Preload.RuleSetRemovedEvent.
7+
*
8+
* @generated This file has been auto-generated, do not edit.
9+
*
10+
* @author Jakub Kulhan <[email protected]>
11+
*/
12+
final class RuleSetRemovedEvent implements \JsonSerializable
13+
{
14+
/** @var string */
15+
public $id;
16+
17+
18+
/**
19+
* @param object $data
20+
* @return static
21+
*/
22+
public static function fromJson($data)
23+
{
24+
$instance = new static();
25+
if (isset($data->id)) {
26+
$instance->id = (string)$data->id;
27+
}
28+
return $instance;
29+
}
30+
31+
32+
public function jsonSerialize()
33+
{
34+
$data = new \stdClass();
35+
if ($this->id !== null) {
36+
$data->id = $this->id;
37+
}
38+
return $data;
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace ChromeDevtoolsProtocol\Model\Preload;
4+
5+
/**
6+
* Upsert. Currently, it is only emitted when a rule set added.
7+
*
8+
* @generated This file has been auto-generated, do not edit.
9+
*
10+
* @author Jakub Kulhan <[email protected]>
11+
*/
12+
final class RuleSetUpdatedEvent implements \JsonSerializable
13+
{
14+
/** @var RuleSet */
15+
public $ruleSet;
16+
17+
18+
/**
19+
* @param object $data
20+
* @return static
21+
*/
22+
public static function fromJson($data)
23+
{
24+
$instance = new static();
25+
if (isset($data->ruleSet)) {
26+
$instance->ruleSet = RuleSet::fromJson($data->ruleSet);
27+
}
28+
return $instance;
29+
}
30+
31+
32+
public function jsonSerialize()
33+
{
34+
$data = new \stdClass();
35+
if ($this->ruleSet !== null) {
36+
$data->ruleSet = $this->ruleSet->jsonSerialize();
37+
}
38+
return $data;
39+
}
40+
}

0 commit comments

Comments
 (0)