1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
package Torello.Browser.BrowserAPI;

// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Java-HTML Imports
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

import Torello.Browser.*;
import Torello.Browser.helper.*;
import Torello.Browser.JavaScriptAPI.*;
import Torello.JSON.*;

import Torello.Java.ReadOnly.ReadOnlyList;
import Torello.Java.ReadOnly.ReadOnlyArrayList;

import Torello.JavaDoc.Annotations.StaticFunctional;
import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg;

import Torello.Browser.BrowserAPI.NestedHelpers.Commands.Fetch$$Commands;


// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// JDK Imports
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

import javax.json.JsonObject;
import javax.json.JsonValue;

/**
 * <SPAN CLASS=COPIEDJDK><B>A domain for letting clients substitute browser's network layer with client code.</B></SPAN>
 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE>
 */
@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE")
public class Fetch
{
    // No Pubic Constructors
    private Fetch() { }


    // ********************************************************************************************
    // ********************************************************************************************
    // Eliminated Types
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Unique request identifier.
     * Note that this does not identify individual HTTP requests that are part of
     * a network request.

     * <EMBED CLASS='external-html' DATA-CTAS='String' DATA-FILE-ID=CDP.EliminatedType
     *     DATA-NAME=RequestId>
     */
    public static final String RequestId =
        "RequestId has been eliminated.\n" +
        "It was replaced with the standard Java-Type: String";


    // ********************************************************************************************
    // ********************************************************************************************
    // Enumerated String Constants Lists
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Stages of the request to handle. Request will intercept before the request is
     * sent. Response will intercept after the response is received (but before response
     * body is received).
     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
     */
    public static final ReadOnlyList<String> RequestStage = new ReadOnlyArrayList<>
        (String.class, "Request", "Response");



    // ********************************************************************************************
    // ********************************************************************************************
    // Basic Types
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Authorization challenge for HTTP status code 401 or 407.
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI>
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
    public static class AuthChallenge
        extends BaseType<AuthChallenge>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.AuthChallenge> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.Types.
                Fetch$$AuthChallenge$$.singleton;

        /**
         * Source of the authentication challenge.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         * <EMBED CLASS='external-html' DATA-D=Fetch DATA-C=AuthChallenge DATA-F=source DATA-FILE-ID=CDP.EL1>
         * @see BaseType#enumStrList(String)
         */
        public final String source;

        /** Origin of the challenger. */
        public final String origin;

        /** The authentication scheme used, such as basic or digest */
        public final String scheme;

        /** The realm of the challenge. May be empty. */
        public final String realm;

        /** Constructor.  Please review this class' fields for documentation. */
        public AuthChallenge(
                ReadOnlyList<Boolean> isPresent, String source, String origin, String scheme,
                String realm
            )
        {
            super(singleton, Domains.Fetch, "AuthChallenge", 4);

            this.source = source;
            this.origin = origin;
            this.scheme = scheme;
            this.realm  = realm;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 4, "Fetch.AuthChallenge");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static AuthChallenge fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<AuthChallenge> descriptor()
        { return singleton.descriptor(); }
    }

    /**
     * Response to an AuthChallenge.
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI>
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
    public static class AuthChallengeResponse
        extends BaseType<AuthChallengeResponse>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.AuthChallengeResponse> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.Types.
                Fetch$$AuthChallengeResponse$$.singleton;

        /**
         * The decision on what to do in response to the authorization challenge.  Default means
         * deferring to the default behavior of the net stack, which will likely either the Cancel
         * authentication or display a popup dialog box.
         * <EMBED CLASS='external-html' DATA-D=Fetch DATA-C=AuthChallengeResponse DATA-F=response DATA-FILE-ID=CDP.EL1>
         * @see BaseType#enumStrList(String)
         */
        public final String response;

        /**
         * The username to provide, possibly empty. Should only be set if response is
         * ProvideCredentials.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final String username;

        /**
         * The password to provide, possibly empty. Should only be set if response is
         * ProvideCredentials.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final String password;

        /** Constructor.  Please review this class' fields for documentation. */
        public AuthChallengeResponse
            (ReadOnlyList<Boolean> isPresent, String response, String username, String password)
        {
            super(singleton, Domains.Fetch, "AuthChallengeResponse", 3);

            this.response = response;
            this.username = username;
            this.password = password;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 3, "Fetch.AuthChallengeResponse");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static AuthChallengeResponse fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<AuthChallengeResponse> descriptor()
        { return singleton.descriptor(); }
    }

    /**
     * Response HTTP header entry
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI>
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
    public static class HeaderEntry
        extends BaseType<HeaderEntry>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.HeaderEntry> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.Types.
                Fetch$$HeaderEntry$$.singleton;

        /** <CODE>[No Description Provided by Google]</CODE> */
        public final String name;

        /** <CODE>[No Description Provided by Google]</CODE> */
        public final String value;

        /** Constructor.  Please review this class' fields for documentation. */
        public HeaderEntry(ReadOnlyList<Boolean> isPresent, String name, String value)
        {
            super(singleton, Domains.Fetch, "HeaderEntry", 2);

            this.name   = name;
            this.value  = value;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 2, "Fetch.HeaderEntry");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static HeaderEntry fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<HeaderEntry> descriptor()
        { return singleton.descriptor(); }
    }

    /**
     * <CODE>[No Description Provided by Google]</CODE>
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI>
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
    public static class RequestPattern
        extends BaseType<RequestPattern>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.RequestPattern> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.Types.
                Fetch$$RequestPattern$$.singleton;

        /**
         * Wildcards (<CODE>'*'</CODE> -&gt; zero or more, <CODE>'?'</CODE> -&gt; exactly one) are allowed. Escape character is
         * backslash. Omitting is equivalent to <CODE>"*"</CODE>.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final String urlPattern;

        /**
         * If set, only requests for matching resource types will be intercepted.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         * <EMBED CLASS='external-html' DATA-D=Network DATA-C=ResourceType DATA-F=resourceType DATA-FILE-ID=CDP.EL2>
         * @see BaseType#enumStrList(String)
         */
        public final String resourceType;

        /**
         * Stage at which to begin intercepting requests. Default is Request.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         * <EMBED CLASS='external-html' DATA-D=Fetch DATA-C=RequestStage DATA-F=requestStage DATA-FILE-ID=CDP.EL2>
         * @see BaseType#enumStrList(String)
         */
        public final String requestStage;

        /** Constructor.  Please review this class' fields for documentation. */
        public RequestPattern(
                ReadOnlyList<Boolean> isPresent, String urlPattern, String resourceType,
                String requestStage
            )
        {
            super(singleton, Domains.Fetch, "RequestPattern", 3);

            this.urlPattern     = urlPattern;
            this.resourceType   = resourceType;
            this.requestStage   = requestStage;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 3, "Fetch.RequestPattern");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static RequestPattern fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<RequestPattern> descriptor()
        { return singleton.descriptor(); }
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Command-Return Types
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Causes the body of the response to be received from the server and
     * returned as a single string. May only be issued for a request that
     * is paused in the Response stage and is mutually exclusive with
     * takeResponseBodyForInterceptionAsStream. Calling other methods that
     * affect the request or disabling fetch domain before body is received
     * results in an undefined behavior.
     * Note that the response body is not available for redirects. Requests
     * paused in the _redirect received_ state may be differentiated by
     * <CODE>responseCode</CODE> and presence of <CODE>location</CODE> response header, see
     * comments to <CODE>requestPaused</CODE> for details.
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI DATA-CMD=getResponseBody>
     * @see Fetch#getResponseBody
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI")
    public static class getResponseBody$$RET
        extends BaseType<getResponseBody$$RET>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.getResponseBody$$RET> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns.
                Fetch$$getResponseBody$$RET.singleton;

        /** Response body. */
        public final String body;

        /** True, if content was sent as base64. */
        public final boolean base64Encoded;

        /** Constructor.  Please review this class' fields for documentation. */
        public getResponseBody$$RET
            (ReadOnlyList<Boolean> isPresent, String body, boolean base64Encoded)
        {
            super(singleton, Domains.Fetch, "getResponseBody", 2);

            this.body           = body;
            this.base64Encoded  = base64Encoded;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 2, "Fetch.getResponseBody$$RET");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static getResponseBody$$RET fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<getResponseBody$$RET> descriptor()
        { return singleton.descriptor(); }
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Event Types
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Issued when the domain is enabled with handleAuthRequests set to true.
     * The request is paused until client responds with continueWithAuth.
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI>
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
    public static class authRequired
        extends BrowserEvent<authRequired>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.authRequired> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.Events.
                Fetch$$authRequired$$.singleton;

        /** Each request the page makes will have a unique id. */
        public final String requestId;

        /** The details of the request. */
        public final Network.Request request;

        /** The id of the frame that initiated the request. */
        public final String frameId;

        /**
         * How the requested resource will be used.
         * <EMBED CLASS='external-html' DATA-D=Network DATA-C=ResourceType DATA-F=resourceType DATA-FILE-ID=CDP.EL2>
         * @see BaseType#enumStrList(String)
         */
        public final String resourceType;

        /**
         * Details of the Authorization Challenge encountered.
         * If this is set, client should respond with continueRequest that
         * contains AuthChallengeResponse.
         */
        public final Fetch.AuthChallenge authChallenge;

        /** Constructor.  Please review this class' fields for documentation. */
        public authRequired(
                ReadOnlyList<Boolean> isPresent, String requestId, Network.Request request,
                String frameId, String resourceType, AuthChallenge authChallenge
            )
        {
            super(singleton, Domains.Fetch, "authRequired", 5);

            this.requestId      = requestId;
            this.request        = request;
            this.frameId        = frameId;
            this.resourceType   = resourceType;
            this.authChallenge  = authChallenge;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 5, "Fetch.authRequired");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static authRequired fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<authRequired> descriptor()
        { return singleton.descriptor(); }
    }

    /**
     * Issued when the domain is enabled and the request URL matches the
     * specified filter. The request is paused until the client responds
     * with one of continueRequest, failRequest or fulfillRequest.
     * The stage of the request can be determined by presence of responseErrorReason
     * and responseStatusCode -- the request is at the response stage if either
     * of these fields is present and in the request stage otherwise.
     * Redirect responses and subsequent requests are reported similarly to regular
     * responses and requests. Redirect responses may be distinguished by the value
     * of <CODE>responseStatusCode</CODE> (which is one of 301, 302, 303, 307, 308) along with
     * presence of the <CODE>location</CODE> header. Requests resulting from a redirect will
     * have <CODE>redirectedRequestId</CODE> field set.
     * 
     * <EMBED CLASS=globalDefs DATA-DOMAIN=Fetch DATA-API=BrowserAPI>
     */
    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
    public static class requestPaused
        extends BrowserEvent<requestPaused>
        implements java.io.Serializable
    {
        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
        protected static final long serialVersionUID = 1;

        private static final NestedHelper<Fetch.requestPaused> singleton =
            Torello.Browser.BrowserAPI.NestedHelpers.Events.
                Fetch$$requestPaused$$.singleton;

        /** Each request the page makes will have a unique id. */
        public final String requestId;

        /** The details of the request. */
        public final Network.Request request;

        /** The id of the frame that initiated the request. */
        public final String frameId;

        /**
         * How the requested resource will be used.
         * <EMBED CLASS='external-html' DATA-D=Network DATA-C=ResourceType DATA-F=resourceType DATA-FILE-ID=CDP.EL2>
         * @see BaseType#enumStrList(String)
         */
        public final String resourceType;

        /**
         * Response error if intercepted at response stage.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         * <EMBED CLASS='external-html' DATA-D=Network DATA-C=ErrorReason DATA-F=responseErrorReason DATA-FILE-ID=CDP.EL2>
         * @see BaseType#enumStrList(String)
         */
        public final String responseErrorReason;

        /**
         * Response code if intercepted at response stage.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final Integer responseStatusCode;

        /**
         * Response status text if intercepted at response stage.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final String responseStatusText;

        /**
         * Response headers if intercepted at the response stage.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final Fetch.HeaderEntry[] responseHeaders;

        /**
         * If the intercepted request had a corresponding Network.requestWillBeSent event fired for it,
         * then this networkId will be the same as the requestId present in the requestWillBeSent event.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
         */
        public final String networkId;

        /**
         * If the request is due to a redirect response from the server, the id of the request that
         * has caused the redirect.
         * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B>
         */
        public final String redirectedRequestId;

        /** Constructor.  Please review this class' fields for documentation. */
        public requestPaused(
                ReadOnlyList<Boolean> isPresent, String requestId, Network.Request request,
                String frameId, String resourceType, String responseErrorReason,
                Integer responseStatusCode, String responseStatusText,
                HeaderEntry[] responseHeaders, String networkId, String redirectedRequestId
            )
        {
            super(singleton, Domains.Fetch, "requestPaused", 10);

            this.requestId              = requestId;
            this.request                = request;
            this.frameId                = frameId;
            this.resourceType           = resourceType;
            this.responseErrorReason    = responseErrorReason;
            this.responseStatusCode     = responseStatusCode;
            this.responseStatusText     = responseStatusText;
            this.responseHeaders        = responseHeaders;
            this.networkId              = networkId;
            this.redirectedRequestId    = redirectedRequestId;

            this.isPresent = (isPresent == null)
                ? singleton.generateIsPresentList(this)
                : THROWS.check(isPresent, 10, "Fetch.requestPaused");
        }

        /** Creates an instance of this class from a {@link JsonObject}.*/
        public static requestPaused fromJSON(JsonObject jo)
        { return singleton.fromJSON(jo); }

        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
        public static NestedDescriptor<requestPaused> descriptor()
        { return singleton.descriptor(); }
    }




    // ********************************************************************************************
    // ********************************************************************************************
    // Commands
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Continues the request, optionally modifying some of its parameters.
     * 
     * <BR /><BR /><DIV CLASS=JDHint>
     * 👍 Because of the sheer number of input parameters to this method, there is a
     * a {@link CommandBuilder} variant to this method which may be invoked instead.
     * 
     * <BR /><BR />
     * Please View: {@link #continueRequest()}
     * </DIV>
     * 
     * @param requestId An id the client received in requestPaused event.
     * 
     * @param url If set, the request url will be modified in a way that's not observable by page.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param method If set, the request method is overridden.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param postData If set, overrides the post data in the request. (Encoded as a base64 string when passed over JSON)
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param headers 
     * If set, overrides the request headers. Note that the overrides do not
     * extend to subsequent redirect hops, if a redirect happens. Another override
     * may be applied to a different request produced by a redirect.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param interceptResponse If set, overrides response interception behavior for this request.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B>
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> continueRequest(
            String requestId, String url, String method, String postData, HeaderEntry[] headers,
            Boolean interceptResponse
        )
    {
        // Convert all Method Parameters into a JSON Request-Object (as a String)
        final String requestJSON = WriteJSON.get(
            Fetch$$Commands.continueRequest$$, "Fetch.continueRequest",
            requestId, url, method, postData, headers, interceptResponse
        );

        return Script.NO_RET(Domains.Fetch, "continueRequest", requestJSON);
    }

    /**
     * Continues loading of the paused response, optionally modifying the
     * response headers. If either responseCode or headers are modified, all of them
     * must be present.
     * 
     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
     * 
     * <BR /><BR /><DIV CLASS=JDHint>
     * 👍 Because of the sheer number of input parameters to this method, there is a
     * a {@link CommandBuilder} variant to this method which may be invoked instead.
     * 
     * <BR /><BR />
     * Please View: {@link #continueResponse()}
     * </DIV>
     * 
     * @param requestId An id the client received in requestPaused event.
     * 
     * @param responseCode An HTTP response code. If absent, original response code will be used.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param responsePhrase 
     * A textual representation of responseCode.
     * If absent, a standard phrase matching responseCode is used.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param responseHeaders Response headers. If absent, original response headers will be used.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param binaryResponseHeaders 
     * Alternative way of specifying response headers as a \0-separated
     * series of name: value pairs. Prefer the above method unless you
     * need to represent some non-UTF8 values that can't be transmitted
     * over the protocol as text. (Encoded as a base64 string when passed over JSON)
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> continueResponse(
            String requestId, Integer responseCode, String responsePhrase,
            HeaderEntry[] responseHeaders, String binaryResponseHeaders
        )
    {
        // Convert all Method Parameters into a JSON Request-Object (as a String)
        final String requestJSON = WriteJSON.get(
            Fetch$$Commands.continueResponse$$, "Fetch.continueResponse",
            requestId, responseCode, responsePhrase, responseHeaders, binaryResponseHeaders
        );

        return Script.NO_RET(Domains.Fetch, "continueResponse", requestJSON);
    }

    /**
     * Continues a request supplying authChallengeResponse following authRequired event.
     * 
     * @param requestId An id the client received in authRequired event.
     * 
     * @param authChallengeResponse Response to  with an authChallenge.
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> continueWithAuth
        (String requestId, AuthChallengeResponse authChallengeResponse)
    {
        // Convert all Method Parameters into a JSON Request-Object (as a String)
        final String requestJSON = WriteJSON.get(
            Fetch$$Commands.continueWithAuth$$, "Fetch.continueWithAuth",
            requestId, authChallengeResponse
        );

        return Script.NO_RET(Domains.Fetch, "continueWithAuth", requestJSON);
    }

    /**
     * Disables the fetch domain.
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> disable()
    {
        // Ultra-Simple Request JSON - Because this method has no parameters
        final String requestJSON = "{\"method\":\"Fetch.disable\"}";

        return Script.NO_RET(Domains.Fetch, "disable", requestJSON);
    }

    /**
     * Enables issuing of requestPaused events. A request will be paused until client
     * calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.
     * 
     * @param patterns 
     * If specified, only requests matching any of these patterns will produce
     * fetchRequested event and will be paused until clients response. If not set,
     * all requests will be affected.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param handleAuthRequests 
     * If true, authRequired events will be issued and requests will be paused
     * expecting a call to continueWithAuth.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> enable(RequestPattern[] patterns, Boolean handleAuthRequests)
    {
        // Convert all Method Parameters into a JSON Request-Object (as a String)
        final String requestJSON = WriteJSON.get(
            Fetch$$Commands.enable$$, "Fetch.enable",
            patterns, handleAuthRequests
        );

        return Script.NO_RET(Domains.Fetch, "enable", requestJSON);
    }

    /**
     * Causes the request to fail with specified reason.
     * 
     * @param requestId An id the client received in requestPaused event.
     * 
     * @param errorReason Causes the request to fail with the given reason.
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> failRequest(String requestId, String errorReason)
    {
        // Convert all Method Parameters into a JSON Request-Object (as a String)
        final String requestJSON = WriteJSON.get(
            Fetch$$Commands.failRequest$$, "Fetch.failRequest",
            requestId, errorReason
        );

        return Script.NO_RET(Domains.Fetch, "failRequest", requestJSON);
    }

    /**
     * Provides response to the request.
     * 
     * <BR /><BR /><DIV CLASS=JDHint>
     * 👍 Because of the sheer number of input parameters to this method, there is a
     * a {@link CommandBuilder} variant to this method which may be invoked instead.
     * 
     * <BR /><BR />
     * Please View: {@link #fulfillRequest()}
     * </DIV>
     * 
     * @param requestId An id the client received in requestPaused event.
     * 
     * @param responseCode An HTTP response code.
     * 
     * @param responseHeaders Response headers.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param binaryResponseHeaders 
     * Alternative way of specifying response headers as a \0-separated
     * series of name: value pairs. Prefer the above method unless you
     * need to represent some non-UTF8 values that can't be transmitted
     * over the protocol as text. (Encoded as a base64 string when passed over JSON)
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param body 
     * A response body. If absent, original response body will be used if
     * the request is intercepted at the response stage and empty body
     * will be used if the request is intercepted at the request stage. (Encoded as a base64 string when passed over JSON)
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @param responsePhrase 
     * A textual representation of responseCode.
     * If absent, a standard phrase matching responseCode is used.
     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
     * 
     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
     *
     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
     * browser receives the invocation-request.
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
     * the Browser Function has run to completion.
     * </DIV>
     */
    public static Script<Void> fulfillRequest(
            String requestId, int responseCode, HeaderEntry[] responseHeaders,
            String binaryResponseHeaders, String body, String responsePhrase
        )
    {
        // Convert all Method Parameters into a JSON Request-Object (as a String)
        final String requestJSON = WriteJSON.get(
            Fetch$$Commands.fulfillRequest$$, "Fetch.fulfillRequest",
            requestId, responseCode, responseHeaders, binaryResponseHeaders, body, responsePhrase
        );

        return Script.NO_RET(Domains.Fetch, "fulfillRequest", requestJSON);
    }

    /**
     * Causes the body of the response to be received from the server and
     * returned as a single string. May only be issued for a request that
     * is paused in the Response stage and is mutually exclusive with
     * takeResponseBodyForInterceptionAsStream. Calling other methods that
     * affect the request or disabling fetch domain before body is received
     * results in an undefined behavior.
     * Note that the response body is not available for redirects. Requests
     * paused in the _redirect received_ state may be differentiated by
     * <CODE>responseCode</CODE> and presence of <CODE>location</CODE> response header, see
     * comments to <CODE>requestPaused</CODE> for details.
     * 
     * @param requestId Identifier for the intercepted request to get body for.
     * 
     * @return An instance of <CODE>{@link Script}&lt;{@link getResponseBody$$RET}&gt;</CODE>
     * 
     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
     * <CODE>&lt;{@link getResponseBody$$RET}&gt;</CODE> will be returned
     *
     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
     * be retrieved.</I>
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser Function's {@code Promise} returns:{@link getResponseBody$$RET}
     * A dedicated return type implies that the browser may return more than 1 datum
     * </DIV>
     */
    public static Script<getResponseBody$$RET> getResponseBody(String requestId)
    {
        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
        final String requestJSON = WriteJSON.get
            (CDPTypes.STRING, "requestId", false, "Fetch.getResponseBody", requestId);

        return new Script<>(
            Domains.Fetch, "getResponseBody", requestJSON,
            getResponseBody$$RET::fromJSON,
            getResponseBody$$RET.class
        );
    }

    /**
     * Returns a handle to the stream representing the response body.
     * The request must be paused in the HeadersReceived stage.
     * Note that after this command the request can't be continued
     * as is -- client either needs to cancel it or to provide the
     * response body.
     * The stream only supports sequential read, IO.read will fail if the position
     * is specified.
     * This method is mutually exclusive with getResponseBody.
     * Calling other methods that affect the request or disabling fetch
     * domain before body is received results in an undefined behavior.
     * 
     * @param requestId -
     * 
     * @return An instance of <CODE>{@link Script}&lt;String&gt;</CODE>
     * 
     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
     * <CODE>&lt;String&gt;</CODE> will be returned
     *
     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
     * be retrieved.</I>
     *
     * <BR /><BR /><DIV CLASS=JDHint>
     * This Browser Function's {@code Promise} returns:
     * <CODE>String (<B>stream</B>)</CODE>
     * </DIV>
     */
    public static Script<String> takeResponseBodyAsStream(String requestId)
    {
        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
        final String requestJSON = WriteJSON.get
            (CDPTypes.STRING, "requestId", false, "Fetch.takeResponseBodyAsStream", requestId);

        return new Script<>(
            Domains.Fetch, "takeResponseBodyAsStream", requestJSON,
            jo -> ReadJSON.getString(jo, "stream", true, false),
            String.class
        );
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // CommandBuilder Getter-Methods
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Creates a buider for conveniently assigning parameters to this method.
     * 
     * <BR /><BR /><DIV CLASS=JDHint>
     * Note that the original method expects 6 parameters, and can be cumbersome.
     * </DIV>
     * 
     * @return {@link CommandBuilder} instance, for assigning parameter values, one by one.
     * @see #continueRequest
     */
    public static CommandBuilder<Void> continueRequest()
    { return CommandBuilder.builder(Fetch$$Commands.continueRequest$$); }

    /**
     * Creates a buider for conveniently assigning parameters to this method.
     * 
     * <BR /><BR /><DIV CLASS=JDHint>
     * Note that the original method expects 5 parameters, and can be cumbersome.
     * </DIV>
     * 
     * @return {@link CommandBuilder} instance, for assigning parameter values, one by one.
     * @see #continueResponse
     */
    public static CommandBuilder<Void> continueResponse()
    { return CommandBuilder.builder(Fetch$$Commands.continueResponse$$); }

    /**
     * Creates a buider for conveniently assigning parameters to this method.
     * 
     * <BR /><BR /><DIV CLASS=JDHint>
     * Note that the original method expects 6 parameters, and can be cumbersome.
     * </DIV>
     * 
     * @return {@link CommandBuilder} instance, for assigning parameter values, one by one.
     * @see #fulfillRequest
     */
    public static CommandBuilder<Void> fulfillRequest()
    { return CommandBuilder.builder(Fetch$$Commands.fulfillRequest$$); }


}