1// Package applicationcache provides the Chrome DevTools Protocol 2// commands, types, and events for the ApplicationCache domain. 3// 4// Generated by the cdproto-gen command. 5package applicationcache 6 7// Code generated by cdproto-gen. DO NOT EDIT. 8 9import ( 10 "context" 11 12 "github.com/chromedp/cdproto/cdp" 13) 14 15// EnableParams enables application cache domain notifications. 16type EnableParams struct{} 17 18// Enable enables application cache domain notifications. 19// 20// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-enable 21func Enable() *EnableParams { 22 return &EnableParams{} 23} 24 25// Do executes ApplicationCache.enable against the provided context. 26func (p *EnableParams) Do(ctx context.Context) (err error) { 27 return cdp.Execute(ctx, CommandEnable, nil, nil) 28} 29 30// GetApplicationCacheForFrameParams returns relevant application cache data 31// for the document in given frame. 32type GetApplicationCacheForFrameParams struct { 33 FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache is retrieved. 34} 35 36// GetApplicationCacheForFrame returns relevant application cache data for 37// the document in given frame. 38// 39// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-getApplicationCacheForFrame 40// 41// parameters: 42// frameID - Identifier of the frame containing document whose application cache is retrieved. 43func GetApplicationCacheForFrame(frameID cdp.FrameID) *GetApplicationCacheForFrameParams { 44 return &GetApplicationCacheForFrameParams{ 45 FrameID: frameID, 46 } 47} 48 49// GetApplicationCacheForFrameReturns return values. 50type GetApplicationCacheForFrameReturns struct { 51 ApplicationCache *ApplicationCache `json:"applicationCache,omitempty"` // Relevant application cache data for the document in given frame. 52} 53 54// Do executes ApplicationCache.getApplicationCacheForFrame against the provided context. 55// 56// returns: 57// applicationCache - Relevant application cache data for the document in given frame. 58func (p *GetApplicationCacheForFrameParams) Do(ctx context.Context) (applicationCache *ApplicationCache, err error) { 59 // execute 60 var res GetApplicationCacheForFrameReturns 61 err = cdp.Execute(ctx, CommandGetApplicationCacheForFrame, p, &res) 62 if err != nil { 63 return nil, err 64 } 65 66 return res.ApplicationCache, nil 67} 68 69// GetFramesWithManifestsParams returns array of frame identifiers with 70// manifest urls for each frame containing a document associated with some 71// application cache. 72type GetFramesWithManifestsParams struct{} 73 74// GetFramesWithManifests returns array of frame identifiers with manifest 75// urls for each frame containing a document associated with some application 76// cache. 77// 78// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-getFramesWithManifests 79func GetFramesWithManifests() *GetFramesWithManifestsParams { 80 return &GetFramesWithManifestsParams{} 81} 82 83// GetFramesWithManifestsReturns return values. 84type GetFramesWithManifestsReturns struct { 85 FrameIds []*FrameWithManifest `json:"frameIds,omitempty"` // Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache. 86} 87 88// Do executes ApplicationCache.getFramesWithManifests against the provided context. 89// 90// returns: 91// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache. 92func (p *GetFramesWithManifestsParams) Do(ctx context.Context) (frameIds []*FrameWithManifest, err error) { 93 // execute 94 var res GetFramesWithManifestsReturns 95 err = cdp.Execute(ctx, CommandGetFramesWithManifests, nil, &res) 96 if err != nil { 97 return nil, err 98 } 99 100 return res.FrameIds, nil 101} 102 103// GetManifestForFrameParams returns manifest URL for document in the given 104// frame. 105type GetManifestForFrameParams struct { 106 FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose manifest is retrieved. 107} 108 109// GetManifestForFrame returns manifest URL for document in the given frame. 110// 111// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-getManifestForFrame 112// 113// parameters: 114// frameID - Identifier of the frame containing document whose manifest is retrieved. 115func GetManifestForFrame(frameID cdp.FrameID) *GetManifestForFrameParams { 116 return &GetManifestForFrameParams{ 117 FrameID: frameID, 118 } 119} 120 121// GetManifestForFrameReturns return values. 122type GetManifestForFrameReturns struct { 123 ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL for document in the given frame. 124} 125 126// Do executes ApplicationCache.getManifestForFrame against the provided context. 127// 128// returns: 129// manifestURL - Manifest URL for document in the given frame. 130func (p *GetManifestForFrameParams) Do(ctx context.Context) (manifestURL string, err error) { 131 // execute 132 var res GetManifestForFrameReturns 133 err = cdp.Execute(ctx, CommandGetManifestForFrame, p, &res) 134 if err != nil { 135 return "", err 136 } 137 138 return res.ManifestURL, nil 139} 140 141// Command names. 142const ( 143 CommandEnable = "ApplicationCache.enable" 144 CommandGetApplicationCacheForFrame = "ApplicationCache.getApplicationCacheForFrame" 145 CommandGetFramesWithManifests = "ApplicationCache.getFramesWithManifests" 146 CommandGetManifestForFrame = "ApplicationCache.getManifestForFrame" 147) 148