chromedp/cdp/cachestorage/cachestorage.go
Kenneth Shaw b5032069e3 Fixing race issues
- Refactored chromedp-gen and cdp code so that Execute no longer returns
  a channel
- Fixing potential race problems in handler
- Eliminated some dead code
- Updated examples to include new logging parameters
2017-02-14 17:15:53 +07:00

139 lines
4.1 KiB
Go

// Package cachestorage provides the Chrome Debugging Protocol
// commands, types, and events for the CacheStorage domain.
//
// Generated by the chromedp-gen command.
package cachestorage
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// 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.
}
// Do executes CacheStorage.requestCacheNames against the provided context and
// target handler.
//
// returns:
// caches - Caches for the security origin.
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
// execute
var res RequestCacheNamesReturns
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, p, &res)
if err != nil {
return nil, err
}
return res.Caches, nil
}
// 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:
// cacheID - ID of cache to get entries from.
// skipCount - Number of records to skip.
// pageSize - Number of records to fetch.
func RequestEntries(cacheID CacheID, skipCount int64, pageSize int64) *RequestEntriesParams {
return &RequestEntriesParams{
CacheID: cacheID,
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.
}
// Do executes CacheStorage.requestEntries against the provided context and
// target handler.
//
// returns:
// cacheDataEntries - Array of object store data entries.
// hasMore - If true, there are more entries to fetch in the given range.
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
// execute
var res RequestEntriesReturns
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, p, &res)
if err != nil {
return nil, false, err
}
return res.CacheDataEntries, res.HasMore, nil
}
// DeleteCacheParams deletes a cache.
type DeleteCacheParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache for deletion.
}
// DeleteCache deletes a cache.
//
// parameters:
// cacheID - Id of cache for deletion.
func DeleteCache(cacheID CacheID) *DeleteCacheParams {
return &DeleteCacheParams{
CacheID: cacheID,
}
}
// Do executes CacheStorage.deleteCache against the provided context and
// target handler.
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, p, nil)
}
// 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:
// cacheID - Id of cache where the entry will be deleted.
// request - URL spec of the request.
func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
return &DeleteEntryParams{
CacheID: cacheID,
Request: request,
}
}
// Do executes CacheStorage.deleteEntry against the provided context and
// target handler.
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil)
}