2017-01-24 15:09:23 +00:00
|
|
|
// Package cachestorage provides the Chrome Debugging Protocol
|
2017-02-12 04:59:33 +00:00
|
|
|
// commands, types, and events for the CacheStorage domain.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package cachestorage
|
|
|
|
|
2017-07-09 02:05:19 +00:00
|
|
|
// Code generated by chromedp-gen. DO NOT EDIT.
|
2017-01-24 15:09:23 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
cdp "github.com/knq/chromedp/cdp"
|
2017-01-24 15:09:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// RequestCacheNamesParams requests cache names.
|
|
|
|
type RequestCacheNamesParams struct {
|
|
|
|
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestCacheNames requests cache names.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// securityOrigin - Security origin.
|
|
|
|
func RequestCacheNames(securityOrigin string) *RequestCacheNamesParams {
|
|
|
|
return &RequestCacheNamesParams{
|
|
|
|
SecurityOrigin: securityOrigin,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestCacheNamesReturns return values.
|
|
|
|
type RequestCacheNamesReturns struct {
|
|
|
|
Caches []*Cache `json:"caches,omitempty"` // Caches for the security origin.
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes CacheStorage.requestCacheNames against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// caches - Caches for the security origin.
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res RequestCacheNamesReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, p, &res)
|
2017-01-24 15:09:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
return res.Caches, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RequestEntriesParams requests data from cache.
|
|
|
|
type RequestEntriesParams struct {
|
|
|
|
CacheID CacheID `json:"cacheId"` // ID of cache to get entries from.
|
|
|
|
SkipCount int64 `json:"skipCount"` // Number of records to skip.
|
|
|
|
PageSize int64 `json:"pageSize"` // Number of records to fetch.
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestEntries requests data from cache.
|
|
|
|
//
|
|
|
|
// parameters:
|
2017-01-26 07:28:34 +00:00
|
|
|
// cacheID - ID of cache to get entries from.
|
2017-01-24 15:09:23 +00:00
|
|
|
// skipCount - Number of records to skip.
|
|
|
|
// pageSize - Number of records to fetch.
|
2017-01-26 07:28:34 +00:00
|
|
|
func RequestEntries(cacheID CacheID, skipCount int64, pageSize int64) *RequestEntriesParams {
|
2017-01-24 15:09:23 +00:00
|
|
|
return &RequestEntriesParams{
|
2017-01-26 07:28:34 +00:00
|
|
|
CacheID: cacheID,
|
2017-01-24 15:09:23 +00:00
|
|
|
SkipCount: skipCount,
|
|
|
|
PageSize: pageSize,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestEntriesReturns return values.
|
|
|
|
type RequestEntriesReturns struct {
|
|
|
|
CacheDataEntries []*DataEntry `json:"cacheDataEntries,omitempty"` // Array of object store data entries.
|
|
|
|
HasMore bool `json:"hasMore,omitempty"` // If true, there are more entries to fetch in the given range.
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes CacheStorage.requestEntries against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// cacheDataEntries - Array of object store data entries.
|
|
|
|
// hasMore - If true, there are more entries to fetch in the given range.
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res RequestEntriesReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, p, &res)
|
2017-01-24 15:09:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, false, err
|
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
return res.CacheDataEntries, res.HasMore, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteCacheParams deletes a cache.
|
|
|
|
type DeleteCacheParams struct {
|
|
|
|
CacheID CacheID `json:"cacheId"` // Id of cache for deletion.
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteCache deletes a cache.
|
|
|
|
//
|
|
|
|
// parameters:
|
2017-01-26 07:28:34 +00:00
|
|
|
// cacheID - Id of cache for deletion.
|
|
|
|
func DeleteCache(cacheID CacheID) *DeleteCacheParams {
|
2017-01-24 15:09:23 +00:00
|
|
|
return &DeleteCacheParams{
|
2017-01-26 07:28:34 +00:00
|
|
|
CacheID: cacheID,
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes CacheStorage.deleteCache against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, p, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteEntryParams deletes a cache entry.
|
|
|
|
type DeleteEntryParams struct {
|
|
|
|
CacheID CacheID `json:"cacheId"` // Id of cache where the entry will be deleted.
|
|
|
|
Request string `json:"request"` // URL spec of the request.
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteEntry deletes a cache entry.
|
|
|
|
//
|
|
|
|
// parameters:
|
2017-01-26 07:28:34 +00:00
|
|
|
// cacheID - Id of cache where the entry will be deleted.
|
2017-01-24 15:09:23 +00:00
|
|
|
// request - URL spec of the request.
|
2017-01-26 07:28:34 +00:00
|
|
|
func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
|
2017-01-24 15:09:23 +00:00
|
|
|
return &DeleteEntryParams{
|
2017-01-26 07:28:34 +00:00
|
|
|
CacheID: cacheID,
|
2017-01-24 15:09:23 +00:00
|
|
|
Request: request,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes CacheStorage.deleteEntry against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|