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
package Torello.Browser.BrowserAPI.NestedHelpers.Commands;

import static Torello.Browser.CDPTypes.*; // The 'Type as Byte' constants

import Torello.JSON.*;
import Torello.Browser.BrowserAPI.*;
import Torello.Browser.Domains;
import Torello.Browser.CommandDescriptor;
import Torello.Browser.helper.DV;

import Torello.Java.ReadOnly.ReadOnlyArrayList;

import javax.json.JsonObject;
import javax.json.JsonValue; // Not all helpers require this

import Torello.Browser.JavaScriptAPI.RunTime;
import Torello.Browser.JavaScriptAPI.Debugger;

public class CacheStorage$$Commands
{
    // ********************************************************************************************
    // ********************************************************************************************
    // Command Descriptors
    // ********************************************************************************************
    // ********************************************************************************************


    public static final CommandDescriptor<Void> deleteEntry$$=
        new CommandDescriptor<>(
            "deleteEntry", Domains.CacheStorage,
            new ReadOnlyArrayList<>(String.class, "cacheId", "request"),
            new ReadOnlyArrayList<>(Byte.class, STRING, STRING),
            new ReadOnlyArrayList<>(Boolean.class, false, false),
            new ReadOnlyArrayList<>(Boolean.class, false, false),
            Void.class
        );

    public static final CommandDescriptor<CacheStorage.Cache[]> requestCacheNames$$=
        new CommandDescriptor<>(
            "requestCacheNames", Domains.CacheStorage,
            new ReadOnlyArrayList<>(String.class, "securityOrigin", "storageKey", "storageBucket"),
            new ReadOnlyArrayList<>(Byte.class, STRING, STRING, CDP_TYPE),
            new ReadOnlyArrayList<>(Boolean.class, true, true, true),
            new ReadOnlyArrayList<>(Boolean.class, false, false, false),
            CacheStorage.Cache[].class
        );

    public static final CommandDescriptor<CacheStorage.CachedResponse> requestCachedResponse$$=
        new CommandDescriptor<>(
            "requestCachedResponse", Domains.CacheStorage,
            new ReadOnlyArrayList<>(String.class, "cacheId", "requestURL", "requestHeaders"),
            new ReadOnlyArrayList<>(Byte.class, STRING, STRING, CDP_TYPE_ARRAY_1D),
            new ReadOnlyArrayList<>(Boolean.class, false, false, false),
            new ReadOnlyArrayList<>(Boolean.class, false, false, false),
            CacheStorage.CachedResponse.class
        );

    public static final CommandDescriptor<CacheStorage.requestEntries$$RET> requestEntries$$=
        new CommandDescriptor<>(
            "requestEntries", Domains.CacheStorage,
            new ReadOnlyArrayList<>
                (String.class, "cacheId", "skipCount", "pageSize", "pathFilter"),
            new ReadOnlyArrayList<>(Byte.class, STRING, BOXED_INTEGER, BOXED_INTEGER, STRING),
            new ReadOnlyArrayList<>(Boolean.class, false, true, true, true),
            new ReadOnlyArrayList<>(Boolean.class, false, false, false, false),
            CacheStorage.requestEntries$$RET.class
        );


    // ********************************************************************************************
    // ********************************************************************************************
    // JSON Response Methods
    // ********************************************************************************************
    // ********************************************************************************************


    public static CacheStorage.Cache[] requestCacheNames(final JsonObject jo)
    {
        return (jo.getJsonArray("caches") == null)
            ? null
            : RJArrIntoStream
                .objArr(
                    jo.getJsonArray("caches"), null, 0,
                    CacheStorage.Cache::fromJSON,
                    CacheStorage.Cache.class
                )
                .toArray(CacheStorage.Cache[]::new);
    }

    public static CacheStorage.CachedResponse requestCachedResponse(final JsonObject jo)
    {
        return ReadJSON.getObject(
            jo, "response",
            CacheStorage.CachedResponse::fromJSON,
            CacheStorage.CachedResponse.class,
            true, false
        );
    }

}