| // Code generated by cdpgen. DO NOT EDIT. |
| |
| // Package applicationcache implements the ApplicationCache domain. |
| package applicationcache |
| |
| import ( |
| "context" |
| |
| "github.com/mafredri/cdp/protocol/internal" |
| "github.com/mafredri/cdp/rpcc" |
| ) |
| |
| // domainClient is a client for the ApplicationCache domain. |
| type domainClient struct{ conn *rpcc.Conn } |
| |
| // NewClient returns a client for the ApplicationCache domain with the connection set to conn. |
| func NewClient(conn *rpcc.Conn) *domainClient { |
| return &domainClient{conn: conn} |
| } |
| |
| // Enable invokes the ApplicationCache method. Enables application cache |
| // domain notifications. |
| func (d *domainClient) Enable(ctx context.Context) (err error) { |
| err = rpcc.Invoke(ctx, "ApplicationCache.enable", nil, nil, d.conn) |
| if err != nil { |
| err = &internal.OpError{Domain: "ApplicationCache", Op: "Enable", Err: err} |
| } |
| return |
| } |
| |
| // GetApplicationCacheForFrame invokes the ApplicationCache method. Returns |
| // relevant application cache data for the document in given frame. |
| func (d *domainClient) GetApplicationCacheForFrame(ctx context.Context, args *GetApplicationCacheForFrameArgs) (reply *GetApplicationCacheForFrameReply, err error) { |
| reply = new(GetApplicationCacheForFrameReply) |
| if args != nil { |
| err = rpcc.Invoke(ctx, "ApplicationCache.getApplicationCacheForFrame", args, reply, d.conn) |
| } else { |
| err = rpcc.Invoke(ctx, "ApplicationCache.getApplicationCacheForFrame", nil, reply, d.conn) |
| } |
| if err != nil { |
| err = &internal.OpError{Domain: "ApplicationCache", Op: "GetApplicationCacheForFrame", Err: err} |
| } |
| return |
| } |
| |
| // GetFramesWithManifests invokes the ApplicationCache method. Returns array |
| // of frame identifiers with manifest urls for each frame containing a document |
| // associated with some application cache. |
| func (d *domainClient) GetFramesWithManifests(ctx context.Context) (reply *GetFramesWithManifestsReply, err error) { |
| reply = new(GetFramesWithManifestsReply) |
| err = rpcc.Invoke(ctx, "ApplicationCache.getFramesWithManifests", nil, reply, d.conn) |
| if err != nil { |
| err = &internal.OpError{Domain: "ApplicationCache", Op: "GetFramesWithManifests", Err: err} |
| } |
| return |
| } |
| |
| // GetManifestForFrame invokes the ApplicationCache method. Returns manifest |
| // URL for document in the given frame. |
| func (d *domainClient) GetManifestForFrame(ctx context.Context, args *GetManifestForFrameArgs) (reply *GetManifestForFrameReply, err error) { |
| reply = new(GetManifestForFrameReply) |
| if args != nil { |
| err = rpcc.Invoke(ctx, "ApplicationCache.getManifestForFrame", args, reply, d.conn) |
| } else { |
| err = rpcc.Invoke(ctx, "ApplicationCache.getManifestForFrame", nil, reply, d.conn) |
| } |
| if err != nil { |
| err = &internal.OpError{Domain: "ApplicationCache", Op: "GetManifestForFrame", Err: err} |
| } |
| return |
| } |
| |
| func (d *domainClient) ApplicationCacheStatusUpdated(ctx context.Context) (StatusUpdatedClient, error) { |
| s, err := rpcc.NewStream(ctx, "ApplicationCache.applicationCacheStatusUpdated", d.conn) |
| if err != nil { |
| return nil, err |
| } |
| return &statusUpdatedClient{Stream: s}, nil |
| } |
| |
| type statusUpdatedClient struct{ rpcc.Stream } |
| |
| // GetStream returns the original Stream for use with cdp.Sync. |
| func (c *statusUpdatedClient) GetStream() rpcc.Stream { return c.Stream } |
| |
| func (c *statusUpdatedClient) Recv() (*StatusUpdatedReply, error) { |
| event := new(StatusUpdatedReply) |
| if err := c.RecvMsg(event); err != nil { |
| return nil, &internal.OpError{Domain: "ApplicationCache", Op: "ApplicationCacheStatusUpdated Recv", Err: err} |
| } |
| return event, nil |
| } |
| |
| func (d *domainClient) NetworkStateUpdated(ctx context.Context) (NetworkStateUpdatedClient, error) { |
| s, err := rpcc.NewStream(ctx, "ApplicationCache.networkStateUpdated", d.conn) |
| if err != nil { |
| return nil, err |
| } |
| return &networkStateUpdatedClient{Stream: s}, nil |
| } |
| |
| type networkStateUpdatedClient struct{ rpcc.Stream } |
| |
| // GetStream returns the original Stream for use with cdp.Sync. |
| func (c *networkStateUpdatedClient) GetStream() rpcc.Stream { return c.Stream } |
| |
| func (c *networkStateUpdatedClient) Recv() (*NetworkStateUpdatedReply, error) { |
| event := new(NetworkStateUpdatedReply) |
| if err := c.RecvMsg(event); err != nil { |
| return nil, &internal.OpError{Domain: "ApplicationCache", Op: "NetworkStateUpdated Recv", Err: err} |
| } |
| return event, nil |
| } |