// Copyright © 2020 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp.DevTools.CacheStorage { using System.Linq; /// /// CacheStorage /// public partial class CacheStorage : DevToolsDomainBase { private CefSharp.DevTools.IDevToolsClient _client; public CacheStorage(CefSharp.DevTools.IDevToolsClient client) { _client = (client); } partial void ValidateDeleteCache(string cacheId); /// /// Deletes a cache. /// /// Id of cache for deletion. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task DeleteCacheAsync(string cacheId) { ValidateDeleteCache(cacheId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("cacheId", cacheId); var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.deleteCache", dict); return methodResult; } partial void ValidateDeleteEntry(string cacheId, string request); /// /// Deletes a cache entry. /// /// Id of cache where the entry will be deleted. /// URL spec of the request. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task DeleteEntryAsync(string cacheId, string request) { ValidateDeleteEntry(cacheId, request); var dict = new System.Collections.Generic.Dictionary(); dict.Add("cacheId", cacheId); dict.Add("request", request); var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.deleteEntry", dict); return methodResult; } partial void ValidateRequestCacheNames(string securityOrigin); /// /// Requests cache names. /// /// Security origin. /// returns System.Threading.Tasks.Task<RequestCacheNamesResponse> public async System.Threading.Tasks.Task RequestCacheNamesAsync(string securityOrigin) { ValidateRequestCacheNames(securityOrigin); var dict = new System.Collections.Generic.Dictionary(); dict.Add("securityOrigin", securityOrigin); var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.requestCacheNames", dict); return methodResult.DeserializeJson(); } partial void ValidateRequestCachedResponse(string cacheId, string requestURL, System.Collections.Generic.IList requestHeaders); /// /// Fetches cache entry. /// /// Id of cache that contains the entry. /// URL spec of the request. /// headers of the request. /// returns System.Threading.Tasks.Task<RequestCachedResponseResponse> public async System.Threading.Tasks.Task RequestCachedResponseAsync(string cacheId, string requestURL, System.Collections.Generic.IList requestHeaders) { ValidateRequestCachedResponse(cacheId, requestURL, requestHeaders); var dict = new System.Collections.Generic.Dictionary(); dict.Add("cacheId", cacheId); dict.Add("requestURL", requestURL); dict.Add("requestHeaders", requestHeaders.Select(x => x.ToDictionary())); var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.requestCachedResponse", dict); return methodResult.DeserializeJson(); } partial void ValidateRequestEntries(string cacheId, int? skipCount = null, int? pageSize = null, string pathFilter = null); /// /// Requests data from cache. /// /// ID of cache to get entries from. /// Number of records to skip. /// Number of records to fetch. /// If present, only return the entries containing this substring in the path /// returns System.Threading.Tasks.Task<RequestEntriesResponse> public async System.Threading.Tasks.Task RequestEntriesAsync(string cacheId, int? skipCount = null, int? pageSize = null, string pathFilter = null) { ValidateRequestEntries(cacheId, skipCount, pageSize, pathFilter); var dict = new System.Collections.Generic.Dictionary(); dict.Add("cacheId", cacheId); if (skipCount.HasValue) { dict.Add("skipCount", skipCount.Value); } if (pageSize.HasValue) { dict.Add("pageSize", pageSize.Value); } if (!(string.IsNullOrEmpty(pathFilter))) { dict.Add("pathFilter", pathFilter); } var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.requestEntries", dict); return methodResult.DeserializeJson(); } } }