From aff34f68a5c0b70f89252e38ddafae5ad331ad1d Mon Sep 17 00:00:00 2001 From: h00586870 Date: Mon, 28 Apr 2025 15:19:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=8B=E8=BD=BD=206.0=20-?= =?UTF-8?q?=20=E9=A2=84=E4=B8=8B=E8=BD=BD=E6=8E=A5=E5=8F=A3=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: h00586870 --- api/@ohos.request.cacheDownload.d.ts | 148 +++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/api/@ohos.request.cacheDownload.d.ts b/api/@ohos.request.cacheDownload.d.ts index 6a7e13cafa..97e5e3b257 100644 --- a/api/@ohos.request.cacheDownload.d.ts +++ b/api/@ohos.request.cacheDownload.d.ts @@ -28,6 +28,15 @@ import { BusinessError } from './@ohos.base'; * @since 18 */ declare namespace cacheDownload { + /** + * The secure communication protocol. + * + * @typedef { 'TLS' | 'TLCP' } + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + export type SslType = 'TLS' | 'TLCP'; + /** * Options of the cache download task. * @@ -44,6 +53,133 @@ declare namespace cacheDownload { * @since 18 */ headers?: Record; + /** + * Which secure communication protocol is used. + * If this value is not specified, use 'TLS' by default. + * + * @type { ?SslType } + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + sslType?: SslType; + } + + /** + * Network information of historical cache downloads. + * + * @typedef NetworkInfo + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + interface NetworkInfo { + /** + * The IP address of a specific URL is used when downloading resources. + * + * @type string + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly ip: string; + /** + * The DNS server list is used when downloading resources. + * + * @type string[] + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly dnsServers: string[]; + } + + /** + * Performance information of historical cache downloads. + * + * @typedef PerformanceInfo + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + interface PerformanceInfo { + /** + * Time taken from startup to DNS resolution completion, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly dnsTiming: number; + /** + * Time taken from startup to TCP connection completion, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly connectTiming: number; + /** + * Time taken from startup to TLS connection completion, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly tlsTiming: number; + /** + * Time taken from startup to start sending the first byte, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly firstSendTiming: number; + /** + * Time taken from startup to receiving the first byte, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly firstReceiveTiming: number; + /** + * Time taken from startup to the completion of the request, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly totalTiming: number; + /** + * Time taken from startup to completion of all redirection steps, in milliseconds. + * + * @type number + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly redirectTiming: number; + } + + /** + * Information of historical cache downloads. + * + * @typedef CacheDownloadOptions + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + interface CacheInfo { + /** + * Network information of historical cache downloads. + * + * @type NetworkInfo + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly network: NetworkInfo; + /** + * Performance information of historical cache downloads. + * + * @type PerformanceInfo + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + */ + readonly performance: PerformanceInfo; } /** @@ -100,6 +236,18 @@ declare namespace cacheDownload { * @since 18 */ function setFileCacheSize(bytes: number); + + /** + * Gets historical information of cache downloads based on URL. + * If the specified URL has been downloaded before, return `CacheInfo`. + * If the specified URL has not been downloaded before, return `undefined`. + * + * @param { string } url - URL to be queried. + * @syscap SystemCapability.Request.FileTransferAgent + * @since 20 + * @arkts 1.1&1.2 + */ + function getCacheInfo(url: string): CacheInfo | undefined; } export default cacheDownload; \ No newline at end of file -- Gitee